mori icon indicating copy to clipboard operation
mori copied to clipboard

nth does not coerce

Open maxhoffmann opened this issue 9 years ago • 1 comments

In the docs for nth it says:

For collections which are not sequential like sets and hash-map, the collection will be coerced into a sequence first.

When I tested nth it did not coerce though:

m.nth(m.set(['test']), 0)
m.nth(m.hashMap("name", "john"), 0)
// Error: nth not supported on this type

Manually converting the set to a sequence works:

m.nth(m.seq(m.set(['test'])), 0)
// 'test'
m.nth(m.seq(m.hashMap("name", "john")), 0)
// ["name" "john"]

Either the documentation is wrong or this is a bug. Or I am misunderstanding something as I just started playing around with mori. :)


tested in node 0.12 repl

maxhoffmann avatar May 13 '15 21:05 maxhoffmann