diff --git a/lodash.js b/lodash.js index 39dce7d98..5dbf287cf 100644 --- a/lodash.js +++ b/lodash.js @@ -8421,7 +8421,7 @@ /** * Gets the size of `collection` by returning its length for array-like - * values or the number of own enumerable properties for objects. + * values or the number of own enumerable string keyed properties for objects. * * @static * @memberOf _ @@ -10011,7 +10011,7 @@ /** * Checks if `value` is an empty collection or object. A value is considered * empty if it's an `arguments` object, array, string, or jQuery-like collection - * with a length of `0` or has no own enumerable properties. + * with a length of `0` or has no own enumerable string keyed properties. * * @static * @memberOf _ @@ -10977,8 +10977,8 @@ } /** - * Converts `value` to a plain object flattening inherited enumerable - * properties of `value` to own properties of the plain object. + * Converts `value` to a plain object flattening inherited enumerable string + * keyed properties of `value` to own properties of the plain object. * * @static * @memberOf _ @@ -11071,9 +11071,9 @@ /*------------------------------------------------------------------------*/ /** - * Assigns own enumerable properties of source objects to the destination - * object. Source objects are applied from left to right. Subsequent sources - * overwrite property assignments of previous sources. + * Assigns own enumerable string keyed properties of source objects to the + * destination object. Source objects are applied from left to right. + * Subsequent sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object` and is loosely based on * [`Object.assign`](https://mdn.io/Object/assign). @@ -11243,7 +11243,8 @@ /** * Creates an object that inherits from the `prototype` object. If a `properties` - * object is given its own enumerable properties are assigned to the created object. + * object is given its own enumerable string keyed properties are assigned to + * the created object. * * @static * @memberOf _ @@ -11280,10 +11281,10 @@ } /** - * Assigns own and inherited enumerable properties of source objects to the - * destination object for all destination properties that resolve to `undefined`. - * Source objects are applied from left to right. Once a property is set, - * additional values of the same property are ignored. + * Assigns own and inherited enumerable string keyed properties of source + * objects to the destination object for all destination properties that + * resolve to `undefined`. Source objects are applied from left to right. + * Once a property is set, additional values of the same property are ignored. * * **Note:** This method mutates `object`. * @@ -11405,10 +11406,10 @@ } /** - * Iterates over own and inherited enumerable properties of an object invoking - * `iteratee` for each property. The iteratee is invoked with three arguments: - * (value, key, object). Iteratee functions may exit iteration early by explicitly - * returning `false`. + * Iterates over own and inherited enumerable string keyed properties of an + * object invoking `iteratee` for each property. The iteratee is invoked with + * three arguments: (value, key, object). Iteratee functions may exit iteration + * early by explicitly returning `false`. * * @static * @memberOf _ @@ -11469,8 +11470,8 @@ } /** - * Iterates over own enumerable properties of an object invoking `iteratee` - * for each property. The iteratee is invoked with three arguments: + * Iterates over own enumerable string keyed properties of an object invoking + * `iteratee` for each property. The iteratee is invoked with three arguments: * (value, key, object). Iteratee functions may exit iteration early by * explicitly returning `false`. * @@ -11529,8 +11530,8 @@ } /** - * Creates an array of function property names from own enumerable properties - * of `object`. + * Creates an array of function property names from own enumerable string + * keyed properties of `object`. * * @static * @since 0.1.0 @@ -11748,7 +11749,7 @@ var invoke = rest(baseInvoke); /** - * Creates an array of the own enumerable property names of `object`. + * Creates an array of the own enumerable string keyed property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) @@ -11796,7 +11797,8 @@ } /** - * Creates an array of the own and inherited enumerable property names of `object`. + * Creates an array of the own and inherited enumerable string keyed property + * names of `object`. * * **Note:** Non-object values are coerced to objects. * @@ -11841,8 +11843,8 @@ /** * The opposite of `_.mapValues`; this method creates an object with the * same values as `object` and keys generated by running each own enumerable - * property of `object` through `iteratee`. The iteratee is invoked with - * three arguments: (value, key, object). + * string keyed property of `object` through `iteratee`. The iteratee is + * invoked with three arguments: (value, key, object). * * @static * @memberOf _ @@ -11870,8 +11872,9 @@ /** * Creates an object with the same keys as `object` and values generated by - * running each own enumerable property of `object` through `iteratee`. The - * iteratee is invoked with three arguments: (value, key, object). + * running each own enumerable string keyed property of `object` through + * `iteratee`. The iteratee is invoked with three arguments: + * (value, key, object). * * @static * @memberOf _ @@ -11906,12 +11909,12 @@ /** * This method is like `_.assign` except that it recursively merges own and - * inherited enumerable properties of source objects into the destination - * object. Source properties that resolve to `undefined` are skipped if a - * destination value exists. Array and plain object properties are merged - * recursively.Other objects and value types are overridden by assignment. - * Source objects are applied from left to right. Subsequent sources - * overwrite property assignments of previous sources. + * inherited enumerable string keyed properties of source objects into the + * destination object. Source properties that resolve to `undefined` are + * skipped if a destination value exists. Array and plain object properties + * are merged recursively.Other objects and value types are overridden by + * assignment. Source objects are applied from left to right. Subsequent + * sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object`. * @@ -11983,7 +11986,8 @@ /** * The opposite of `_.pick`; this method creates an object composed of the - * own and inherited enumerable properties of `object` that are not omitted. + * own and inherited enumerable string keyed properties of `object` that are + * not omitted. * * @static * @since 0.1.0 @@ -12010,9 +12014,9 @@ /** * The opposite of `_.pickBy`; this method creates an object composed of - * the own and inherited enumerable properties of `object` that `predicate` - * doesn't return truthy for. The predicate is invoked with two arguments: - * (value, key). + * the own and inherited enumerable string keyed properties of `object` that + * `predicate` doesn't return truthy for. The predicate is invoked with two + * arguments: (value, key). * * @static * @memberOf _ @@ -12184,8 +12188,8 @@ } /** - * Creates an array of own enumerable key-value pairs for `object` which - * can be consumed by `_.fromPairs`. + * Creates an array of own enumerable string keyed-value pairs for `object` + * which can be consumed by `_.fromPairs`. * * @static * @memberOf _ @@ -12210,8 +12214,8 @@ } /** - * Creates an array of own and inherited enumerable key-value pairs for - * `object` which can be consumed by `_.fromPairs`. + * Creates an array of own and inherited enumerable string keyed-value pairs + * for `object` which can be consumed by `_.fromPairs`. * * @static * @memberOf _ @@ -12238,8 +12242,8 @@ /** * An alternative to `_.reduce`; this method transforms `object` to a new * `accumulator` object which is the result of running each of its own enumerable - * properties through `iteratee`, with each invocation potentially mutating - * the `accumulator` object. The iteratee is invoked with four arguments: + * string keyed properties through `iteratee`, with each invocation potentially + * mutating the `accumulator` object. The iteratee is invoked with four arguments: * (accumulator, value, key, object). Iteratee functions may exit iteration * early by explicitly returning `false`. * @@ -12378,7 +12382,7 @@ } /** - * Creates an array of the own enumerable property values of `object`. + * Creates an array of the own enumerable string keyed property values of `object`. * * **Note:** Non-object values are coerced to objects. * @@ -12408,7 +12412,8 @@ } /** - * Creates an array of the own and inherited enumerable property values of `object`. + * Creates an array of the own and inherited enumerable string keyed property + * values of `object`. * * **Note:** Non-object values are coerced to objects. * @@ -14056,9 +14061,9 @@ }); /** - * Adds all own enumerable function properties of a source object to the - * destination object. If `object` is a function then methods are added to - * its prototype as well. + * Adds all own enumerable string keyed function properties of a source object + * to the destination object. If `object` is a function then methods are added + * to its prototype as well. * * **Note:** Use `_.runInContext` to create a pristine `lodash` function to * avoid conflicts caused by modifying the original. diff --git a/test/test.js b/test/test.js index f3b032427..074a315fb 100644 --- a/test/test.js +++ b/test/test.js @@ -369,7 +369,7 @@ }); /** - * Removes all own enumerable properties from a given object. + * Removes all own enumerable string keyed properties from a given object. * * @private * @param {Object} object The object to empty. @@ -6075,7 +6075,7 @@ lodashStable.each(['forIn', 'forInRight'], function(methodName) { var func = _[methodName]; - QUnit.test('`_.' + methodName + '` iterates over inherited properties', function(assert) { + QUnit.test('`_.' + methodName + '` iterates over inherited string keyed properties', function(assert) { assert.expect(1); function Foo() { this.a = 1; } @@ -6529,7 +6529,7 @@ assert.deepEqual(actual, expected); }); - QUnit.test('`_.' + methodName + '` should assign own ' + (isAssign ? '' : 'and inherited ') + 'source properties', function(assert) { + QUnit.test('`_.' + methodName + '` should assign own ' + (isAssign ? '' : 'and inherited ') + 'string keyed source properties', function(assert) { assert.expect(1); function Foo() { this.a = 1; } @@ -9877,7 +9877,7 @@ assert.strictEqual(_.isMatch(object, { 'a': { 'b': { 'c': 1 } } }), true); }); - QUnit.test('should match inherited `object` properties', function(assert) { + QUnit.test('should match inherited string keyed `object` properties', function(assert) { assert.expect(1); function Foo() { this.a = 1; } @@ -12218,12 +12218,22 @@ func = _[methodName], isKeys = methodName == 'keys'; - QUnit.test('`_.' + methodName + '` should return the keys of an object', function(assert) { + QUnit.test('`_.' + methodName + '` should return the string keyed property names of `object`', function(assert) { assert.expect(1); assert.deepEqual(func({ 'a': 1, 'b': 1 }).sort(), ['a', 'b']); }); + QUnit.test('`_.' + methodName + '` should ' + (isKeys ? 'not ' : '') + 'include inherited string keyed properties', function(assert) { + assert.expect(1); + + function Foo() { this.a = 1; } + Foo.prototype.b = 2; + + var expected = isKeys ? ['a'] : ['a', 'b']; + assert.deepEqual(func(new Foo).sort(), expected); + }); + QUnit.test('`_.' + methodName + '` should coerce primitives to objects (test in IE 9)', function(assert) { assert.expect(2); @@ -12263,7 +12273,7 @@ assert.deepEqual(func(array).sort(), ['0', 'a']); }); - QUnit.test('`_.' + methodName + '` should ' + (isKeys ? 'not ' : '') + 'include inherited properties of arrays', function(assert) { + QUnit.test('`_.' + methodName + '` should ' + (isKeys ? 'not ' : '') + 'include inherited string keyed properties of arrays', function(assert) { assert.expect(1); var expected = isKeys ? ['0'] : ['0', 'a']; @@ -12299,7 +12309,7 @@ assert.deepEqual(actual, expected); }); - QUnit.test('`_.' + methodName + '` should ' + (isKeys ? 'not ' : '') + 'include inherited properties of `arguments` objects', function(assert) { + QUnit.test('`_.' + methodName + '` should ' + (isKeys ? 'not ' : '') + 'include inherited string keyed properties of `arguments` objects', function(assert) { assert.expect(1); var values = [args, strictArgs], @@ -12330,7 +12340,7 @@ assert.deepEqual(func(object).sort(), ['0', 'a']); }); - QUnit.test('`_.' + methodName + '` should ' + (isKeys ? 'not ' : '') + 'include inherited properties of string objects', function(assert) { + QUnit.test('`_.' + methodName + '` should ' + (isKeys ? 'not ' : '') + 'include inherited string keyed properties of string objects', function(assert) { assert.expect(1); var expected = isKeys ? ['0'] : ['0', 'a']; @@ -12356,16 +12366,6 @@ Fake.prototype.constructor = Fake; assert.deepEqual(func(Fake.prototype), ['constructor']); }); - - QUnit.test('`_.' + methodName + '` should ' + (isKeys ? 'not ' : '') + 'include inherited properties', function(assert) { - assert.expect(1); - - function Foo() { this.a = 1; } - Foo.prototype.b = 2; - - var expected = isKeys ? ['a'] : ['a', 'b']; - assert.deepEqual(func(new Foo).sort(), expected); - }); }); /*--------------------------------------------------------------------------*/ @@ -12981,7 +12981,7 @@ assert.strictEqual(matches(object), true); }); - QUnit.test('should match inherited `object` properties', function(assert) { + QUnit.test('should match inherited string keyed `object` properties', function(assert) { assert.expect(1); function Foo() { this.a = 1; } @@ -13415,7 +13415,7 @@ }); }); - QUnit.test('should match inherited `srcValue` properties', function(assert) { + QUnit.test('should match inherited string keyed `srcValue` properties', function(assert) { assert.expect(2); function Foo() {} @@ -15460,7 +15460,7 @@ assert.deepEqual(func(object, prop(object, ['a', 'c'])), expected); }); - QUnit.test('`_.' + methodName + '` should iterate over inherited properties', function(assert) { + QUnit.test('`_.' + methodName + '` should iterate over inherited string keyed properties', function(assert) { assert.expect(1); function Foo() {} @@ -16511,7 +16511,7 @@ assert.deepEqual(func(object, prop(object, ['a', 'c'])), expected); }); - QUnit.test('`_.' + methodName + '` should iterate over inherited properties', function(assert) { + QUnit.test('`_.' + methodName + '` should iterate over inherited string keyed properties', function(assert) { assert.expect(1); function Foo() {} @@ -18745,7 +18745,7 @@ var args = arguments, array = [1, 2, 3]; - QUnit.test('should return the number of own enumerable properties of an object', function(assert) { + QUnit.test('should return the number of own enumerable string keyed properties of an object', function(assert) { assert.expect(1); assert.strictEqual(_.size({ 'one': 1, 'two': 2, 'three': 3 }), 3); @@ -21973,7 +21973,7 @@ (function() { var args = arguments; - QUnit.test('should flatten inherited properties', function(assert) { + QUnit.test('should flatten inherited string keyed properties', function(assert) { assert.expect(1); function Foo() { this.b = 2; } @@ -23218,7 +23218,7 @@ assert.deepEqual(func(object), ['a', 'b', 2]); }); - QUnit.test('`_.' + methodName + '` should ' + (isValues ? 'not ' : '') + ' include inherited property values', function(assert) { + QUnit.test('`_.' + methodName + '` should ' + (isValues ? 'not ' : '') + 'include inherited string keyed property values', function(assert) { assert.expect(1); function Foo() { this.a = 1; }