orderedmap
orderedmap copied to clipboard
[feature request] a way to break `forEach` - or add `some` ?
It can be frustrating to loop over each key, value when searching for one value in particular.
Default implementation for this
// :: (any, string, index) → boolean
// Takes a predicate function that takes 3 arguments
// Value, key, index
// Returns true if any item matches the predicate, false otherwise
some: function(predicate) {
for (var i = 1; i < this.content.length; i += 2)
if (predicate(this.content[i], this.content[i-1], i/2)) return true
return false
},