Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Useful functions and experimental bytes to make underscore even sweeter
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


Shorthands to generate iterator functions for most of the common use cases of the collection methods. Its like a souped up version of _.pluck for the following functions:

any, all, map, detect, filter

The basic shorthand is to perform a === between a key and a value:

_.any(dogs, 'name', 'leroy')  // generates an iterator that looks like:
_.any(dogs, function (dog) { return === 'leroy'; })

_.detect(dog, 'age', 5),
_.detect(dog, function (dog) { return dog.age === 5; })

If you've got multiple key/values you want to check against, you can pass an object instead:

_.filter(dogs, {age: 5, name: 'lily'})
_.filter(dogs, function (dog) { return dog.age === 5 && == 'lily'; })

There's some special cases that are handled too.

If you just a key (technically, if value is undefined), it will return the property at that key:, 'name'), function (dog) return; })  // or _.pluck(dogs, 'name')

If the key ends with (), it will use the result of invoking that function:, 'isYappy()'), function (dog) { return dog.isYappy(); })

If value is a regex a string match iterator is built:

_.all(dogs, 'name', /(a|e|i)/)
_.all(dogs, function (dog) { return /(a|e|i)/.test(; })

By using _.mixin(), all these shorthands are available on the wrapper too:

_(dogs).all('name', /(a|e|i)/)


You can still of course pass a normal iterator function in, which flexyargs will quickly pass through to the standard underscore implementation. No matter the case, if the native version of a collection method is available, it will be used!

Only the methods listed above have the flexy magic, not some, every and other aliases.

Something went wrong with that request. Please try again.