lodash
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -9,2 +9,3 @@ module.exports = { | ||
'dropWhile': require('./array/dropWhile'), | ||
'fill': require('./array/fill'), | ||
'findIndex': require('./array/findIndex'), | ||
@@ -11,0 +12,0 @@ 'findLastIndex': require('./array/findLastIndex'), |
@@ -19,3 +19,3 @@ var baseSlice = require('../internal/baseSlice'), | ||
* @param {Array} array The array to process. | ||
* @param {numer} [size=1] The length of each chunk. | ||
* @param {number} [size=1] The length of each chunk. | ||
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`. | ||
@@ -22,0 +22,0 @@ * @returns {Array} Returns the new array containing chunks. |
@@ -9,3 +9,2 @@ var baseSlice = require('../internal/baseSlice'), | ||
* @memberOf _ | ||
* @type Function | ||
* @category Array | ||
@@ -12,0 +11,0 @@ * @param {Array} array The array to query. |
@@ -9,3 +9,2 @@ var baseSlice = require('../internal/baseSlice'), | ||
* @memberOf _ | ||
* @type Function | ||
* @category Array | ||
@@ -12,0 +11,0 @@ * @param {Array} array The array to query. |
@@ -12,4 +12,8 @@ var baseCallback = require('../internal/baseCallback'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* callback returns `true` for elements that have the properties of the given | ||
* callback returns `true` for elements that match the properties of the given | ||
* object, else `false`. | ||
@@ -19,3 +23,2 @@ * | ||
* @memberOf _ | ||
* @type Function | ||
* @category Array | ||
@@ -33,14 +36,18 @@ * @param {Array} array The array to query. | ||
* var users = [ | ||
* { 'user': 'barney', 'status': 'busy', 'active': false }, | ||
* { 'user': 'fred', 'status': 'busy', 'active': true }, | ||
* { 'user': 'pebbles', 'status': 'away', 'active': true } | ||
* { 'user': 'barney', 'age': 36, 'active': true }, | ||
* { 'user': 'fred', 'age': 40, 'active': false }, | ||
* { 'user': 'pebbles', 'age': 1, 'active': false } | ||
* ]; | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.pluck(_.dropRightWhile(users, { 'age': 1, 'active': false }), 'user'); | ||
* // => ['barney', 'fred'] | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* _.pluck(_.dropRightWhile(users, 'active', false), 'user'); | ||
* // => ['barney'] | ||
* | ||
* // using the "_.property" callback shorthand | ||
* _.pluck(_.dropRightWhile(users, 'active'), 'user'); | ||
* // => ['barney'] | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.pluck(_.dropRightWhile(users, { 'status': 'away' }), 'user'); | ||
* // => ['barney', 'fred'] | ||
* // => ['barney', 'fred', 'pebbles'] | ||
*/ | ||
@@ -47,0 +54,0 @@ function dropRightWhile(array, predicate, thisArg) { |
@@ -12,2 +12,6 @@ var baseCallback = require('../internal/baseCallback'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -19,3 +23,2 @@ * callback returns `true` for elements that have the properties of the given | ||
* @memberOf _ | ||
* @type Function | ||
* @category Array | ||
@@ -33,14 +36,18 @@ * @param {Array} array The array to query. | ||
* var users = [ | ||
* { 'user': 'barney', 'status': 'busy', 'active': true }, | ||
* { 'user': 'fred', 'status': 'busy', 'active': false }, | ||
* { 'user': 'pebbles', 'status': 'away', 'active': true } | ||
* { 'user': 'barney', 'age': 36, 'active': false }, | ||
* { 'user': 'fred', 'age': 40, 'active': false }, | ||
* { 'user': 'pebbles', 'age': 1, 'active': true } | ||
* ]; | ||
* | ||
* // using the "_.property" callback shorthand | ||
* _.pluck(_.dropWhile(users, 'active'), 'user'); | ||
* // using the "_.matches" callback shorthand | ||
* _.pluck(_.dropWhile(users, { 'age': 36, 'active': false }), 'user'); | ||
* // => ['fred', 'pebbles'] | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.pluck(_.dropWhile(users, { 'status': 'busy' }), 'user'); | ||
* // using the "_.matchesProperty" callback shorthand | ||
* _.pluck(_.dropWhile(users, 'active', false), 'user'); | ||
* // => ['pebbles'] | ||
* | ||
* // using the "_.property" callback shorthand | ||
* _.pluck(_.dropWhile(users, 'active'), 'user'); | ||
* // => ['barney', 'fred', 'pebbles'] | ||
*/ | ||
@@ -47,0 +54,0 @@ function dropWhile(array, predicate, thisArg) { |
@@ -10,2 +10,6 @@ var baseCallback = require('../internal/baseCallback'); | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -36,3 +40,7 @@ * callback returns `true` for elements that have the properties of the given | ||
* // using the "_.matches" callback shorthand | ||
* _.findIndex(users, { 'age': 1 }); | ||
* _.findIndex(users, { 'age': 40, 'active': true }); | ||
* // => 1 | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* _.findIndex(users, 'age', 1); | ||
* // => 2 | ||
@@ -39,0 +47,0 @@ * |
@@ -10,2 +10,6 @@ var baseCallback = require('../internal/baseCallback'); | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -36,3 +40,7 @@ * callback returns `true` for elements that have the properties of the given | ||
* // using the "_.matches" callback shorthand | ||
* _.findLastIndex(users, { 'age': 40 }); | ||
* _.findLastIndex(users, { 'age': 36, 'active': true }); | ||
* // => 0 | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* _.findLastIndex(users, 'age', 40); | ||
* // => 1 | ||
@@ -39,0 +47,0 @@ * |
@@ -17,2 +17,6 @@ var baseCallback = require('../internal/baseCallback'); | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -19,0 +23,0 @@ * callback returns `true` for elements that have the properties of the given |
@@ -15,2 +15,6 @@ var baseCallback = require('../internal/baseCallback'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -17,0 +21,0 @@ * callback returns `true` for elements that have the properties of the given |
@@ -9,3 +9,2 @@ var baseSlice = require('../internal/baseSlice'), | ||
* @memberOf _ | ||
* @type Function | ||
* @category Array | ||
@@ -12,0 +11,0 @@ * @param {Array} array The array to query. |
@@ -9,3 +9,2 @@ var baseSlice = require('../internal/baseSlice'), | ||
* @memberOf _ | ||
* @type Function | ||
* @category Array | ||
@@ -12,0 +11,0 @@ * @param {Array} array The array to query. |
@@ -12,2 +12,6 @@ var baseCallback = require('../internal/baseCallback'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -19,3 +23,2 @@ * callback returns `true` for elements that have the properties of the given | ||
* @memberOf _ | ||
* @type Function | ||
* @category Array | ||
@@ -33,14 +36,18 @@ * @param {Array} array The array to query. | ||
* var users = [ | ||
* { 'user': 'barney', 'status': 'busy', 'active': false }, | ||
* { 'user': 'fred', 'status': 'busy', 'active': true }, | ||
* { 'user': 'pebbles', 'status': 'away', 'active': true } | ||
* { 'user': 'barney', 'age': 36, 'active': true }, | ||
* { 'user': 'fred', 'age': 40, 'active': false }, | ||
* { 'user': 'pebbles', 'age': 1, 'active': false } | ||
* ]; | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.pluck(_.takeRightWhile(users, { 'age': 1, 'active': true }), 'user'); | ||
* // => ['pebbles'] | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* _.pluck(_.takeRightWhile(users, 'active', false), 'user'); | ||
* // => ['fred', 'pebbles'] | ||
* | ||
* // using the "_.property" callback shorthand | ||
* _.pluck(_.takeRightWhile(users, 'active'), 'user'); | ||
* // => ['fred', 'pebbles'] | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.pluck(_.takeRightWhile(users, { 'status': 'away' }), 'user'); | ||
* // => ['pebbles'] | ||
* // => [] | ||
*/ | ||
@@ -47,0 +54,0 @@ function takeRightWhile(array, predicate, thisArg) { |
@@ -12,2 +12,6 @@ var baseCallback = require('../internal/baseCallback'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -19,3 +23,2 @@ * callback returns `true` for elements that have the properties of the given | ||
* @memberOf _ | ||
* @type Function | ||
* @category Array | ||
@@ -33,14 +36,18 @@ * @param {Array} array The array to query. | ||
* var users = [ | ||
* { 'user': 'barney', 'status': 'busy', 'active': true }, | ||
* { 'user': 'fred', 'status': 'busy', 'active': false }, | ||
* { 'user': 'pebbles', 'status': 'away', 'active': true } | ||
* { 'user': 'barney', 'age': 36, 'active': false }, | ||
* { 'user': 'fred', 'age': 40, 'active': false }, | ||
* { 'user': 'pebbles', 'age': 1, 'active': true } | ||
* ]; | ||
* | ||
* // using the "_.property" callback shorthand | ||
* _.pluck(_.takeWhile(users, 'active'), 'user'); | ||
* // using the "_.matches" callback shorthand | ||
* _.pluck(_.takeWhile(users, { 'age': 36, 'active': true }), 'user'); | ||
* // => ['barney'] | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.pluck(_.takeWhile(users, { 'status': 'busy' }), 'user'); | ||
* // using the "_.matchesProperty" callback shorthand | ||
* _.pluck(_.takeWhile(users, 'active', false), 'user'); | ||
* // => ['barney', 'fred'] | ||
* | ||
* // using the "_.property" callback shorthand | ||
* _.pluck(_.takeWhile(users, 'active'), 'user'); | ||
* // => [] | ||
*/ | ||
@@ -47,0 +54,0 @@ function takeWhile(array, predicate, thisArg) { |
@@ -17,2 +17,6 @@ var baseCallback = require('../internal/baseCallback'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -19,0 +23,0 @@ * callback returns `true` for elements that have the properties of the given |
module.exports = { | ||
'chain': require('./chain/chain'), | ||
'commit': require('./chain/commit'), | ||
'lodash': require('./chain/lodash'), | ||
'plant': require('./chain/plant'), | ||
'reverse': require('./chain/reverse'), | ||
'run': require('./chain/run'), | ||
'tap': require('./chain/tap'), | ||
@@ -6,0 +9,0 @@ 'thru': require('./chain/thru'), |
@@ -11,3 +11,3 @@ var lodash = require('./lodash'); | ||
* @param {*} value The value to wrap. | ||
* @returns {Object} Returns the new `lodash` object. | ||
* @returns {Object} Returns the new `lodash` wrapper instance. | ||
* @example | ||
@@ -14,0 +14,0 @@ * |
@@ -1,5 +0,6 @@ | ||
var LodashWrapper = require('../internal/LodashWrapper'), | ||
arrayCopy = require('../internal/arrayCopy'), | ||
var LazyWrapper = require('../internal/LazyWrapper'), | ||
LodashWrapper = require('../internal/LodashWrapper'), | ||
isArray = require('../lang/isArray'), | ||
isObjectLike = require('../internal/isObjectLike'); | ||
isObjectLike = require('../internal/isObjectLike'), | ||
wrapperClone = require('../internal/wrapperClone'); | ||
@@ -13,3 +14,3 @@ /** Used for native method references. */ | ||
/** | ||
* Creates a `lodash` object which wraps `value` to enable intuitive chaining. | ||
* Creates a `lodash` object which wraps `value` to enable implicit chaining. | ||
* Methods that operate on and return arrays, collections, and functions can | ||
@@ -33,25 +34,27 @@ * be chained together. Methods that return a boolean or single value will | ||
* | ||
* The wrapper functions that support shortcut fusion are: | ||
* `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, `first`, | ||
* `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`, `slice`, | ||
* `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `where` | ||
* The wrapper methods that support shortcut fusion are: | ||
* `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, | ||
* `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`, | ||
* `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`, | ||
* and `where` | ||
* | ||
* The chainable wrapper functions are: | ||
* The chainable wrapper methods are: | ||
* `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`, | ||
* `callback`, `chain`, `chunk`, `compact`, `concat`, `constant`, `countBy`, | ||
* `create`, `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`, | ||
* `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, `flatten`, | ||
* `flattenDeep`, `flow`, `flowRight`, `forEach`, `forEachRight`, `forIn`, | ||
* `forInRight`, `forOwn`, `forOwnRight`, `functions`, `groupBy`, `indexBy`, | ||
* `initial`, `intersection`, `invert`, `invoke`, `keys`, `keysIn`, `map`, | ||
* `mapValues`, `matches`, `memoize`, `merge`, `mixin`, `negate`, `noop`, | ||
* `omit`, `once`, `pairs`, `partial`, `partialRight`, `partition`, `pick`, | ||
* `pluck`, `property`, `propertyOf`, `pull`, `pullAt`, `push`, `range`, | ||
* `rearg`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, | ||
* `sortBy`, `sortByAll`, `splice`, `take`, `takeRight`, `takeRightWhile`, | ||
* `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`, | ||
* `transform`, `union`, `uniq`, `unshift`, `unzip`, `values`, `valuesIn`, | ||
* `where`, `without`, `wrap`, `xor`, `zip`, and `zipObject` | ||
* `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`, | ||
* `countBy`, `create`, `curry`, `debounce`, `defaults`, `defer`, `delay`, | ||
* `difference`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `fill`, | ||
* `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, `forEach`, | ||
* `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`, | ||
* `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, | ||
* `keysIn`, `map`, `mapValues`, `matches`, `memoize`, `merge`, `mixin`, | ||
* `negate`, `noop`, `omit`, `once`, `pairs`, `partial`, `partialRight`, | ||
* `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`, | ||
* `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `reverse`, | ||
* `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, `splice`, `spread`, | ||
* `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`, | ||
* `thru`, `times`, `toArray`, `toPlainObject`, `transform`, `union`, `uniq`, | ||
* `unshift`, `unzip`, `values`, `valuesIn`, `where`, `without`, `wrap`, `xor`, | ||
* `zip`, and `zipObject` | ||
* | ||
* The wrapper functions that are **not** chainable by default are: | ||
* The wrapper methods that are **not** chainable by default are: | ||
* `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `deburr`, | ||
@@ -71,3 +74,3 @@ * `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, | ||
* | ||
* The wrapper function `sample` will return a wrapped value when `n` is provided, | ||
* The wrapper method `sample` will return a wrapped value when `n` is provided, | ||
* otherwise an unwrapped value is returned. | ||
@@ -79,3 +82,3 @@ * | ||
* @param {*} value The value to wrap in a `lodash` instance. | ||
* @returns {Object} Returns a `lodash` instance. | ||
* @returns {Object} Returns the new `lodash` wrapper instance. | ||
* @example | ||
@@ -99,8 +102,8 @@ * | ||
function lodash(value) { | ||
if (isObjectLike(value) && !isArray(value)) { | ||
if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { | ||
if (value instanceof LodashWrapper) { | ||
return value; | ||
} | ||
if (hasOwnProperty.call(value, '__wrapped__')) { | ||
return new LodashWrapper(value.__wrapped__, value.__chain__, arrayCopy(value.__actions__)); | ||
if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) { | ||
return wrapperClone(value); | ||
} | ||
@@ -111,5 +114,2 @@ } | ||
// Ensure `new LodashWrapper` is an instance of `lodash`. | ||
LodashWrapper.prototype = lodash.prototype; | ||
module.exports = lodash; |
@@ -9,3 +9,3 @@ var chain = require('./chain'); | ||
* @category Chain | ||
* @returns {*} Returns the `lodash` object. | ||
* @returns {Object} Returns the new `lodash` wrapper instance. | ||
* @example | ||
@@ -12,0 +12,0 @@ * |
@@ -14,3 +14,3 @@ var LazyWrapper = require('../internal/LazyWrapper'), | ||
* @category Chain | ||
* @returns {Object} Returns the new reversed `lodash` object. | ||
* @returns {Object} Returns the new reversed `lodash` wrapper instance. | ||
* @example | ||
@@ -32,3 +32,3 @@ * | ||
} | ||
return new LodashWrapper(value.reverse()); | ||
return new LodashWrapper(value.reverse(), this.__chain__); | ||
} | ||
@@ -35,0 +35,0 @@ return this.thru(function(value) { |
@@ -8,3 +8,3 @@ var baseWrapperValue = require('../internal/baseWrapperValue'); | ||
* @memberOf _ | ||
* @alias toJSON, valueOf | ||
* @alias run, toJSON, valueOf | ||
* @category Chain | ||
@@ -11,0 +11,0 @@ * @returns {*} Returns the resolved unwrapped value. |
@@ -19,2 +19,6 @@ var createAggregator = require('../internal/createAggregator'); | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -21,0 +25,0 @@ * callback returns `true` for elements that have the properties of the given |
@@ -14,2 +14,6 @@ var arrayEvery = require('../internal/arrayEvery'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -36,12 +40,16 @@ * callback returns `true` for elements that have the properties of the given | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 36 }, | ||
* { 'user': 'fred', 'age': 40 } | ||
* { 'user': 'barney', 'age': 36, 'active': false }, | ||
* { 'user': 'fred', 'age': 40, 'active': false } | ||
* ]; | ||
* | ||
* // using the "_.property" callback shorthand | ||
* _.every(users, 'age'); | ||
* // using the "_.matches" callback shorthand | ||
* _.every(users, { 'age': 36, 'active': false }); | ||
* // => false | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* _.every(users, 'active', false); | ||
* // => true | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.every(users, { 'age': 36 }); | ||
* // using the "_.property" callback shorthand | ||
* _.every(users, 'active'); | ||
* // => false | ||
@@ -48,0 +56,0 @@ */ |
@@ -14,2 +14,6 @@ var arrayFilter = require('../internal/arrayFilter'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -35,12 +39,16 @@ * callback returns `true` for elements that have the properties of the given | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 36, 'active': false }, | ||
* { 'user': 'fred', 'age': 40, 'active': true } | ||
* { 'user': 'barney', 'age': 36, 'active': true }, | ||
* { 'user': 'fred', 'age': 40, 'active': false } | ||
* ]; | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user'); | ||
* // => ['barney'] | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* _.pluck(_.filter(users, 'active', false), 'user'); | ||
* // => ['fred'] | ||
* | ||
* // using the "_.property" callback shorthand | ||
* _.pluck(_.filter(users, 'active'), 'user'); | ||
* // => ['fred'] | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.pluck(_.filter(users, { 'age': 36 }), 'user'); | ||
* // => ['barney'] | ||
@@ -47,0 +55,0 @@ */ |
@@ -15,2 +15,6 @@ var baseCallback = require('../internal/baseCallback'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -33,5 +37,5 @@ * callback returns `true` for elements that have the properties of the given | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 36, 'active': false }, | ||
* { 'user': 'fred', 'age': 40, 'active': true }, | ||
* { 'user': 'pebbles', 'age': 1, 'active': false } | ||
* { 'user': 'barney', 'age': 36, 'active': true }, | ||
* { 'user': 'fred', 'age': 40, 'active': false }, | ||
* { 'user': 'pebbles', 'age': 1, 'active': true } | ||
* ]; | ||
@@ -43,8 +47,12 @@ * | ||
* // using the "_.matches" callback shorthand | ||
* _.result(_.find(users, { 'age': 1 }), 'user'); | ||
* _.result(_.find(users, { 'age': 1, 'active': true }), 'user'); | ||
* // => 'pebbles' | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* _.result(_.find(users, 'active', false), 'user'); | ||
* // => 'fred' | ||
* | ||
* // using the "_.property" callback shorthand | ||
* _.result(_.find(users, 'active'), 'user'); | ||
* // => 'fred' | ||
* // => 'barney' | ||
*/ | ||
@@ -51,0 +59,0 @@ function find(collection, predicate, thisArg) { |
@@ -9,2 +9,7 @@ var baseMatches = require('../internal/baseMatches'), | ||
* | ||
* **Note:** This method supports comparing arrays, booleans, `Date` objects, | ||
* numbers, `Object` objects, regexes, and strings. Objects are compared by | ||
* their own, not inherited, enumerable properties. For comparing a single | ||
* own or inherited property value see `_.matchesProperty`. | ||
* | ||
* @static | ||
@@ -19,10 +24,10 @@ * @memberOf _ | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 36, 'status': 'busy' }, | ||
* { 'user': 'fred', 'age': 40, 'status': 'busy' } | ||
* { 'user': 'barney', 'age': 36, 'active': true }, | ||
* { 'user': 'fred', 'age': 40, 'active': false } | ||
* ]; | ||
* | ||
* _.result(_.findWhere(users, { 'status': 'busy' }), 'user'); | ||
* _.result(_.findWhere(users, { 'age': 36, 'active': true }), 'user'); | ||
* // => 'barney' | ||
* | ||
* _.result(_.findWhere(users, { 'age': 40 }), 'user'); | ||
* _.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user'); | ||
* // => 'fred' | ||
@@ -29,0 +34,0 @@ */ |
@@ -19,2 +19,6 @@ var createAggregator = require('../internal/createAggregator'); | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -21,0 +25,0 @@ * callback returns `true` for elements that have the properties of the given |
@@ -13,2 +13,6 @@ var createAggregator = require('../internal/createAggregator'); | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -15,0 +19,0 @@ * callback returns `true` for elements that have the properties of the given |
@@ -14,2 +14,6 @@ var arrayMap = require('../internal/arrayMap'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -19,2 +23,11 @@ * callback returns `true` for elements that have the properties of the given | ||
* | ||
* Many lodash methods are guarded to work as interatees for methods like | ||
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. | ||
* | ||
* The guarded methods are: | ||
* `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, `drop`, | ||
* `dropRight`, `fill`, `flatten`, `invert`, `max`, `min`, `parseInt`, `slice`, | ||
* `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimLeft`, `trimRight`, | ||
* `trunc`, `random`, `range`, `sample`, `uniq`, and `words` | ||
* | ||
* @static | ||
@@ -21,0 +34,0 @@ * @memberOf _ |
@@ -14,2 +14,6 @@ var arrayMax = require('../internal/arrayMax'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -16,0 +20,0 @@ * callback returns `true` for elements that have the properties of the given |
@@ -14,2 +14,6 @@ var arrayMin = require('../internal/arrayMin'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -16,0 +20,0 @@ * callback returns `true` for elements that have the properties of the given |
@@ -12,2 +12,6 @@ var createAggregator = require('../internal/createAggregator'); | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -40,8 +44,14 @@ * callback returns `true` for elements that have the properties of the given | ||
* | ||
* var mapper = function(array) { return _.pluck(array, 'user'); }; | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.map(_.partition(users, { 'age': 1 }), function(array) { return _.pluck(array, 'user'); }); | ||
* _.map(_.partition(users, { 'age': 1, 'active': false }), mapper); | ||
* // => [['pebbles'], ['barney', 'fred']] | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* _.map(_.partition(users, 'active', false), mapper); | ||
* // => [['barney', 'pebbles'], ['fred']] | ||
* | ||
* // using the "_.property" callback shorthand | ||
* _.map(_.partition(users, 'active'), function(array) { return _.pluck(array, 'user'); }); | ||
* _.map(_.partition(users, 'active'), mapper); | ||
* // => [['fred'], ['barney', 'pebbles']] | ||
@@ -48,0 +58,0 @@ */ |
@@ -28,5 +28,5 @@ var baseProperty = require('../internal/baseProperty'), | ||
function pluck(collection, key) { | ||
return map(collection, baseProperty(key + '')); | ||
return map(collection, baseProperty(key)); | ||
} | ||
module.exports = pluck; |
@@ -15,2 +15,8 @@ var arrayReduce = require('../internal/arrayReduce'), | ||
* | ||
* Many lodash methods are guarded to work as interatees for methods like | ||
* `_.reduce`, `_.reduceRight`, and `_.transform`. | ||
* | ||
* The guarded methods are: | ||
* `assign`, `defaults`, `merge`, and `sortAllBy` | ||
* | ||
* @static | ||
@@ -17,0 +23,0 @@ * @memberOf _ |
@@ -13,2 +13,6 @@ var arrayFilter = require('../internal/arrayFilter'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -37,9 +41,13 @@ * callback returns `true` for elements that have the properties of the given | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user'); | ||
* // => ['barney'] | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* _.pluck(_.reject(users, 'active', false), 'user'); | ||
* // => ['fred'] | ||
* | ||
* // using the "_.property" callback shorthand | ||
* _.pluck(_.reject(users, 'active'), 'user'); | ||
* // => ['barney'] | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.pluck(_.reject(users, { 'age': 36 }), 'user'); | ||
* // => ['fred'] | ||
*/ | ||
@@ -46,0 +54,0 @@ function reject(collection, predicate, thisArg) { |
@@ -15,2 +15,6 @@ var arraySome = require('../internal/arraySome'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -41,9 +45,13 @@ * callback returns `true` for elements that have the properties of the given | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.some(users, { 'age': 1, 'active': true }); | ||
* // => false | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* _.some(users, 'active', false); | ||
* // => true | ||
* | ||
* // using the "_.property" callback shorthand | ||
* _.some(users, 'active'); | ||
* // => true | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.some(users, { 'age': 1 }); | ||
* // => false | ||
*/ | ||
@@ -50,0 +58,0 @@ function some(collection, predicate, thisArg) { |
@@ -18,2 +18,6 @@ var baseCallback = require('../internal/baseCallback'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -20,0 +24,0 @@ * callback returns `true` for elements that have the properties of the given |
@@ -41,3 +41,3 @@ var baseEach = require('../internal/baseEach'), | ||
baseEach(collection, function(value, key, collection) { | ||
baseEach(collection, function(value) { | ||
var length = props.length, | ||
@@ -44,0 +44,0 @@ criteria = Array(length); |
@@ -9,2 +9,7 @@ var baseMatches = require('../internal/baseMatches'), | ||
* | ||
* **Note:** This method supports comparing arrays, booleans, `Date` objects, | ||
* numbers, `Object` objects, regexes, and strings. Objects are compared by | ||
* their own, not inherited, enumerable properties. For comparing a single | ||
* own or inherited property value see `_.matchesProperty`. | ||
* | ||
* @static | ||
@@ -19,7 +24,7 @@ * @memberOf _ | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 36, 'status': 'busy', 'pets': ['hoppy'] }, | ||
* { 'user': 'fred', 'age': 40, 'status': 'busy', 'pets': ['baby puss', 'dino'] } | ||
* { 'user': 'barney', 'age': 36, 'active': false, 'pets': ['hoppy'] }, | ||
* { 'user': 'fred', 'age': 40, 'active': true, 'pets': ['baby puss', 'dino'] } | ||
* ]; | ||
* | ||
* _.pluck(_.where(users, { 'age': 36 }), 'user'); | ||
* _.pluck(_.where(users, { 'age': 36, 'active': false }), 'user'); | ||
* // => ['barney'] | ||
@@ -29,5 +34,2 @@ * | ||
* // => ['fred'] | ||
* | ||
* _.pluck(_.where(users, { 'status': 'busy' }), 'user'); | ||
* // => ['barney', 'fred'] | ||
*/ | ||
@@ -34,0 +36,0 @@ function where(collection, source) { |
@@ -23,4 +23,5 @@ module.exports = { | ||
'rearg': require('./function/rearg'), | ||
'spread': require('./function/spread'), | ||
'throttle': require('./function/throttle'), | ||
'wrap': require('./function/wrap') | ||
}; |
@@ -1,3 +0,1 @@ | ||
var isFunction = require('../lang/isFunction'); | ||
/** Used as the `TypeError` message for "Functions" methods. */ | ||
@@ -33,4 +31,4 @@ var FUNC_ERROR_TEXT = 'Expected a function'; | ||
function after(n, func) { | ||
if (!isFunction(func)) { | ||
if (isFunction(n)) { | ||
if (typeof func != 'function') { | ||
if (typeof n == 'function') { | ||
var temp = n; | ||
@@ -37,0 +35,0 @@ n = func; |
@@ -1,3 +0,1 @@ | ||
var isFunction = require('../lang/isFunction'); | ||
/** Used as the `TypeError` message for "Functions" methods. */ | ||
@@ -24,4 +22,4 @@ var FUNC_ERROR_TEXT = 'Expected a function'; | ||
var result; | ||
if (!isFunction(func)) { | ||
if (isFunction(n)) { | ||
if (typeof func != 'function') { | ||
if (typeof n == 'function') { | ||
var temp = n; | ||
@@ -28,0 +26,0 @@ n = func; |
@@ -1,3 +0,2 @@ | ||
var isFunction = require('../lang/isFunction'), | ||
isObject = require('../lang/isObject'), | ||
var isObject = require('../lang/isObject'), | ||
now = require('../date/now'); | ||
@@ -85,3 +84,3 @@ | ||
if (!isFunction(func)) { | ||
if (typeof func != 'function') { | ||
throw new TypeError(FUNC_ERROR_TEXT); | ||
@@ -88,0 +87,0 @@ } |
@@ -36,3 +36,3 @@ var arrayEvery = require('../internal/arrayEvery'), | ||
if (!length) { | ||
return function() {}; | ||
return function() { return arguments[0]; }; | ||
} | ||
@@ -39,0 +39,0 @@ if (!arrayEvery(funcs, isFunction)) { |
@@ -36,3 +36,3 @@ var arrayEvery = require('../internal/arrayEvery'), | ||
if (fromIndex < 0) { | ||
return function() {}; | ||
return function() { return arguments[0]; }; | ||
} | ||
@@ -39,0 +39,0 @@ if (!arrayEvery(funcs, isFunction)) { |
@@ -1,3 +0,2 @@ | ||
var MapCache = require('../internal/MapCache'), | ||
isFunction = require('../lang/isFunction'); | ||
var MapCache = require('../internal/MapCache'); | ||
@@ -61,3 +60,3 @@ /** Used as the `TypeError` message for "Functions" methods. */ | ||
function memoize(func, resolver) { | ||
if (!isFunction(func) || (resolver && !isFunction(resolver))) { | ||
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) { | ||
throw new TypeError(FUNC_ERROR_TEXT); | ||
@@ -64,0 +63,0 @@ } |
@@ -1,3 +0,1 @@ | ||
var isFunction = require('../lang/isFunction'); | ||
/** Used as the `TypeError` message for "Functions" methods. */ | ||
@@ -26,3 +24,3 @@ var FUNC_ERROR_TEXT = 'Expected a function'; | ||
function negate(predicate) { | ||
if (!isFunction(predicate)) { | ||
if (typeof predicate != 'function') { | ||
throw new TypeError(FUNC_ERROR_TEXT); | ||
@@ -29,0 +27,0 @@ } |
@@ -10,3 +10,2 @@ var before = require('./before'); | ||
* @memberOf _ | ||
* @type Function | ||
* @category Function | ||
@@ -13,0 +12,0 @@ * @param {Function} func The function to restrict. |
var debounce = require('./debounce'), | ||
isFunction = require('../lang/isFunction'), | ||
isObject = require('../lang/isObject'); | ||
@@ -57,3 +56,3 @@ | ||
if (!isFunction(func)) { | ||
if (typeof func != 'function') { | ||
throw new TypeError(FUNC_ERROR_TEXT); | ||
@@ -60,0 +59,0 @@ } |
@@ -20,3 +20,3 @@ var baseCopy = require('./baseCopy'), | ||
var index = -1, | ||
length = props.length | ||
length = props.length; | ||
@@ -23,0 +23,0 @@ while (++index < length) { |
var baseMatches = require('./baseMatches'), | ||
baseMatchesProperty = require('./baseMatchesProperty'), | ||
baseProperty = require('./baseProperty'), | ||
@@ -27,8 +28,10 @@ bindCallback = require('./bindCallback'), | ||
} | ||
// Handle "_.property" and "_.matches" style callback shorthands. | ||
return type == 'object' | ||
? baseMatches(func) | ||
: baseProperty(func + ''); | ||
if (type == 'object') { | ||
return baseMatches(func); | ||
} | ||
return typeof thisArg == 'undefined' | ||
? baseProperty(func + '') | ||
: baseMatchesProperty(func + '', thisArg); | ||
} | ||
module.exports = baseCallback; |
@@ -1,3 +0,2 @@ | ||
var baseSlice = require('./baseSlice'), | ||
isFunction = require('../lang/isFunction'); | ||
var baseSlice = require('./baseSlice'); | ||
@@ -18,3 +17,3 @@ /** Used as the `TypeError` message for "Functions" methods. */ | ||
function baseDelay(func, wait, args, fromIndex) { | ||
if (!isFunction(func)) { | ||
if (typeof func != 'function') { | ||
throw new TypeError(FUNC_ERROR_TEXT); | ||
@@ -21,0 +20,0 @@ } |
@@ -14,3 +14,3 @@ var baseIsEqual = require('./baseIsEqual'); | ||
* @private | ||
* @param {Object} source The object to inspect. | ||
* @param {Object} object The object to inspect. | ||
* @param {Array} props The source property names to match. | ||
@@ -17,0 +17,0 @@ * @param {Array} values The source values to match. |
@@ -12,4 +12,3 @@ var baseIsMatch = require('./baseIsMatch'), | ||
/** | ||
* The base implementation of `_.matches` which supports specifying whether | ||
* `source` should be cloned. | ||
* The base implementation of `_.matches` which does not clone `source`. | ||
* | ||
@@ -16,0 +15,0 @@ * @private |
@@ -19,3 +19,3 @@ /** | ||
? (initFromCollection = false, value) | ||
: iteratee(accumulator, value, index, collection) | ||
: iteratee(accumulator, value, index, collection); | ||
}); | ||
@@ -22,0 +22,0 @@ return accumulator; |
@@ -8,4 +8,3 @@ var baseCallback = require('./baseCallback'), | ||
* object composed from the results of running each element in the collection | ||
* through an iteratee. The `setter` sets the keys and values of the accumulator | ||
* object. If `initializer` is provided initializes the accumulator object. | ||
* through an iteratee. | ||
* | ||
@@ -12,0 +11,0 @@ * @private |
@@ -6,3 +6,2 @@ var baseSetData = require('./baseSetData'), | ||
getData = require('./getData'), | ||
isFunction = require('../lang/isFunction'), | ||
mergeData = require('./mergeData'), | ||
@@ -50,3 +49,3 @@ setData = require('./setData'); | ||
var isBindKey = bitmask & BIND_KEY_FLAG; | ||
if (!isBindKey && !isFunction(func)) { | ||
if (!isBindKey && typeof func != 'function') { | ||
throw new TypeError(FUNC_ERROR_TEXT); | ||
@@ -81,5 +80,5 @@ } | ||
} else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) { | ||
result = createPartialWrapper.apply(null, newData); | ||
result = createPartialWrapper.apply(undefined, newData); | ||
} else { | ||
result = createHybridWrapper.apply(null, newData); | ||
result = createHybridWrapper.apply(undefined, newData); | ||
} | ||
@@ -86,0 +85,0 @@ var setter = data ? baseSetData : setData; |
@@ -13,14 +13,14 @@ var LazyWrapper = require('./LazyWrapper'), | ||
function lazyClone() { | ||
var actions = this.actions, | ||
iteratees = this.iteratees, | ||
views = this.views, | ||
result = new LazyWrapper(this.wrapped); | ||
var actions = this.__actions__, | ||
iteratees = this.__iteratees__, | ||
views = this.__views__, | ||
result = new LazyWrapper(this.__wrapped__); | ||
result.actions = actions ? arrayCopy(actions) : null; | ||
result.dir = this.dir; | ||
result.dropCount = this.dropCount; | ||
result.filtered = this.filtered; | ||
result.iteratees = iteratees ? arrayCopy(iteratees) : null; | ||
result.takeCount = this.takeCount; | ||
result.views = views ? arrayCopy(views) : null; | ||
result.__actions__ = actions ? arrayCopy(actions) : null; | ||
result.__dir__ = this.__dir__; | ||
result.__dropCount__ = this.__dropCount__; | ||
result.__filtered__ = this.__filtered__; | ||
result.__iteratees__ = iteratees ? arrayCopy(iteratees) : null; | ||
result.__takeCount__ = this.__takeCount__; | ||
result.__views__ = views ? arrayCopy(views) : null; | ||
return result; | ||
@@ -27,0 +27,0 @@ } |
@@ -12,9 +12,9 @@ var LazyWrapper = require('./LazyWrapper'); | ||
function lazyReverse() { | ||
if (this.filtered) { | ||
if (this.__filtered__) { | ||
var result = new LazyWrapper(this); | ||
result.dir = -1; | ||
result.filtered = true; | ||
result.__dir__ = -1; | ||
result.__filtered__ = true; | ||
} else { | ||
result = this.clone(); | ||
result.dir *= -1; | ||
result.__dir__ *= -1; | ||
} | ||
@@ -21,0 +21,0 @@ return result; |
@@ -21,16 +21,16 @@ var baseWrapperValue = require('./baseWrapperValue'), | ||
function lazyValue() { | ||
var array = this.wrapped.value(); | ||
var array = this.__wrapped__.value(); | ||
if (!isArray(array)) { | ||
return baseWrapperValue(array, this.actions); | ||
return baseWrapperValue(array, this.__actions__); | ||
} | ||
var dir = this.dir, | ||
var dir = this.__dir__, | ||
isRight = dir < 0, | ||
view = getView(0, array.length, this.views), | ||
view = getView(0, array.length, this.__views__), | ||
start = view.start, | ||
end = view.end, | ||
length = end - start, | ||
dropCount = this.dropCount, | ||
takeCount = nativeMin(length, this.takeCount - dropCount), | ||
dropCount = this.__dropCount__, | ||
takeCount = nativeMin(length, this.__takeCount__), | ||
index = isRight ? end : start - 1, | ||
iteratees = this.iteratees, | ||
iteratees = this.__iteratees__, | ||
iterLength = iteratees ? iteratees.length : 0, | ||
@@ -37,0 +37,0 @@ resIndex = 0, |
@@ -11,12 +11,12 @@ /** Used as references for `-Infinity` and `Infinity`. */ | ||
function LazyWrapper(value) { | ||
this.actions = null; | ||
this.dir = 1; | ||
this.dropCount = 0; | ||
this.filtered = false; | ||
this.iteratees = null; | ||
this.takeCount = POSITIVE_INFINITY; | ||
this.views = null; | ||
this.wrapped = value; | ||
this.__wrapped__ = value; | ||
this.__actions__ = null; | ||
this.__dir__ = 1; | ||
this.__dropCount__ = 0; | ||
this.__filtered__ = false; | ||
this.__iteratees__ = null; | ||
this.__takeCount__ = POSITIVE_INFINITY; | ||
this.__views__ = null; | ||
} | ||
module.exports = LazyWrapper; |
@@ -10,7 +10,7 @@ /** | ||
function LodashWrapper(value, chainAll, actions) { | ||
this.__wrapped__ = value; | ||
this.__actions__ = actions || []; | ||
this.__chain__ = !!chainAll; | ||
this.__wrapped__ = value; | ||
} | ||
module.exports = LodashWrapper; |
@@ -13,3 +13,4 @@ var baseIsEqual = require('../internal/baseIsEqual'), | ||
* **Note:** This method supports comparing arrays, booleans, `Date` objects, | ||
* numbers, `Object` objects, regexes, and strings. Functions and DOM nodes | ||
* numbers, `Object` objects, regexes, and strings. Objects are compared by | ||
* their own, not inherited, enumerable properties. Functions and DOM nodes | ||
* are **not** supported. Provide a customizer function to extend support | ||
@@ -16,0 +17,0 @@ * for comparing other values. |
@@ -27,3 +27,3 @@ var baseIsMatch = require('../internal/baseIsMatch'), | ||
* @category Lang | ||
* @param {Object} source The object to inspect. | ||
* @param {Object} object The object to inspect. | ||
* @param {Object} source The object of property values to match. | ||
@@ -30,0 +30,0 @@ * @param {Function} [customizer] The function to customize comparing values. |
@@ -12,2 +12,6 @@ var baseCallback = require('../internal/baseCallback'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -38,5 +42,9 @@ * callback returns `true` for elements that have the properties of the given | ||
* // using the "_.matches" callback shorthand | ||
* _.findKey(users, { 'age': 1 }); | ||
* _.findKey(users, { 'age': 1, 'active': true }); | ||
* // => 'pebbles' | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* _.findKey(users, 'active', false); | ||
* // => 'fred' | ||
* | ||
* // using the "_.property" callback shorthand | ||
@@ -43,0 +51,0 @@ * _.findKey(users, 'active'); |
@@ -12,2 +12,6 @@ var baseCallback = require('../internal/baseCallback'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
@@ -38,5 +42,9 @@ * callback returns `true` for elements that have the properties of the given | ||
* // using the "_.matches" callback shorthand | ||
* _.findLastKey(users, { 'age': 36 }); | ||
* _.findLastKey(users, { 'age': 36, 'active': true }); | ||
* // => 'barney' | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* _.findLastKey(users, 'active', false); | ||
* // => 'fred' | ||
* | ||
* // using the "_.property" callback shorthand | ||
@@ -43,0 +51,0 @@ * _.findLastKey(users, 'active'); |
@@ -49,3 +49,3 @@ var isArguments = require('../lang/isArguments'), | ||
index = -1, | ||
isProto = typeof Ctor == 'function' && Ctor.prototype == object, | ||
isProto = typeof Ctor == 'function' && Ctor.prototype === object, | ||
result = Array(length), | ||
@@ -52,0 +52,0 @@ skipIndexes = length > 0; |
@@ -13,2 +13,6 @@ var baseCallback = require('../internal/baseCallback'), | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `iteratee` the created "_.matches" style | ||
@@ -15,0 +19,0 @@ * callback returns `true` for elements that have the properties of the given |
@@ -6,2 +6,3 @@ var arrayEach = require('../internal/arrayEach'), | ||
isArray = require('../lang/isArray'), | ||
isFunction = require('../lang/isFunction'), | ||
isObject = require('../lang/isObject'), | ||
@@ -51,3 +52,3 @@ isTypedArray = require('../lang/isTypedArray'); | ||
} else { | ||
accumulator = baseCreate(typeof Ctor == 'function' && Ctor.prototype); | ||
accumulator = baseCreate(isFunction(Ctor) && Ctor.prototype); | ||
} | ||
@@ -54,0 +55,0 @@ } else { |
{ | ||
"name": "lodash", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "The modern build of lodash modular utilities.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash v3.1.0 | ||
# lodash v3.2.0 | ||
@@ -31,3 +31,3 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) modules. | ||
See the [package source](https://github.com/lodash/lodash/tree/3.1.0-npm) for more details. | ||
See the [package source](https://github.com/lodash/lodash/tree/3.2.0-npm) for more details. | ||
@@ -43,4 +43,4 @@ **Note:**<br> | ||
* npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds | ||
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.1.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.1.0-amd) builds | ||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.1.0-es) build | ||
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.2.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.2.0-amd) builds | ||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.2.0-es) build | ||
@@ -73,4 +73,5 @@ ## Further Reading | ||
* [_.debounce](https://lodash.com/docs#debounce) & [_.throttle](https://lodash.com/docs#throttle) are cancelable & accept options for more control | ||
* [_.fill](https://lodash.com/docs#fill) to fill arrays with values | ||
* [_.findIndex](https://lodash.com/docs#findIndex) & [_.findKey](https://lodash.com/docs#findKey) for finding indexes & keys | ||
* [_.flow](https://lodash.com/docs#flow) to complement [_.flowRight](https://lodash.com/docs#vlowRight) (a.k.a `_.backflow` & `_.compose`) | ||
* [_.flow](https://lodash.com/docs#flow) to complement [_.flowRight](https://lodash.com/docs#flowRight) (a.k.a `_.compose`) | ||
* [_.forEach](https://lodash.com/docs#forEach) supports exiting early | ||
@@ -86,4 +87,7 @@ * [_.forIn](https://lodash.com/docs#forIn) for iterating all enumerable properties | ||
* [_.mapValues](https://lodash.com/docs#mapValues) for [mapping](https://lodash.com/docs#map) values to an object | ||
* [_.matches](https://lodash.com/docs#matches) supports deep object comparisons | ||
* [_.matchesProperty](https://lodash.com/docs#matchesProperty) to complement [_.matches](https://lodash.com/docs#matches) & [_.property](https://lodash.com/docs#property) | ||
* [_.merge](https://lodash.com/docs#merge) for a deep [_.extend](https://lodash.com/docs#extend) | ||
* [_.parseInt](https://lodash.com/docs#parseInt) for consistent cross-environment behavior | ||
* [_.propertyOf](https://lodash.com/docs#propertyOf) to complement [_.property](https://lodash.com/docs#property) | ||
* [_.pull](https://lodash.com/docs#pull), [_.pullAt](https://lodash.com/docs#pullAt), & [_.remove](https://lodash.com/docs#remove) for mutating arrays | ||
@@ -94,7 +98,6 @@ * [_.random](https://lodash.com/docs#random) supports returning floating-point numbers | ||
* [_.sortByAll](https://lodash.com/docs#sortBy) for sorting by multiple properties | ||
* [_.spread](https://lodash.com/docs#spread) for creating a function to spread an array of arguments to another | ||
* [_.support](https://lodash.com/docs#support) for flagging environment features | ||
* [_.template](https://lodash.com/docs#template) supports [*“imports”*](https://lodash.com/docs#templateSettings-imports) options & [ES template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components) | ||
* [_.transform](https://lodash.com/docs#transform) as a powerful alternative to [_.reduce](https://lodash.com/docs#reduce) for transforming objects | ||
* [_.thru](https://lodash.com/docs#thru) to pass values thru method chains | ||
* [_.where](https://lodash.com/docs#where) supports deep object comparisons | ||
* [_.xor](https://lodash.com/docs#xor) to complement [_.difference](https://lodash.com/docs#difference), [_.intersection](https://lodash.com/docs#intersection), & [_.union](https://lodash.com/docs#union) | ||
@@ -113,7 +116,9 @@ * [_.bind](https://lodash.com/docs#bind), [_.curry](https://lodash.com/docs#curry), [_.partial](https://lodash.com/docs#partial), & | ||
[more](https://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.findLast, _.forEach, _.forEachRight, _.groupBy, _.indexBy, _.invoke, _.map, _.max, _.min, _.partition, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.size, _.some, _.sortBy") accept strings | ||
* [_#commit](https://lodash.com/docs#prototype-commit) & [_#plant](https://lodash.com/docs#prototype-plant) for working with chain sequences | ||
* [_#thru](https://lodash.com/docs#thru) to pass values thru a chain sequence | ||
## Support | ||
Tested in Chrome 39-40, Firefox 34-35, IE 6-11, Opera 26-27, Safari 5-8, io.js 1.0.4, Node.js 0.8.28 & 0.10.35, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7RC5. | ||
Tested in Chrome 39-40, Firefox 34-35, IE 6-11, Opera 26-27, Safari 5-8, io.js 1.2.0, Node.js 0.8.28, 0.10.36, & 0.12.0, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7RC5. | ||
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing. |
@@ -31,3 +31,3 @@ var baseToString = require('../internal/baseToString'), | ||
if (guard ? isIterateeCall(value, chars, guard) : chars == null) { | ||
return string.slice(trimmedLeftIndex(string)) | ||
return string.slice(trimmedLeftIndex(string)); | ||
} | ||
@@ -34,0 +34,0 @@ return string.slice(charsLeftIndex(string, (chars + ''))); |
@@ -31,3 +31,3 @@ var baseToString = require('../internal/baseToString'), | ||
if (guard ? isIterateeCall(value, chars, guard) : chars == null) { | ||
return string.slice(0, trimmedRightIndex(string) + 1) | ||
return string.slice(0, trimmedRightIndex(string) + 1); | ||
} | ||
@@ -34,0 +34,0 @@ return string.slice(0, charsRightIndex(string, (chars + '')) + 1); |
@@ -8,2 +8,3 @@ module.exports = { | ||
'matches': require('./utility/matches'), | ||
'matchesProperty': require('./utility/matchesProperty'), | ||
'mixin': require('./utility/mixin'), | ||
@@ -10,0 +11,0 @@ 'noop': require('./utility/noop'), |
@@ -1,6 +0,7 @@ | ||
var isError = require('../lang/isError'); | ||
var baseSlice = require('../internal/baseSlice'), | ||
isError = require('../lang/isError'); | ||
/** | ||
* Attempts to invoke `func`, returning either the result or the caught | ||
* error object. | ||
* Attempts to invoke `func`, returning either the result or the caught error | ||
* object. Any additional arguments are provided to `func` when it is invoked. | ||
* | ||
@@ -15,5 +16,5 @@ * @static | ||
* // avoid throwing errors for invalid selectors | ||
* var elements = _.attempt(function() { | ||
* var elements = _.attempt(function(selector) { | ||
* return document.querySelectorAll(selector); | ||
* }); | ||
* }, '>_>'); | ||
* | ||
@@ -26,5 +27,5 @@ * if (_.isError(elements)) { | ||
try { | ||
return func(); | ||
return func.apply(undefined, baseSlice(arguments, 1)); | ||
} catch(e) { | ||
return isError(e) ? e : Error(e); | ||
return isError(e) ? e : new Error(e); | ||
} | ||
@@ -31,0 +32,0 @@ } |
@@ -7,6 +7,7 @@ var baseCallback = require('../internal/baseCallback'), | ||
/** | ||
* Creates a function bound to an optional `thisArg`. If `func` is a property | ||
* name the created callback returns the property value for a given element. | ||
* If `func` is an object the created callback returns `true` for elements | ||
* that contain the equivalent object properties, otherwise it returns `false`. | ||
* Creates a function that invokes `func` with the `this` binding of `thisArg` | ||
* and arguments of the created function. If `func` is a property name the | ||
* created callback returns the property value for a given element. If `func` | ||
* is an object the created callback returns `true` for elements that contain | ||
* the equivalent object properties, otherwise it returns `false`. | ||
* | ||
@@ -13,0 +14,0 @@ * @static |
@@ -9,2 +9,7 @@ var baseClone = require('../internal/baseClone'), | ||
* | ||
* **Note:** This method supports comparing arrays, booleans, `Date` objects, | ||
* numbers, `Object` objects, regexes, and strings. Objects are compared by | ||
* their own, not inherited, enumerable properties. For comparing a single | ||
* own or inherited property value see `_.matchesProperty`. | ||
* | ||
* @static | ||
@@ -18,13 +23,8 @@ * @memberOf _ | ||
* var users = [ | ||
* { 'user': 'fred', 'age': 40 }, | ||
* { 'user': 'barney', 'age': 36 } | ||
* { 'user': 'barney', 'age': 36, 'active': true }, | ||
* { 'user': 'fred', 'age': 40, 'active': false } | ||
* ]; | ||
* | ||
* var matchesAge = _.matches({ 'age': 36 }); | ||
* | ||
* _.filter(users, matchesAge); | ||
* // => [{ 'user': 'barney', 'age': 36 }] | ||
* | ||
* _.find(users, matchesAge); | ||
* // => { 'user': 'barney', 'age': 36 } | ||
* _.filter(users, _.matches({ 'age': 40, 'active': false })); | ||
* // => [{ 'user': 'fred', 'age': 40, 'active': false }] | ||
*/ | ||
@@ -31,0 +31,0 @@ function matches(source) { |
@@ -35,2 +35,5 @@ var arrayCopy = require('../internal/arrayCopy'), | ||
* | ||
* // use `_.runInContext` to avoid potential conflicts (esp. in Node.js) | ||
* var _ = require('lodash').runInContext(); | ||
* | ||
* _.mixin({ 'vowels': vowels }); | ||
@@ -37,0 +40,0 @@ * _.vowels('fred'); |
Sorry, the diff of this file is too big to display
782503
358
22131
119