_.unique

uniq_.uniq(array, [isSorted], [iteratee]) Alias: unique Produces a duplicate-free version of the array, using === to test object equality. In particular only the first occurence of each value is kept. If you know in advance that the array is sorted, passing true for isSorted will run a much faster algorithm. If you want to compute unique items based on a transformation, pass an iteratee function. _.uniq([1, 2, 1, 4, 1, 3]); => [1, 2, 4, 3]

_.toArray

toArray_.toArray(list) Creates a real Array from the list (anything that can be iterated over). Useful for transmuting the arguments object. (function(){ return _.toArray(arguments).slice(1); })(1, 2, 3, 4); => [2, 3, 4]

_.sortBy

sortBy_.sortBy(list, iteratee, [context]) Returns a (stably) sorted copy of list, ranked in ascending order by the results of running each value through iteratee. iteratee may also be the string name of the property to sort by (eg. length). _.sortBy([1, 2, 3, 4, 5, 6], function(num){ return Math.sin(num); }); => [5, 4, 6, 3, 1, 2] var stooges = [{name: 'moe', age: 40}, {name: 'larry', age: 50}, {name: 'curly', age: 60}]; _.sortBy(stooges, 'name'); => [{name: 'curly', age: 60}, {name:

_.tap

tap_.tap(object, interceptor) Invokes interceptor with the object, and then returns object. The primary purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. _.chain([1,2,3,200]) .filter(function(num) { return num % 2 == 0; }) .tap(alert) .map(function(num) { return num * num }) .value(); => // [2, 200] (alerted) => [4, 40000]

_.template

template_.template(templateString, [settings]) Compiles JavaScript templates into functions that can be evaluated for rendering. Useful for rendering complicated bits of HTML from JSON data sources. Template functions can both interpolate values, using <%= ⦠%>, as well as execute arbitrary JavaScript code, with <% ⦠%>. If you wish to interpolate a value, and have it be HTML-escaped, use <%- ⦠%>. When you evaluate a template function, pass in a data object that

_.times

times_.times(n, iteratee, [context]) Invokes the given iteratee function n times. Each invocation of iteratee is called with an index argument. Produces an array of the returned values. Note: this example uses the object-oriented syntax. _(3).times(function(n){ genie.grantWishNumber(n); });

_.throttle

throttle_.throttle(function, wait, [options]) Creates and returns a new, throttled version of the passed function, that, when invoked repeatedly, will only actually call the original function at most once per every wait milliseconds. Useful for rate-limiting events that occur faster than you can keep up with. By default, throttle will execute the function as soon as you call it for the first time, and, if you call it again any number of times during the wait period, as soon as that period i

_.size

size_.size(list) Return the number of values in the list. _.size({one: 1, two: 2, three: 3}); => 3

_.sortedIndex

sortedIndex_.sortedIndex(list, value, [iteratee], [context]) Uses a binary search to determine the index at which the value should be inserted into the list in order to maintain the list's sorted order. If an iteratee function is provided, it will be used to compute the sort ranking of each value, including the value you pass. The iteratee may also be the string name of the property to sort by (eg. length). _.sortedIndex([10, 20, 30, 40, 50], 35); => 3 var stooges = [{name: 'moe', age:

_.sample

sample_.sample(list, [n]) Produce a random sample from the list. Pass a number to return n random elements from the list. Otherwise a single random item will be returned. _.sample([1, 2, 3, 4, 5, 6]); => 4 _.sample([1, 2, 3, 4, 5, 6], 3); => [1, 6, 2]