diff --git a/README.md b/README.md index 85d5edf6d..ae22f683b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash v3.0.1 +# lodash v3.1.0 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. @@ -28,7 +28,7 @@ var array = require('lodash/array'); var chunk = require('lodash/array/chunk'); ``` -See the [package source](https://github.com/lodash/lodash/tree/3.0.1-npm) for more details. +See the [package source](https://github.com/lodash/lodash/tree/3.1.0-npm) for more details. **Note:**
Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.
@@ -39,8 +39,8 @@ Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes lodash b lodash is also available in a variety of other builds & module formats. * 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.0.1-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.0.1-amd) builds - * ES modules for the [modern](https://github.com/lodash/lodash/tree/3.0.1-es) build + * 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 ## Further Reading @@ -97,7 +97,7 @@ lodash is also available in a variety of other builds & module formats. * [_.bind](https://lodash.com/docs#bind), [_.curry](https://lodash.com/docs#curry), [_.partial](https://lodash.com/docs#partial), & [more](https://lodash.com/docs "_.bindKey, _.curryRight, _.partialRight") support customizable argument placeholders * [_.capitalize](https://lodash.com/docs#capitalize), [_.trim](https://lodash.com/docs#trim), & - [more](https://lodash.com/docs "_.camelCase, _.deburr, _.endsWith, _.escapeRegExp, _.kebabCase, _.pad, _.padLeft, _.padRight, _.repeat, _.snakeCase, _.startsWith, _.trimLeft, _.trimRight, _.trunc, _.words") string methods + [more](https://lodash.com/docs "_.camelCase, _.deburr, _.endsWith, _.escapeRegExp, _.kebabCase, _.pad, _.padLeft, _.padRight, _.repeat, _.snakeCase, _.startCase, _.startsWith, _.trimLeft, _.trimRight, _.trunc, _.words") string methods * [_.clone](https://lodash.com/docs#clone), [_.isEqual](https://lodash.com/docs#isEqual), & [more](https://lodash.com/docs "_.assign, _.cloneDeep, _.merge") accept callbacks * [_.dropWhile](https://lodash.com/docs#dropWhile), [_.takeWhile](https://lodash.com/docs#takeWhile), & @@ -109,6 +109,6 @@ lodash is also available in a variety of other builds & module formats. ## Support -Tested in Chrome 39-40, Firefox 34-35, IE 6-11, Opera 25-26, 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.0.4, Node.js 0.8.28 & 0.10.35, 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. diff --git a/chain/lodash.js b/chain/lodash.js index 4f2eb07c6..62e07f580 100644 --- a/chain/lodash.js +++ b/chain/lodash.js @@ -57,14 +57,14 @@ var hasOwnProperty = objectProto.hasOwnProperty; * `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `has`, * `identity`, `includes`, `indexOf`, `isArguments`, `isArray`, `isBoolean`, * `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite`, - * `isFunction`, `isMatch` , `isNative`, `isNaN`, `isNull`, `isNumber`, + * `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`, * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, * `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `max`, `min`, * `noConflict`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, * `random`, `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`, * `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, - * `startsWith`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, - * `unescape`, `uniqueId`, `value`, and `words` + * `startCase`, `startsWith`, `template`, `trim`, `trimLeft`, `trimRight`, + * `trunc`, `unescape`, `uniqueId`, `value`, and `words` * * The wrapper function `sample` will return a wrapped value when `n` is provided, * otherwise an unwrapped value is returned. diff --git a/collection/findWhere.js b/collection/findWhere.js index b6f427d1f..a51ba5ae7 100644 --- a/collection/findWhere.js +++ b/collection/findWhere.js @@ -1,5 +1,5 @@ -var find = require('./find'), - matches = require('../utility/matches'); +var baseMatches = require('../internal/baseMatches'), + find = require('./find'); /** * Performs a deep comparison between each element in `collection` and the @@ -26,7 +26,7 @@ var find = require('./find'), * // => 'fred' */ function findWhere(collection, source) { - return find(collection, matches(source)); + return find(collection, baseMatches(source)); } module.exports = findWhere; diff --git a/collection/pluck.js b/collection/pluck.js index 4bfd0159e..bb64092f1 100644 --- a/collection/pluck.js +++ b/collection/pluck.js @@ -1,5 +1,5 @@ -var map = require('./map'), - property = require('../utility/property'); +var baseProperty = require('../internal/baseProperty'), + map = require('./map'); /** * Gets the value of `key` from all elements in `collection`. @@ -25,7 +25,7 @@ var map = require('./map'), * // => [36, 40] (iteration order is not guaranteed) */ function pluck(collection, key) { - return map(collection, property(key)); + return map(collection, baseProperty(key + '')); } module.exports = pluck; diff --git a/collection/where.js b/collection/where.js index 9bf813a38..a00fc220f 100644 --- a/collection/where.js +++ b/collection/where.js @@ -1,5 +1,5 @@ -var filter = require('./filter'), - matches = require('../utility/matches'); +var baseMatches = require('../internal/baseMatches'), + filter = require('./filter'); /** * Performs a deep comparison between each element in `collection` and the @@ -29,7 +29,7 @@ var filter = require('./filter'), * // => ['barney', 'fred'] */ function where(collection, source) { - return filter(collection, matches(source)); + return filter(collection, baseMatches(source)); } module.exports = where; diff --git a/index.js b/index.js index 02c735279..020c5575b 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ /** * @license - * lodash 3.0.1 (Custom Build) + * lodash 3.1.0 (Custom Build) * Build: `lodash modern -d -o ./index.js` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.7.0 @@ -13,7 +13,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '3.0.1'; + var VERSION = '3.1.0'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, @@ -769,7 +769,7 @@ /** * Used as the maximum length of an array-like value. - * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) + * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) * for more details. */ var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; @@ -827,14 +827,14 @@ * `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `has`, * `identity`, `includes`, `indexOf`, `isArguments`, `isArray`, `isBoolean`, * `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite`, - * `isFunction`, `isMatch` , `isNative`, `isNaN`, `isNull`, `isNumber`, + * `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`, * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, * `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `max`, `min`, * `noConflict`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, * `random`, `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`, * `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, - * `startsWith`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, - * `unescape`, `uniqueId`, `value`, and `words` + * `startCase`, `startsWith`, `template`, `trim`, `trimLeft`, `trimRight`, + * `trunc`, `unescape`, `uniqueId`, `value`, and `words` * * The wrapper function `sample` will return a wrapped value when `n` is provided, * otherwise an unwrapped value is returned. @@ -1647,7 +1647,7 @@ } // Handle "_.property" and "_.matches" style callback shorthands. return type == 'object' - ? baseMatches(func, !argCount) + ? baseMatches(func) : baseProperty(func + ''); } @@ -2268,10 +2268,9 @@ * * @private * @param {Object} source The object of property values to match. - * @param {boolean} [isCloned] Specify cloning the source object. * @returns {Function} Returns the new function. */ - function baseMatches(source, isCloned) { + function baseMatches(source) { var props = keys(source), length = props.length; @@ -2285,9 +2284,6 @@ }; } } - if (isCloned) { - source = baseClone(source, true); - } var values = Array(length), strictCompareFlags = Array(length); @@ -3598,7 +3594,7 @@ var length = object.length, prereq = isLength(length) && isIndex(index, length); } else { - prereq = type == 'string' && index in value; + prereq = type == 'string' && index in object; } return prereq && object[index] === value; } @@ -3606,6 +3602,10 @@ /** * Checks if `value` is a valid array-like length. * + * **Note:** This function is based on ES `ToLength`. See the + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) + * for more details. + * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. @@ -5676,7 +5676,7 @@ * // => 'fred' */ function findWhere(collection, source) { - return find(collection, matches(source)); + return find(collection, baseMatches(source)); } /** @@ -6053,7 +6053,7 @@ * // => [36, 40] (iteration order is not guaranteed) */ function pluck(collection, key) { - return map(collection, property(key)); + return map(collection, baseProperty(key + '')); } /** @@ -6424,7 +6424,7 @@ * // => ['barney', 'fred'] */ function where(collection, source) { - return filter(collection, matches(source)); + return filter(collection, baseMatches(source)); } /*------------------------------------------------------------------------*/ @@ -9069,7 +9069,7 @@ */ var camelCase = createCompounder(function(result, word, index) { word = word.toLowerCase(); - return index ? (result + word.charAt(0).toUpperCase() + word.slice(1)) : word; + return result + (index ? (word.charAt(0).toUpperCase() + word.slice(1)) : word); }); /** @@ -9420,16 +9420,41 @@ * _.snakeCase('Foo Bar'); * // => 'foo_bar' * - * _.snakeCase('--foo-bar'); + * _.snakeCase('fooBar'); * // => 'foo_bar' * - * _.snakeCase('fooBar'); + * _.snakeCase('--foo-bar'); * // => 'foo_bar' */ var snakeCase = createCompounder(function(result, word, index) { return result + (index ? '_' : '') + word.toLowerCase(); }); + /** + * Converts `string` to start case. + * See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage) + * for more details. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the start cased string. + * @example + * + * _.startCase('--foo-bar'); + * // => 'Foo Bar' + * + * _.startCase('fooBar'); + * // => 'Foo Bar' + * + * _.startCase('__foo_bar__'); + * // => 'Foo Bar' + */ + var startCase = createCompounder(function(result, word, index) { + return result + (index ? ' ' : '') + (word.charAt(0).toUpperCase() + word.slice(1)); + }); + /** * Checks if `string` starts with the given target string. * @@ -9689,7 +9714,7 @@ if (guard ? isIterateeCall(value, chars, guard) : chars == null) { return string.slice(trimmedLeftIndex(string), trimmedRightIndex(string) + 1); } - chars = baseToString(chars); + chars = (chars + ''); return string.slice(charsLeftIndex(string, chars), charsRightIndex(string, chars) + 1); } @@ -9720,7 +9745,7 @@ if (guard ? isIterateeCall(value, chars, guard) : chars == null) { return string.slice(trimmedLeftIndex(string)) } - return string.slice(charsLeftIndex(string, baseToString(chars))); + return string.slice(charsLeftIndex(string, (chars + ''))); } /** @@ -9750,7 +9775,7 @@ if (guard ? isIterateeCall(value, chars, guard) : chars == null) { return string.slice(0, trimmedRightIndex(string) + 1) } - return string.slice(0, charsRightIndex(string, baseToString(chars)) + 1); + return string.slice(0, charsRightIndex(string, (chars + '')) + 1); } /** @@ -9957,7 +9982,9 @@ if (guard && isIterateeCall(func, thisArg, guard)) { thisArg = null; } - return baseCallback(func, thisArg); + return isObjectLike(func) + ? matches(func) + : baseCallback(func, thisArg); } /** @@ -10025,7 +10052,7 @@ * // => { 'user': 'barney', 'age': 36 } */ function matches(source) { - return baseMatches(source, true); + return baseMatches(baseClone(source, true)); } /** @@ -10522,6 +10549,7 @@ lodash.some = some; lodash.sortedIndex = sortedIndex; lodash.sortedLastIndex = sortedLastIndex; + lodash.startCase = startCase; lodash.startsWith = startsWith; lodash.template = template; lodash.trim = trim; @@ -10647,10 +10675,10 @@ // Add `LazyWrapper` methods for `_.pluck` and `_.where`. arrayEach(['pluck', 'where'], function(methodName, index) { var operationName = index ? 'filter' : 'map', - createCallback = index ? matches : property; + createCallback = index ? baseMatches : baseProperty; LazyWrapper.prototype[methodName] = function(value) { - return this[operationName](createCallback(value)); + return this[operationName](createCallback(index ? value : (value + ''))); }; }); diff --git a/internal/baseCallback.js b/internal/baseCallback.js index 8868828d6..8543fc9a3 100644 --- a/internal/baseCallback.js +++ b/internal/baseCallback.js @@ -26,7 +26,7 @@ function baseCallback(func, thisArg, argCount) { } // Handle "_.property" and "_.matches" style callback shorthands. return type == 'object' - ? baseMatches(func, !argCount) + ? baseMatches(func) : baseProperty(func + ''); } diff --git a/internal/baseMatches.js b/internal/baseMatches.js index 6462ccc53..b36c995a7 100644 --- a/internal/baseMatches.js +++ b/internal/baseMatches.js @@ -1,5 +1,4 @@ -var baseClone = require('./baseClone'), - baseIsMatch = require('./baseIsMatch'), +var baseIsMatch = require('./baseIsMatch'), isStrictComparable = require('./isStrictComparable'), keys = require('../object/keys'); @@ -15,10 +14,9 @@ var hasOwnProperty = objectProto.hasOwnProperty; * * @private * @param {Object} source The object of property values to match. - * @param {boolean} [isCloned] Specify cloning the source object. * @returns {Function} Returns the new function. */ -function baseMatches(source, isCloned) { +function baseMatches(source) { var props = keys(source), length = props.length; @@ -32,9 +30,6 @@ function baseMatches(source, isCloned) { }; } } - if (isCloned) { - source = baseClone(source, true); - } var values = Array(length), strictCompareFlags = Array(length); diff --git a/internal/isIndex.js b/internal/isIndex.js index 4d47d9a68..89bd88dcd 100644 --- a/internal/isIndex.js +++ b/internal/isIndex.js @@ -1,6 +1,6 @@ /** * Used as the maximum length of an array-like value. - * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) + * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) * for more details. */ var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; diff --git a/internal/isIterateeCall.js b/internal/isIterateeCall.js index 2f2797441..53d327e58 100644 --- a/internal/isIterateeCall.js +++ b/internal/isIterateeCall.js @@ -20,7 +20,7 @@ function isIterateeCall(value, index, object) { var length = object.length, prereq = isLength(length) && isIndex(index, length); } else { - prereq = type == 'string' && index in value; + prereq = type == 'string' && index in object; } return prereq && object[index] === value; } diff --git a/internal/isLength.js b/internal/isLength.js index 2ad8cf53e..8e1bf44e9 100644 --- a/internal/isLength.js +++ b/internal/isLength.js @@ -1,6 +1,6 @@ /** * Used as the maximum length of an array-like value. - * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) + * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) * for more details. */ var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; @@ -8,6 +8,10 @@ var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; /** * Checks if `value` is a valid array-like length. * + * **Note:** This function is based on ES `ToLength`. See the + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) + * for more details. + * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. diff --git a/package.json b/package.json index 831969a03..2bb8a945a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lodash", - "version": "3.0.1", + "version": "3.1.0", "description": "The modern build of lodash modular utilities.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/string.js b/string.js index 1e24a40b7..f77794530 100644 --- a/string.js +++ b/string.js @@ -12,6 +12,7 @@ module.exports = { 'parseInt': require('./string/parseInt'), 'repeat': require('./string/repeat'), 'snakeCase': require('./string/snakeCase'), + 'startCase': require('./string/startCase'), 'startsWith': require('./string/startsWith'), 'template': require('./string/template'), 'templateSettings': require('./string/templateSettings'), diff --git a/string/camelCase.js b/string/camelCase.js index 4fbf03f18..7f9979bc4 100644 --- a/string/camelCase.js +++ b/string/camelCase.js @@ -22,7 +22,7 @@ var createCompounder = require('../internal/createCompounder'); */ var camelCase = createCompounder(function(result, word, index) { word = word.toLowerCase(); - return index ? (result + word.charAt(0).toUpperCase() + word.slice(1)) : word; + return result + (index ? (word.charAt(0).toUpperCase() + word.slice(1)) : word); }); module.exports = camelCase; diff --git a/string/snakeCase.js b/string/snakeCase.js index cc475027b..f83a299cc 100644 --- a/string/snakeCase.js +++ b/string/snakeCase.js @@ -14,10 +14,10 @@ var createCompounder = require('../internal/createCompounder'); * _.snakeCase('Foo Bar'); * // => 'foo_bar' * - * _.snakeCase('--foo-bar'); + * _.snakeCase('fooBar'); * // => 'foo_bar' * - * _.snakeCase('fooBar'); + * _.snakeCase('--foo-bar'); * // => 'foo_bar' */ var snakeCase = createCompounder(function(result, word, index) { diff --git a/string/startCase.js b/string/startCase.js new file mode 100644 index 000000000..8bdfa44e4 --- /dev/null +++ b/string/startCase.js @@ -0,0 +1,28 @@ +var createCompounder = require('../internal/createCompounder'); + +/** + * Converts `string` to start case. + * See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage) + * for more details. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the start cased string. + * @example + * + * _.startCase('--foo-bar'); + * // => 'Foo Bar' + * + * _.startCase('fooBar'); + * // => 'Foo Bar' + * + * _.startCase('__foo_bar__'); + * // => 'Foo Bar' + */ +var startCase = createCompounder(function(result, word, index) { + return result + (index ? ' ' : '') + (word.charAt(0).toUpperCase() + word.slice(1)); +}); + +module.exports = startCase; diff --git a/string/trim.js b/string/trim.js index 51db0ae66..6feaf66cf 100644 --- a/string/trim.js +++ b/string/trim.js @@ -35,7 +35,7 @@ function trim(string, chars, guard) { if (guard ? isIterateeCall(value, chars, guard) : chars == null) { return string.slice(trimmedLeftIndex(string), trimmedRightIndex(string) + 1); } - chars = baseToString(chars); + chars = (chars + ''); return string.slice(charsLeftIndex(string, chars), charsRightIndex(string, chars) + 1); } diff --git a/string/trimLeft.js b/string/trimLeft.js index f7523d733..9ce7651ea 100644 --- a/string/trimLeft.js +++ b/string/trimLeft.js @@ -30,7 +30,7 @@ function trimLeft(string, chars, guard) { if (guard ? isIterateeCall(value, chars, guard) : chars == null) { return string.slice(trimmedLeftIndex(string)) } - return string.slice(charsLeftIndex(string, baseToString(chars))); + return string.slice(charsLeftIndex(string, (chars + ''))); } module.exports = trimLeft; diff --git a/string/trimRight.js b/string/trimRight.js index a5fc8575f..cc93346ab 100644 --- a/string/trimRight.js +++ b/string/trimRight.js @@ -30,7 +30,7 @@ function trimRight(string, chars, guard) { if (guard ? isIterateeCall(value, chars, guard) : chars == null) { return string.slice(0, trimmedRightIndex(string) + 1) } - return string.slice(0, charsRightIndex(string, baseToString(chars)) + 1); + return string.slice(0, charsRightIndex(string, (chars + '')) + 1); } module.exports = trimRight; diff --git a/utility/callback.js b/utility/callback.js index 98cf47eb1..e7b804708 100644 --- a/utility/callback.js +++ b/utility/callback.js @@ -1,5 +1,7 @@ var baseCallback = require('../internal/baseCallback'), - isIterateeCall = require('../internal/isIterateeCall'); + isIterateeCall = require('../internal/isIterateeCall'), + isObjectLike = require('../internal/isObjectLike'), + matches = require('./matches'); /** * Creates a function bound to an optional `thisArg`. If `func` is a property @@ -40,7 +42,9 @@ function callback(func, thisArg, guard) { if (guard && isIterateeCall(func, thisArg, guard)) { thisArg = null; } - return baseCallback(func, thisArg); + return isObjectLike(func) + ? matches(func) + : baseCallback(func, thisArg); } module.exports = callback; diff --git a/utility/matches.js b/utility/matches.js index 2d74e5efe..78cbbd4f0 100644 --- a/utility/matches.js +++ b/utility/matches.js @@ -1,4 +1,5 @@ -var baseMatches = require('../internal/baseMatches'); +var baseClone = require('../internal/baseClone'), + baseMatches = require('../internal/baseMatches'); /** * Creates a function which performs a deep comparison between a given object @@ -26,7 +27,7 @@ var baseMatches = require('../internal/baseMatches'); * // => { 'user': 'barney', 'age': 36 } */ function matches(source) { - return baseMatches(source, true); + return baseMatches(baseClone(source, true)); } module.exports = matches;