From 293fc695a435cf16574e9e8d113bf32580264e46 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 3 May 2012 14:28:13 -0400 Subject: [PATCH] lodash: Update documentation and submodules. [jddalton] Former-commit-id: 9948b9ad5b2dc34a8f442e881f1d75178622364f --- doc/README.md | 1131 +++++++++++++++++++++++++++++++------------ lodash.js | 3 +- vendor/benchmark.js | 2 +- vendor/docdown | 2 +- 4 files changed, 837 insertions(+), 301 deletions(-) diff --git a/doc/README.md b/doc/README.md index d69700c04..966eec8f8 100644 --- a/doc/README.md +++ b/doc/README.md @@ -6,90 +6,97 @@ ## `_` -* [`_`](#_) -* [`_.VERSION`](#_.VERSION) -* [`_.after`](#_.after) -* [`_.bind`](#_.bind) -* [`_.bindAll`](#_.bindAll) -* [`_.chain`](#_.chain) -* [`_.chain`](#_.chain) -* [`_.clone`](#_.clone) -* [`_.compact`](#_.compact) -* [`_.compose`](#_.compose) -* [`_.contains`](#_.contains) -* [`_.debounce`](#_.debounce) -* [`_.defaults`](#_.defaults) -* [`_.defer`](#_.defer) -* [`_.delay`](#_.delay) -* [`_.difference`](#_.difference) -* [`_.escape`](#_.escape) -* [`_.every`](#_.every) -* [`_.extend`](#_.extend) -* [`_.filter`](#_.filter) -* [`_.find`](#_.find) -* [`_.first`](#_.first) -* [`_.flatten`](#_.flatten) -* [`_.forEach`](#_.forEach) -* [`_.functions`](#_.functions) -* [`_.groupBy`](#_.groupBy) -* [`_.has`](#_.has) -* [`_.identity`](#_.identity) -* [`_.indexOf`](#_.indexOf) -* [`_.initial`](#_.initial) -* [`_.intersection`](#_.intersection) -* [`_.invoke`](#_.invoke) -* [`_.isArguments`](#_.isArguments) -* [`_.isArray`](#_.isArray) -* [`_.isBoolean`](#_.isBoolean) -* [`_.isDate`](#_.isDate) -* [`_.isElement`](#_.isElement) -* [`_.isEmpty`](#_.isEmpty) -* [`_.isEqual`](#_.isEqual) -* [`_.isFinite`](#_.isFinite) -* [`_.isFunction`](#_.isFunction) -* [`_.isNaN`](#_.isNaN) -* [`_.isNull`](#_.isNull) -* [`_.isNumber`](#_.isNumber) -* [`_.isObject`](#_.isObject) -* [`_.isRegExp`](#_.isRegExp) -* [`_.isString`](#_.isString) -* [`_.isUndefined`](#_.isUndefined) -* [`_.keys`](#_.keys) -* [`_.last`](#_.last) -* [`_.lastIndexOf`](#_.lastIndexOf) -* [`_.map`](#_.map) -* [`_.max`](#_.max) -* [`_.memoize`](#_.memoize) -* [`_.min`](#_.min) -* [`_.mixin`](#_.mixin) -* [`_.noConflict`](#_.noConflict) -* [`_.once`](#_.once) -* [`_.pick`](#_.pick) -* [`_.pluck`](#_.pluck) -* [`_.range`](#_.range) -* [`_.reduce`](#_.reduce) -* [`_.reduceRight`](#_.reduceRight) -* [`_.reject`](#_.reject) -* [`_.rest`](#_.rest) -* [`_.result`](#_.result) -* [`_.shuffle`](#_.shuffle) -* [`_.size`](#_.size) -* [`_.some`](#_.some) -* [`_.sortBy`](#_.sortBy) -* [`_.sortedIndex`](#_.sortedIndex) -* [`_.tap`](#_.tap) -* [`_.template`](#_.template) -* [`_.throttle`](#_.throttle) -* [`_.times`](#_.times) -* [`_.toArray`](#_.toArray) -* [`_.union`](#_.union) -* [`_.uniq`](#_.uniq) -* [`_.uniqueId`](#_.uniqueId) -* [`_.value`](#_.value) -* [`_.values`](#_.values) -* [`_.without`](#_.without) -* [`_.wrap`](#_.wrap) -* [`_.zip`](#_.zip) +* [`_`](#_value) +* [`_.VERSION`](#_version) +* [`_.after`](#_aftertimes-func) +* [`_.bind`](#_bindfunc--arg1-arg2-) +* [`_.bindAll`](#_bindallobject--methodname1-methodname2-) +* [`_.chain`](#_chainvalue) +* [`_.clone`](#_clonevalue) +* [`_.compact`](#_compactarray) +* [`_.compose`](#_composefunc1-func2-) +* [`_.contains`](#_containscollection-target) +* [`_.debounce`](#_debouncefunc-wait-immediate) +* [`_.defaults`](#_defaultsobject--defaults1-defaults2-) +* [`_.defer`](#_deferfunc--arg1-arg2-) +* [`_.delay`](#_delayfunc-wait--arg1-arg2-) +* [`_.difference`](#_differencearray--array1-array2-) +* [`_.escape`](#_escapestring) +* [`_.every`](#_everycollection-callback--thisarg) +* [`_.extend`](#_extendobject--source1-source2-) +* [`_.filter`](#_filtercollection-callback--thisarg) +* [`_.find`](#_findcollection-callback--thisarg) +* [`_.first`](#_firstarray--n-guard) +* [`_.flatten`](#_flattenarray-shallow) +* [`_.forEach`](#_foreachcollection-callback--thisarg) +* [`_.functions`](#_functionsobject) +* [`_.groupBy`](#_groupbycollection-callback--thisarg) +* [`_.has`](#_hasobject-property) +* [`_.identity`](#_identityvalue) +* [`_.indexOf`](#_indexofarray-value--issortedfalse) +* [`_.initial`](#_initialarray--n-guard) +* [`_.intersection`](#_intersectionarray1-array2-) +* [`_.invoke`](#_invokearray-methodname--arg1-arg2-) +* [`_.isArguments`](#_isargumentsvalue) +* [`_.isArray`](#_isarrayvalue) +* [`_.isBoolean`](#_isbooleanvalue) +* [`_.isDate`](#_isdatevalue) +* [`_.isElement`](#_iselementvalue) +* [`_.isEmpty`](#_isemptyvalue) +* [`_.isEqual`](#_isequala-b--stack) +* [`_.isFinite`](#_isfinitevalue) +* [`_.isFunction`](#_isfunctionvalue) +* [`_.isNaN`](#_isnanvalue) +* [`_.isNull`](#_isnullvalue) +* [`_.isNumber`](#_isnumbervalue) +* [`_.isObject`](#_isobjectvalue) +* [`_.isRegExp`](#_isregexpvalue) +* [`_.isString`](#_isstringvalue) +* [`_.isUndefined`](#_isundefinedvalue) +* [`_.keys`](#_keysobject) +* [`_.last`](#_lastarray--n-guard) +* [`_.lastIndexOf`](#_lastindexofarray-value) +* [`_.map`](#_mapcollection-callback--thisarg) +* [`_.max`](#_maxcollection--callback-thisarg) +* [`_.memoize`](#_memoizefunc--resolver) +* [`_.min`](#_mincollection--callback-thisarg) +* [`_.mixin`](#_mixinobject) +* [`_.noConflict`](#_noconflict) +* [`_.once`](#_oncefunc) +* [`_.pick`](#_pickobject--prop1-prop2-) +* [`_.pluck`](#_pluckcollection-property) +* [`_.range`](#_rangestart0-end--step1) +* [`_.reduce`](#_reducecollection-callback--accumulator-thisarg) +* [`_.reduceRight`](#_reducerightcollection-callback--accumulator-thisarg) +* [`_.reject`](#_rejectcollection-callback--thisarg) +* [`_.rest`](#_restarray--n-guard) +* [`_.result`](#_resultobject-property) +* [`_.shuffle`](#_shufflearray) +* [`_.size`](#_sizecollection) +* [`_.some`](#_somecollection-callback--thisarg) +* [`_.sortBy`](#_sortbycollection-callback--thisarg) +* [`_.sortedIndex`](#_sortedindexarray-value--callback) +* [`_.tap`](#_tapvalue-interceptor) +* [`_.template`](#_templatetext-data-options) +* [`_.throttle`](#_throttlefunc-wait) +* [`_.times`](#_timesn-callback--thisarg) +* [`_.toArray`](#_toarraycollection) +* [`_.union`](#_unionarray1-array2-) +* [`_.uniq`](#_uniqarray--issortedfalse-callback) +* [`_.uniqueId`](#_uniqueidprefix) +* [`_.values`](#_valuescollection) +* [`_.without`](#_withoutarray--value1-value2-) +* [`_.wrap`](#_wrapfunc-wrapper--arg1-arg2-) +* [`_.zip`](#_ziparray1-array2-) + + + + + + +## `_.prototype` +* [`_.prototype.chain`](#_prototypechain) +* [`_.prototype.value`](#_prototypevalue) @@ -97,10 +104,10 @@ ## `_.templateSettings` -* [`_.templateSettings`](#_.templateSettings) -* [`_.templateSettings.escape`](#_.templateSettings.escape) -* [`_.templateSettings.evaluate`](#_.templateSettings.evaluate) -* [`_.templateSettings.interpolate`](#_.templateSettings.interpolate) +* [`_.templateSettings`](#_templatesettings) +* [`_.templateSettings.escape`](#_templatesettingsescape) +* [`_.templateSettings.evaluate`](#_templatesettingsevaluate) +* [`_.templateSettings.interpolate`](#_templatesettingsinterpolate) @@ -117,9 +124,13 @@ -### `_(value)` + + + +### `_(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L158 "View in source") [Ⓣ][1] + The `lodash` function. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to wrap in a `Lodash` instance. @@ -127,30 +138,35 @@ The `lodash` function. #### Returns *(Object)*: Returns a `Lodash` instance. +* * * + -## `_` -### `_(value)` -The `lodash` function. -[▲][1] -### `_.VERSION` +### `_.VERSION` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2762 "View in source") [Ⓣ][1] + *(String)*: The semantic version number. -[▲][1] + +* * * -### `_.after(times, func)` + + + +### `_.after(times, func)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1471 "View in source") [Ⓣ][1] + Creates a new function that is restricted to executing only after it is called a given number of `times`. -[▲][1] #### Arguments 1. `times` *(Number)*: The number of times the function must be called before it is executed. @@ -168,14 +184,20 @@ _.forEach(notes, function(note) { // renderNotes is run once, after all notes have saved. ~~~ +* * * + -### `_.bind(func [, arg1, arg2, ...])` + + + +### `_.bind(func [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1522 "View in source") [Ⓣ][1] + Creates a new function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends additional arguments to those passed to the bound function. Lazy defined methods may be bound by passing the object they are bound to as `func` and the method name as `thisArg`. -[▲][1] #### Arguments 1. `func` *(Function|Object)*: The function to bind or the object the method belongs to. @@ -212,14 +234,20 @@ func(); // => 'hi moe!' ~~~ +* * * + -### `_.bindAll(object [, methodName1, methodName2, ...])` + + + +### `_.bindAll(object [, methodName1, methodName2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1563 "View in source") [Ⓣ][1] + Binds methods on the `object` to the object, overwriting the non-bound method. If no method names are provided, all the function properties of the `object` will be bound. -[▲][1] #### Arguments 1. `object` *(Object)*: The object to bind and assign the bound methods to. @@ -241,32 +269,20 @@ jQuery('#lodash_button').on('click', buttonView.onClick); // => When the button is clicked, `this.label` will have the correct value ~~~ - - - - - -### `_.chain()` -Extracts the value from a wrapped chainable object. -[▲][1] - -#### Returns -*(Mixed)*: Returns the wrapped object. - -#### Example -~~~ js -_([1, 2, 3]).value(); -// => [1, 2, 3] -~~~ +* * * -### `_.chain(value)` + + + +### `_.chain(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2714 "View in source") [Ⓣ][1] + Wraps the value in a `lodash` chainable object. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to wrap. @@ -290,14 +306,20 @@ var youngest = _.chain(stooges) // => 'moe is 40' ~~~ +* * * + -### `_.clone(value)` + + + +### `_.clone(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1848 "View in source") [Ⓣ][1] + Create a shallow clone of the `value`. Any nested objects or arrays will be assigned by reference and not cloned. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to clone. @@ -311,14 +333,20 @@ _.clone({ 'name': 'moe' }); // => { 'name': 'moe' }; ~~~ +* * * + -### `_.compact(array)` + + + +### `_.compact(array)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L916 "View in source") [Ⓣ][1] + Produces a new array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. -[▲][1] #### Arguments 1. `array` *(Array)*: The array to compact. @@ -332,14 +360,20 @@ _.compact([0, 1, false, 2, '', 3]); // => [1, 2, 3] ~~~ +* * * + -### `_.compose([func1, func2, ...])` + + + +### `_.compose([func1, func2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1595 "View in source") [Ⓣ][1] + Creates a new function that is the composition of the passed functions, where each function consumes the return value of the function that follows. In math terms, composing thefunctions `f()`, `g()`, and `h()` produces `f(g(h()))`. -[▲][1] #### Arguments 1. `[func1, func2, ...]` *(Mixed)*: Functions to compose. @@ -356,14 +390,20 @@ welcome('moe'); // => 'hi: moe!' ~~~ +* * * + -### `_.contains(collection, target)` + + + +### `_.contains(collection, target)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L408 "View in source") [Ⓣ][1] + Checks if a given `target` value is present in a `collection` using strict equality for comparisons, i.e. `===`. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -378,14 +418,20 @@ _.contains([1, 2, 3], 3); // => true ~~~ +* * * + -### `_.debounce(func, wait, immediate)` + + + +### `_.debounce(func, wait, immediate)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1627 "View in source") [Ⓣ][1] + Creates a new function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass `true` for `immediate` to cause debounce to invoke `func` on the leading, instead of the trailing, edge of the `wait` timeout. -[▲][1] #### Arguments 1. `func` *(Function)*: The function to debounce. @@ -401,14 +447,20 @@ var lazyLayout = _.debounce(calculateLayout, 300); jQuery(window).on('resize', lazyLayout); ~~~ +* * * + -### `_.defaults(object [, defaults1, defaults2, ..])` + + + +### `_.defaults(object [, defaults1, defaults2, ..])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1872 "View in source") [Ⓣ][1] + Assigns missing properties in `object` with default values from the defaults objects. As soon as a property is set, additional defaults of the same property will be ignored. -[▲][1] #### Arguments 1. `object` *(Object)*: The object to populate. @@ -424,14 +476,20 @@ _.defaults(iceCream, { 'flavor': 'vanilla', 'sprinkles': 'lots' }); // => { 'flavor': 'chocolate', 'sprinkles': 'lots' } ~~~ +* * * + -### `_.defer(func [, arg1, arg2, ...])` + + + +### `_.defer(func [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1692 "View in source") [Ⓣ][1] + Defers executing the `func` function until the current call stack has cleared. Additional arguments are passed to `func` when it is invoked. -[▲][1] #### Arguments 1. `func` *(Function)*: The function to defer. @@ -446,14 +504,20 @@ _.defer(function() { alert('deferred'); }); // Returns from the function before the alert runs. ~~~ +* * * + -### `_.delay(func, wait [, arg1, arg2, ...])` + + + +### `_.delay(func, wait [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1672 "View in source") [Ⓣ][1] + Executes the `func` function after `wait` milliseconds. Additional arguments are passed to `func` when it is invoked. -[▲][1] #### Arguments 1. `func` *(Function)*: The function to delay. @@ -470,14 +534,20 @@ _.delay(log, 1000, 'logged later'); // => 'logged later' (Appears after one second.) ~~~ +* * * + -### `_.difference(array [, array1, array2, ...])` + + + +### `_.difference(array [, array1, array2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L945 "View in source") [Ⓣ][1] + Produces a new array of `array` values not present in the other arrays using strict equality for comparisons, i.e. `===`. -[▲][1] #### Arguments 1. `array` *(Array)*: The array to process. @@ -492,14 +562,20 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); // => [1, 3, 4] ~~~ +* * * + -### `_.escape(string)` + + + +### `_.escape(string)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2431 "View in source") [Ⓣ][1] + Escapes a string for insertion into HTML, replacing `&`, `<`, `"`, `'`, and `/` characters. -[▲][1] #### Arguments 1. `string` *(String)*: The string to escape. @@ -513,14 +589,20 @@ _.escape('Curly, Larry & Moe'); // => "Curly, Larry & Moe" ~~~ +* * * + -### `_.every(collection, callback [, thisArg])` + + + +### `_.every(collection, callback [, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L432 "View in source") [Ⓣ][1] + Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -536,14 +618,20 @@ _.every([true, 1, null, 'yes'], Boolean); => false ~~~ +* * * + -### `_.extend(object [, source1, source2, ..])` + + + +### `_.extend(object [, source1, source2, ..])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1891 "View in source") [Ⓣ][1] + Copies enumerable properties from the source objects to the `destination` object. Subsequent sources will overwrite propery assignments of previous sources. -[▲][1] #### Arguments 1. `object` *(Object)*: The destination object. @@ -558,14 +646,20 @@ _.extend({ 'name': 'moe' }, { 'age': 40 }); // => { 'name': 'moe', 'age': 40 } ~~~ +* * * + -### `_.filter(collection, callback [, thisArg])` + + + +### `_.filter(collection, callback [, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L453 "View in source") [Ⓣ][1] + Examines each value in a `collection`, returning an array of all values the `callback` returns truthy for. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -581,14 +675,20 @@ var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }) // => [2, 4, 6] ~~~ +* * * + -### `_.find(collection, callback [, thisArg])` + + + +### `_.find(collection, callback [, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L475 "View in source") [Ⓣ][1] + Examines each value in a `collection`, returning the first one the `callback` returns truthy for. The function returns as soon as it finds an acceptable value, and does not iterate over the entire `collection`. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -604,14 +704,20 @@ var even = _.find([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); // => 2 ~~~ +* * * + -### `_.first(array [, n, guard])` + + + +### `_.first(array [, n, guard])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L978 "View in source") [Ⓣ][1] + Gets the first value of the `array`. Pass `n` to return the first `n` values of the `array`. -[▲][1] #### Arguments 1. `array` *(Array)*: The array to query. @@ -627,14 +733,20 @@ _.first([5, 4, 3, 2, 1]); // => 5 ~~~ +* * * + -### `_.flatten(array, shallow)` + + + +### `_.flatten(array, shallow)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1000 "View in source") [Ⓣ][1] + Flattens a nested array *(the nesting can be to any depth)*. If `shallow` is truthy, `array` will only be flattened a single level. -[▲][1] #### Arguments 1. `array` *(Array)*: The array to compact. @@ -652,14 +764,20 @@ _.flatten([1, [2], [3, [[4]]]], true); // => [1, 2, 3, [[4]]]; ~~~ +* * * + -### `_.forEach(collection, callback [, thisArg])` + + + +### `_.forEach(collection, callback [, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L501 "View in source") [Ⓣ][1] + Iterates over a `collection`, executing the `callback` for each value in the `collection`. The `callback` is bound to the `thisArg` value, if one is passed. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -678,14 +796,20 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3}, function(num) { alert(num); }); // => alerts each number in turn... ~~~ +* * * + -### `_.functions(object)` + + + +### `_.functions(object)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1908 "View in source") [Ⓣ][1] + Produces a sorted array of the properties, own and inherited, of `object` that have function values. -[▲][1] #### Arguments 1. `object` *(Object)*: The object to inspect. @@ -699,14 +823,20 @@ _.functions(_); // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...] ~~~ +* * * + -### `_.groupBy(collection, callback [, thisArg])` + + + +### `_.groupBy(collection, callback [, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L525 "View in source") [Ⓣ][1] + Splits a `collection` into sets, grouped by the result of running each value through `callback`. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. The `callback` argument may also be the name of a property to group by. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -725,14 +855,20 @@ _.groupBy(['one', 'two', 'three'], 'length'); // => { '3': ['one', 'two'], '5': ['three'] } ~~~ +* * * + -### `_.has(object, property)` + + + +### `_.has(object, property)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1931 "View in source") [Ⓣ][1] + Checks if the specified object `property` exists and is a direct property, instead of an inherited property. -[▲][1] #### Arguments 1. `object` *(Object)*: The object to check. @@ -747,14 +883,20 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); // => true ~~~ +* * * + -### `_.identity(value)` + + + +### `_.identity(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2455 "View in source") [Ⓣ][1] + This function simply returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback. -[▲][1] #### Arguments 1. `value` *(Mixed)*: Any value. @@ -769,14 +911,20 @@ moe === _.identity(moe); // => true ~~~ +* * * + -### `_.indexOf(array, value [, isSorted=false])` + + + +### `_.indexOf(array, value [, isSorted=false])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1037 "View in source") [Ⓣ][1] + Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster binary search. -[▲][1] #### Arguments 1. `array` *(Array)*: The array to search. @@ -792,14 +940,20 @@ _.indexOf([1, 2, 3], 2); // => 1 ~~~ +* * * + -### `_.initial(array [, n, guard])` + + + +### `_.initial(array [, n, guard])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1071 "View in source") [Ⓣ][1] + Gets all but the last value of the `array`. Pass `n` to exclude the last `n` values from the result. -[▲][1] #### Arguments 1. `array` *(Array)*: The array to query. @@ -815,14 +969,20 @@ _.initial([5, 4, 3, 2, 1]); // => [5, 4, 3, 2] ~~~ +* * * + -### `_.intersection([array1, array2, ...])` + + + +### `_.intersection([array1, array2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1090 "View in source") [Ⓣ][1] + Computes the intersection of all the passed-in arrays. -[▲][1] #### Arguments 1. `[array1, array2, ...]` *(Mixed)*: Arrays to process. @@ -836,14 +996,20 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); // => [1, 2] ~~~ +* * * + -### `_.invoke(array, methodName [, arg1, arg2, ...])` + + + +### `_.invoke(array, methodName [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1123 "View in source") [Ⓣ][1] + Calls the method named by `methodName` for each value of the `collection`. Additional arguments will be passed to each invoked method. -[▲][1] #### Arguments 1. `array` *(Array)*: The array to iterate over. @@ -859,14 +1025,20 @@ _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); // => [[1, 5, 7], [1, 2, 3]] ~~~ +* * * + -### `_.isArguments(value)` + + + +### `_.isArguments(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1951 "View in source") [Ⓣ][1] + Checks if a `value` is an `arguments` object. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -883,14 +1055,20 @@ _.isArguments([1, 2, 3]); // => false ~~~ +* * * + -### `_.isArray(value)` + + + +### `_.isArray(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L192 "View in source") [Ⓣ][1] + Checks if a `value` is an array. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -907,14 +1085,20 @@ _.isArray([1, 2, 3]); // => true ~~~ +* * * + -### `_.isBoolean(value)` + + + +### `_.isBoolean(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1974 "View in source") [Ⓣ][1] + Checks if a `value` is a boolean *(`true` or `false`)* value. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -928,14 +1112,20 @@ _.isBoolean(null); // => false ~~~ +* * * + -### `_.isDate(value)` + + + +### `_.isDate(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1991 "View in source") [Ⓣ][1] + Checks if a `value` is a date. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -949,14 +1139,20 @@ _.isDate(new Date); // => true ~~~ +* * * + -### `_.isElement(value)` + + + +### `_.isElement(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2008 "View in source") [Ⓣ][1] + Checks if a `value` is a DOM element. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -970,14 +1166,20 @@ _.isElement(document.body); // => true ~~~ +* * * + -### `_.isEmpty(value)` + + + +### `_.isEmpty(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L213 "View in source") [Ⓣ][1] + Checks if a `value` is empty. Arrays or strings with a length of `0` and objects with no enumerable own properties are considered "empty". -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -994,14 +1196,20 @@ _.isEmpty({}); // => true ~~~ +* * * + -### `_.isEqual(a, b [, stack])` + + + +### `_.isEqual(a, b [, stack])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2035 "View in source") [Ⓣ][1] + Performs a deep comparison between two values to determine if they are equivalent to each other. -[▲][1] #### Arguments 1. `a` *(Mixed)*: The value to compare. @@ -1023,14 +1231,20 @@ _.isEqual(moe, clone); // => true ~~~ +* * * + -### `_.isFinite(value)` + + + +### `_.isFinite(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2178 "View in source") [Ⓣ][1] + Checks if a `value` is a finite number. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1050,14 +1264,20 @@ _.isFinite(Infinity); // => false ~~~ +* * * + -### `_.isFunction(value)` + + + +### `_.isFunction(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2195 "View in source") [Ⓣ][1] + Checks if a `value` is a function. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1071,14 +1291,20 @@ _.isFunction(''.concat); // => true ~~~ +* * * + -### `_.isNaN(value)` + + + +### `_.isNaN(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2243 "View in source") [Ⓣ][1] + Checks if a `value` is `NaN`. Note: this is not the same as native `isNaN`, which will return true for `undefined` and other values. See http://es5.github.com/#x15.1.2.4. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1101,14 +1327,20 @@ _.isNaN(undefined); // => false ~~~ +* * * + -### `_.isNull(value)` + + + +### `_.isNull(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2265 "View in source") [Ⓣ][1] + Checks if a `value` is `null`. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1125,14 +1357,20 @@ _.isNull(undefined); // => false ~~~ +* * * + -### `_.isNumber(value)` + + + +### `_.isNumber(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2282 "View in source") [Ⓣ][1] + Checks if a `value` is a number. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1146,14 +1384,20 @@ _.isNumber(8.4 * 5; // => true ~~~ +* * * + -### `_.isObject(value)` + + + +### `_.isObject(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2215 "View in source") [Ⓣ][1] + Checks if a `value` is an object. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1170,14 +1414,20 @@ _.isObject(1); // => false ~~~ +* * * + -### `_.isRegExp(value)` + + + +### `_.isRegExp(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2299 "View in source") [Ⓣ][1] + Checks if a `value` is a regular expression. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1191,14 +1441,20 @@ _.isRegExp(/moe/); // => true ~~~ +* * * + -### `_.isString(value)` + + + +### `_.isString(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2316 "View in source") [Ⓣ][1] + Checks if a `value` is a string. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1212,14 +1468,20 @@ _.isString('moe'); // => true ~~~ +* * * + -### `_.isUndefined(value)` + + + +### `_.isUndefined(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2333 "View in source") [Ⓣ][1] + Checks if a `value` is `undefined`. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1233,14 +1495,20 @@ _.isUndefined(void 0); // => true ~~~ +* * * + -### `_.keys(object)` + + + +### `_.keys(object)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2350 "View in source") [Ⓣ][1] + Produces an array of the `object`'s enumerable own property names. -[▲][1] #### Arguments 1. `object` *(Object)*: The object to inspect. @@ -1254,14 +1522,20 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); // => ['one', 'two', 'three'] ~~~ +* * * + -### `_.last(array [, n, guard])` + + + +### `_.last(array [, n, guard])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1153 "View in source") [Ⓣ][1] + Gets the last value of the `array`. Pass `n` to return the lasy `n` values of the `array`. -[▲][1] #### Arguments 1. `array` *(Array)*: The array to query. @@ -1277,14 +1551,20 @@ _.last([5, 4, 3, 2, 1]); // => 1 ~~~ +* * * + -### `_.lastIndexOf(array, value)` + + + +### `_.lastIndexOf(array, value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1173 "View in source") [Ⓣ][1] + Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. -[▲][1] #### Arguments 1. `array` *(Array)*: The array to search. @@ -1299,14 +1579,20 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); // => 4 ~~~ +* * * + -### `_.map(collection, callback [, thisArg])` + + + +### `_.map(collection, callback [, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L559 "View in source") [Ⓣ][1] + Produces a new array of values by mapping each value in the `collection` through a transformation `callback`. The `callback` is bound to the `thisArg` value, if one is passed. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -1325,14 +1611,20 @@ _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; }); // => [3, 6, 9] ~~~ +* * * + -### `_.max(collection [, callback, thisArg])` + + + +### `_.max(collection [, callback, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L586 "View in source") [Ⓣ][1] + Retrieves the maximum value of a `collection`. If `callback` is passed, it will be executed for each value in the `collection` to generate the criterion by which the value is ranked. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -1354,14 +1646,20 @@ _.max(stooges, function(stooge) { return stooge.age; }); // => { 'name': 'curly', 'age': 60 }; ~~~ +* * * + -### `_.memoize(func [, resolver])` + + + +### `_.memoize(func [, resolver])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1715 "View in source") [Ⓣ][1] + Creates a new function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. -[▲][1] #### Arguments 1. `func` *(Function)*: The function to have its output memoized. @@ -1377,14 +1675,20 @@ var fibonacci = _.memoize(function(n) { }); ~~~ +* * * + -### `_.min(collection [, callback, thisArg])` + + + +### `_.min(collection [, callback, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L607 "View in source") [Ⓣ][1] + Retrieves the minimum value of a `collection`. If `callback` is passed, it will be executed for each value in the `collection` to generate the criterion by which the value is ranked. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -1400,14 +1704,20 @@ _.min([10, 5, 100, 2, 1000]); // => 2 ~~~ +* * * + -### `_.mixin(object)` + + + +### `_.mixin(object)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2481 "View in source") [Ⓣ][1] + Adds functions properties of `object` to the `lodash` function and chainable wrapper. -[▲][1] #### Arguments 1. `object` *(Object)*: The object of function properties to add to `lodash`. @@ -1427,14 +1737,20 @@ _('larry').capitalize(); // => 'Larry' ~~~ +* * * + -### `_.noConflict()` + + + +### `_.noConflict()` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2507 "View in source") [Ⓣ][1] + Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. -[▲][1] #### Returns *(Function)*: Returns the `lodash` function. @@ -1444,14 +1760,20 @@ Reverts the '_' variable to its previous value and returns a reference to the `l var lodash = _.noConflict(); ~~~ +* * * + -### `_.once(func)` + + + +### `_.once(func)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1741 "View in source") [Ⓣ][1] + Creates a new function that is restricted to one execution. Repeat calls to the function will return the value of the first call. -[▲][1] #### Arguments 1. `func` *(Function)*: The function to restrict. @@ -1467,14 +1789,20 @@ initialize(); // Application is only created once. ~~~ +* * * + -### `_.pick(object [, prop1, prop2, ..])` + + + +### `_.pick(object [, prop1, prop2, ..])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2372 "View in source") [Ⓣ][1] + Creates an object composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. -[▲][1] #### Arguments 1. `object` *(Object)*: The object to pluck. @@ -1489,14 +1817,20 @@ _.pick({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'name', 'age'); // => { 'name': 'moe', 'age': 40 } ~~~ +* * * + -### `_.pluck(collection, property)` + + + +### `_.pluck(collection, property)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L632 "View in source") [Ⓣ][1] + Retrieves the value of a specified property from all values in a `collection`. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -1517,14 +1851,20 @@ _.pluck(stooges, 'name'); // => ['moe', 'larry', 'curly'] ~~~ +* * * + -### `_.range([start=0], end [, step=1])` + + + +### `_.range([start=0], end [, step=1])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1215 "View in source") [Ⓣ][1] + Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `stop`. This method is a port of Python's `range()` function. See http://docs.python.org/library/functions.html#range. -[▲][1] #### Arguments 1. `[start=0]` *(Number)*: The start of the range. @@ -1552,14 +1892,20 @@ _.range(0); // => [] ~~~ +* * * + -### `_.reduce(collection, callback [, accumulator, thisArg])` + + + +### `_.reduce(collection, callback [, accumulator, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L662 "View in source") [Ⓣ][1] + Boils down a `collection` to a single value. The initial state of the reduction is `accumulator` and each successive step of it should be returned by the `callback`. The `callback` is bound to the `thisArg` value, if one is passed. The `callback` is invoked with `4` arguments; for arrays they are *(accumulator, value, index, array)* and for objects they are *(accumulator, value, key, object)*. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -1576,14 +1922,20 @@ var sum = _.reduce([1, 2, 3], function(memo, num) { return memo + num; }); // => 6 ~~~ +* * * + -### `_.reduceRight(collection, callback [, accumulator, thisArg])` + + + +### `_.reduceRight(collection, callback [, accumulator, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L702 "View in source") [Ⓣ][1] + The right-associative version of `_.reduce`. The `callback` is bound to the `thisArg` value, if one is passed. The `callback` is invoked with `4` arguments; for arrays they are *(accumulator, value, index, array)* and for objects they are *(accumulator, value, key, object)*. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -1601,14 +1953,20 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); // => [4, 5, 2, 3, 0, 1] ~~~ +* * * + -### `_.reject(collection, callback [, thisArg])` + + + +### `_.reject(collection, callback [, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L755 "View in source") [Ⓣ][1] + The opposite of `_.filter`, this method returns the values of a `collection` that `callback` does **not** return truthy for. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -1624,14 +1982,20 @@ var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); // => [1, 3, 5] ~~~ +* * * + -### `_.rest(array [, n, guard])` + + + +### `_.rest(array [, n, guard])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1251 "View in source") [Ⓣ][1] + The opposite of `_.initial`, this method gets all but the first value of the `array`. Pass `n` to exclude the first `n` values from the result. -[▲][1] #### Arguments 1. `array` *(Array)*: The array to query. @@ -1647,14 +2011,20 @@ _.rest([5, 4, 3, 2, 1]); // => [4, 3, 2, 1] ~~~ +* * * + -### `_.result(object, property)` + + + +### `_.result(object, property)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2537 "View in source") [Ⓣ][1] + Resolves the value of `property` on `object`. If the property is a function it will be invoked and its result returned, else the property value is returned. -[▲][1] #### Arguments 1. `object` *(Object)*: The object to inspect. @@ -1679,14 +2049,20 @@ _.result(object, 'stuff'); // => 'nonsense' ~~~ +* * * + -### `_.shuffle(array)` + + + +### `_.shuffle(array)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1269 "View in source") [Ⓣ][1] + Produces a new array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. -[▲][1] #### Arguments 1. `array` *(Array)*: The array to shuffle. @@ -1700,14 +2076,20 @@ _.shuffle([1, 2, 3, 4, 5, 6]); // => [4, 1, 6, 3, 5, 2] ~~~ +* * * + -### `_.size(collection)` + + + +### `_.size(collection)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L772 "View in source") [Ⓣ][1] + Gets the number of values in the `collection`. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection inspect. @@ -1721,14 +2103,20 @@ _.size({ 'one': 1, 'two': 2, 'three': 3 }); // => 3 ~~~ +* * * + -### `_.some(collection, callback [, thisArg])` + + + +### `_.some(collection, callback [, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L845 "View in source") [Ⓣ][1] + Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -1744,14 +2132,20 @@ _.some([null, 0, 'yes', false]); // => true ~~~ +* * * + -### `_.sortBy(collection, callback [, thisArg])` + + + +### `_.sortBy(collection, callback [, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L799 "View in source") [Ⓣ][1] + Produces a new sorted array, ranked in ascending order by the results of running each value of a `collection` through `callback`. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. The `callback` argument may also be the name of a property to sort by *(e.g. 'length')*. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -1767,14 +2161,20 @@ _.sortBy([1, 2, 3, 4, 5, 6], function(num) { return Math.sin(num); }); // => [5, 4, 6, 3, 1, 2] ~~~ +* * * + -### `_.sortedIndex(array, value [, callback])` + + + +### `_.sortedIndex(array, value [, callback])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1303 "View in source") [Ⓣ][1] + Uses a binary search to determine the smallest index at which the `value` should be inserted into the `collection` in order to maintain the sort order of the `collection`. If `callback` is passed, it will be executed for each value in the `collection` to compute their sort ranking. The `callback` is invoked with `1` argument; *(value)*. -[▲][1] #### Arguments 1. `array` *(Array)*: The array to iterate over. @@ -1790,14 +2190,20 @@ _.sortedIndex([10, 20, 30, 40, 50], 35); // => 3 ~~~ +* * * + -### `_.tap(value, interceptor)` + + + +### `_.tap(value, interceptor)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2410 "View in source") [Ⓣ][1] + Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The primary purpose of this method is to "tap into" a method chain, in order to performoperations on intermediate results within the chain. -[▲][1] #### Arguments 1. `value` *(Mixed)*: The value to pass to `callback`. @@ -1817,14 +2223,20 @@ _.chain([1,2,3,200]) // => [4, 40000] ~~~ +* * * + -### `_.template(text, data, options)` + + + +### `_.template(text, data, options)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2597 "View in source") [Ⓣ][1] + A JavaScript micro-templating method, similar to John Resig's implementation. Lo-Dash templating handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. -[▲][1] #### Arguments 1. `text` *(String)*: The template text. @@ -1874,14 +2286,20 @@ _.template('<%= data.hasWith %>', { 'hasWith': 'no' }, { 'variable': 'data' }); ~~~ +* * * + -### `_.throttle(func, wait)` + + + +### `_.throttle(func, wait)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1772 "View in source") [Ⓣ][1] + Creates a new function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. If the throttled function is invoked more than once, `func` will also be called on the trailing edge of the `wait` timeout. -[▲][1] #### Arguments 1. `func` *(Function)*: The function to throttle. @@ -1896,14 +2314,20 @@ var throttled = _.throttle(updatePosition, 100); jQuery(window).on('scroll', throttled); ~~~ +* * * + -### `_.times(n, callback [, thisArg])` + + + +### `_.times(n, callback [, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2661 "View in source") [Ⓣ][1] + Executes the `callback` function `n` times. The `callback` is invoked with `1` argument; *(index)*. -[▲][1] #### Arguments 1. `n` *(Number)*: The number of times to execute the callback. @@ -1915,14 +2339,20 @@ Executes the `callback` function `n` times. The `callback` is invoked with `1` a _.times(3, function() { genie.grantWish(); }); ~~~ +* * * + -### `_.toArray(collection)` + + + +### `_.toArray(collection)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L864 "View in source") [Ⓣ][1] + Converts the `collection`, into an array. Useful for converting the `arguments` object. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to convert. @@ -1936,14 +2366,20 @@ Converts the `collection`, into an array. Useful for converting the `arguments` // => [2, 3, 4] ~~~ +* * * + -### `_.union([array1, array2, ...])` + + + +### `_.union([array1, array2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1336 "View in source") [Ⓣ][1] + Computes the union of the passed-in arrays. -[▲][1] #### Arguments 1. `[array1, array2, ...]` *(Mixed)*: Arrays to process. @@ -1957,14 +2393,20 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); // => [1, 2, 3, 101, 10] ~~~ +* * * + -### `_.uniq(array [, isSorted=false, callback])` + + + +### `_.uniq(array [, isSorted=false, callback])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1371 "View in source") [Ⓣ][1] + Produces a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each value of `array` is passed through a transformation `callback` before uniqueness is computed. The `callback` is invoked with `3` arguments; *(value, index, array)*. -[▲][1] #### Arguments 1. `array` *(Array)*: The array to process. @@ -1980,14 +2422,20 @@ _.uniq([1, 2, 1, 3, 1, 4]); // => [1, 2, 3, 4] ~~~ +* * * + -### `_.uniqueId([prefix])` + + + +### `_.uniqueId([prefix])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2684 "View in source") [Ⓣ][1] + Generates a unique id. If `prefix` is passed, the id will be appended to it. -[▲][1] #### Arguments 1. `[prefix]` *(String)*: The value to prefix the id with. @@ -2001,32 +2449,20 @@ _.uniqueId('contact_'); // => 'contact_104' ~~~ - - - - - -### `_.value()` -Extracts the value from a wrapped chainable object. -[▲][1] - -#### Returns -*(Mixed)*: Returns the wrapped object. - -#### Example -~~~ js -_([1, 2, 3]).value(); -// => [1, 2, 3] -~~~ +* * * -### `_.values(collection)` + + + +### `_.values(collection)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L892 "View in source") [Ⓣ][1] + Produces an array of enumerable own property values of the `collection`. -[▲][1] #### Arguments 1. `collection` *(Array|Object)*: The collection to inspect. @@ -2040,14 +2476,20 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); // => [1, 2, 3] ~~~ +* * * + -### `_.without(array [, value1, value2, ...])` + + + +### `_.without(array [, value1, value2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1409 "View in source") [Ⓣ][1] + Produces a new array with all occurrences of the values removed using strict equality for comparisons, i.e. `===`. -[▲][1] #### Arguments 1. `array` *(Array)*: The array to filter. @@ -2062,14 +2504,20 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); // => [2, 3, 4] ~~~ +* * * + -### `_.wrap(func, wrapper [, arg1, arg2, ...])` + + + +### `_.wrap(func, wrapper [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1824 "View in source") [Ⓣ][1] + Create a new function that passes the `func` function to the `wrapper` function as its first argument. Additional arguments are appended to those passed to the `wrapper` function. -[▲][1] #### Arguments 1. `func` *(Function)*: The function to wrap. @@ -2089,14 +2537,20 @@ hello(); // => 'before, hello: moe, after' ~~~ +* * * + -### `_.zip([array1, array2, ...])` + + + +### `_.zip([array1, array2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1439 "View in source") [Ⓣ][1] + Merges together the values of each of the arrays with the value at the corresponding position. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. -[▲][1] #### Arguments 1. `[array1, array2, ...]` *(Mixed)*: Arrays to process. @@ -2110,6 +2564,63 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); // => [['moe', 30, true], ['larry', 40, false], ['curly', 50, false]] ~~~ +* * * + + + + + + + + + +## `_.prototype` + + + + + + +### `_.prototype.chain()` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2730 "View in source") [Ⓣ][1] + +Extracts the value from a wrapped chainable object. + +#### Returns +*(Mixed)*: Returns the wrapped object. + +#### Example +~~~ js +_([1, 2, 3]).value(); +// => [1, 2, 3] +~~~ + +* * * + + + + + + + + + +### `_.prototype.value()` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2747 "View in source") [Ⓣ][1] + +Extracts the value from a wrapped chainable object. + +#### Returns +*(Mixed)*: Returns the wrapped object. + +#### Example +~~~ js +_([1, 2, 3]).value(); +// => [1, 2, 3] +~~~ + +* * * + @@ -2122,36 +2633,60 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); -### `_.templateSettings` + + + +### `_.templateSettings` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2772 "View in source") [Ⓣ][1] + *(Object)*: By default, Lo-Dash uses ERB-style template delimiters, change the following template settings to use alternative delimiters. -[▲][1] + +* * * -### `_.templateSettings.escape` + + + +### `_.templateSettings.escape` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2781 "View in source") [Ⓣ][1] + *(RegExp)*: Used to detect `data` property values to be HTML-escaped. -[▲][1] + +* * * -### `_.templateSettings.evaluate` + + + +### `_.templateSettings.evaluate` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2790 "View in source") [Ⓣ][1] + *(RegExp)*: Used to detect code to be evaluated. -[▲][1] + +* * * -### `_.templateSettings.interpolate` + + + +### `_.templateSettings.interpolate` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2799 "View in source") [Ⓣ][1] + *(RegExp)*: Used to detect `data` property values to inject. -[▲][1] + +* * * diff --git a/lodash.js b/lodash.js index 53dfa930f..4356fabfc 100644 --- a/lodash.js +++ b/lodash.js @@ -151,6 +151,7 @@ * The `lodash` function. * * @name _ + * @constructor * @param {Mixed} value The value to wrap in a `Lodash` instance. * @returns {Object} Returns a `Lodash` instance. */ @@ -2631,7 +2632,7 @@ text + 'return __p\n}'; - result = Function('_,__e,__j', 'return ' + text)(lodash, escape, join); + result = Function('_, __e, __j', 'return ' + text)(lodash, escape, join); if (data) { return result(data); diff --git a/vendor/benchmark.js b/vendor/benchmark.js index a01115d82..b42a10ae0 160000 --- a/vendor/benchmark.js +++ b/vendor/benchmark.js @@ -1 +1 @@ -Subproject commit a01115d822306f811dc46e6cdd8953b83719cae9 +Subproject commit b42a10ae0d3f22a243e106c190b268f7bf98e5ca diff --git a/vendor/docdown b/vendor/docdown index 3a65504fc..1b6b9173c 160000 --- a/vendor/docdown +++ b/vendor/docdown @@ -1 +1 @@ -Subproject commit 3a65504fc6f6477f72baf91b3b50933f525f4f81 +Subproject commit 1b6b9173c378e57bb26a0753aa9c1aa585fb6f56