swannodette / mori

ClojureScript's persistent data structures and supporting API from the comfort of vanilla JavaScript

Home Page:http://swannodette.github.io/mori

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Idiomatic JS method names being obfuscated by Closure

ds300 opened this issue · comments

I've just tried 0.3.2 in io.js

> var m = require('mori')
undefined
> var x = m.hashMap(4, 5)
undefined
> x
{4 5}
> x.get(4)
TypeError: undefined is not a function
    at repl:1:3
    at REPLServer.defaultEval (repl.js:124:27)
    at bound (domain.js:254:14)
    at REPLServer.runBound [as eval] (domain.js:267:12)
    at REPLServer.<anonymous> (repl.js:277:12)
    at emitOne (events.js:77:13)
    at REPLServer.emit (events.js:166:7)
    at REPLServer.Interface._onLine (readline.js:198:10)
    at REPLServer.Interface._line (readline.js:537:8)
    at REPLServer.Interface._ttyWrite (readline.js:814:14)
> x.__proto__
{ toString: [Function],
  t: [Function],
  s: [Function],
  gb: [Function],
  vb: true,
  fb: [Function],
  H: [Function],
  L: [Function],
  B: [Function],
  A: [Function],
  '$a': [Function],
  J: [Function],
  R: [Function],
  O: [Function],
  wb: [Function],
  Ka: [Function],
  rb: [Function],
  D: [Function],
  F: [Function],
  G: [Function],
  call: { [Function] a: [Function], c: [Function] },
  apply: [Function],
  b: [Function],
  a: [Function],
  undefined: [Function],
  I: true,
  v: [Function],
  inspect: [Function] }

I think b or a is get. They both return 5 anyway.

Oct 8, not even a comment!

I think the message is pretty clear at this point...

The mori API is not a traditional JavaScript chaining syntax, per the docs, the proper way to perform that operation would be:

var m = require('mori')
var x = m.hashMap(4, 5)
m.get(x, 4)

@tgriesser See the section of the readme under the heading 'ES6 Map/Set inspired interfaces'.