Array, there's no
Set data structure. ECMAScript 6 will rectify these. But until it's widely available, let's use some temporary stuff.
npm install qdds
bower install qdds
map =mapmap // throw Error if k doesn't existmapmapmapall // all [k, v] pairsmap // all keys
These methods are also available for both
some. This works by calling to the corresponding method of
Array, if one exists.
The default strategy does not require you to implement any sort of
equals() methods, like in Java or C#. It just works, in its quick & dirty way.
If you ever need more than the default algorithm, you can extend both
Set by supplying an object with two methods:
map = customStrategyset = customStrategy
For example, this example (extracted from the tests) shows a super trivial Java/C# like algorithm. This is just to give you an idea, don't use it.
java_like_strategy =: khashCode: k1equalsk2preferences = java_like_strategy:: -> @name + @age: @name is othername and @age is otheragelang_prefs = languages: "coffee""js"p1 = "guy"30p2 = "guy"30preferencessetp1lang_prefsexpectpreferencesgetp2toequallang_prefs