Update doc examples of _.isPlainObject, _.toArray, _.forIn, _.forInRight, _.keys, _.keysIn, _.values, & _.valuesIn. [ci skip]

This commit is contained in:
John-David Dalton
2015-01-15 09:35:28 -08:00
committed by jdalton
parent 8861c04e77
commit 98535638a2

View File

@@ -8204,12 +8204,11 @@
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example * @example
* *
* function Shape() { * function Foo() {
* this.x = 0; * this.a = 1;
* this.y = 0;
* } * }
* *
* _.isPlainObject(new Shape); * _.isPlainObject(new Foo);
* // => false * // => false
* *
* _.isPlainObject([1, 2, 3]); * _.isPlainObject([1, 2, 3]);
@@ -8323,8 +8322,8 @@
* @returns {Array} Returns the converted array. * @returns {Array} Returns the converted array.
* @example * @example
* *
* (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4); * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3);
* // => [2, 3, 4] * // => [2, 3]
*/ */
function toArray(value) { function toArray(value) {
var length = value ? value.length : 0; var length = value ? value.length : 0;
@@ -8555,17 +8554,17 @@
* @returns {Object} Returns `object`. * @returns {Object} Returns `object`.
* @example * @example
* *
* function Shape() { * function Foo() {
* this.x = 0; * this.a = 1;
* this.y = 0; * this.b = 2;
* } * }
* *
* Shape.prototype.z = 0; * Foo.prototype.c = 3;
* *
* _.forIn(new Shape, function(value, key) { * _.forIn(new Foo, function(value, key) {
* console.log(key); * console.log(key);
* }); * });
* // => logs 'x', 'y', and 'z' (iteration order is not guaranteed) * // => logs 'a', 'b', and 'c' (iteration order is not guaranteed)
*/ */
function forIn(object, iteratee, thisArg) { function forIn(object, iteratee, thisArg) {
if (typeof iteratee != 'function' || typeof thisArg != 'undefined') { if (typeof iteratee != 'function' || typeof thisArg != 'undefined') {
@@ -8587,17 +8586,17 @@
* @returns {Object} Returns `object`. * @returns {Object} Returns `object`.
* @example * @example
* *
* function Shape() { * function Foo() {
* this.x = 0; * this.a = 1;
* this.y = 0; * this.b = 2;
* } * }
* *
* Shape.prototype.z = 0; * Foo.prototype.c = 3;
* *
* _.forInRight(new Shape, function(value, key) { * _.forInRight(new Foo, function(value, key) {
* console.log(key); * console.log(key);
* }); * });
* // => logs 'z', 'y', and 'x' assuming `_.forIn ` logs 'x', 'y', and 'z' * // => logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c'
*/ */
function forInRight(object, iteratee, thisArg) { function forInRight(object, iteratee, thisArg) {
iteratee = bindCallback(iteratee, thisArg, 3); iteratee = bindCallback(iteratee, thisArg, 3);
@@ -8758,15 +8757,15 @@
* @returns {Array} Returns the array of property names. * @returns {Array} Returns the array of property names.
* @example * @example
* *
* function Shape() { * function Foo() {
* this.x = 0; * this.a = 1;
* this.y = 0; * this.b = 2;
* } * }
* *
* Shape.prototype.z = 0; * Foo.prototype.c = 3;
* *
* _.keys(new Shape); * _.keys(new Foo);
* // => ['x', 'y'] (iteration order is not guaranteed) * // => ['a', 'b'] (iteration order is not guaranteed)
* *
* _.keys('hi'); * _.keys('hi');
* // => ['0', '1'] * // => ['0', '1']
@@ -8795,15 +8794,15 @@
* @returns {Array} Returns the array of property names. * @returns {Array} Returns the array of property names.
* @example * @example
* *
* function Shape() { * function Foo() {
* this.x = 0; * this.a = 1;
* this.y = 0; * this.b = 2;
* } * }
* *
* Shape.prototype.z = 0; * Foo.prototype.c = 3;
* *
* _.keysIn(new Shape); * _.keysIn(new Foo);
* // => ['x', 'y', 'z'] (iteration order is not guaranteed) * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/ */
function keysIn(object) { function keysIn(object) {
if (object == null) { if (object == null) {
@@ -9164,15 +9163,15 @@
* @returns {Array} Returns the array of property values. * @returns {Array} Returns the array of property values.
* @example * @example
* *
* function Shape(x, y) { * function Foo() {
* this.x = x; * this.a = 1;
* this.y = y; * this.b = 2;
* } * }
* *
* Shape.prototype.z = 0; * Foo.prototype.c = 3;
* *
* _.values(new Shape(2, 1)); * _.values(new Foo);
* // => [2, 1] (iteration order is not guaranteed) * // => [1, 2] (iteration order is not guaranteed)
* *
* _.values('hi'); * _.values('hi');
* // => ['h', 'i'] * // => ['h', 'i']
@@ -9194,15 +9193,15 @@
* @returns {Array} Returns the array of property values. * @returns {Array} Returns the array of property values.
* @example * @example
* *
* function Shape(x, y) { * function Foo() {
* this.x = x; * this.a = 1;
* this.y = y; * this.b = 2;
* } * }
* *
* Shape.prototype.z = 0; * Foo.prototype.c = 3;
* *
* _.valuesIn(new Shape(2, 1)); * _.valuesIn(new Foo);
* // => [2, 1, 0] (iteration order is not guaranteed) * // => [1, 2, 3] (iteration order is not guaranteed)
*/ */
function valuesIn(object) { function valuesIn(object) {
return baseValues(object, keysIn(object)); return baseValues(object, keysIn(object));