Update vendors, builds, and docs.

Former-commit-id: 8e6ca9a1334c73671aba1b4c974d738dbd7d72e1
This commit is contained in:
John-David Dalton
2012-12-18 07:41:34 -08:00
parent 7bea30b2e6
commit 647746ea72
7 changed files with 286 additions and 219 deletions

View File

@@ -715,6 +715,23 @@
return result
};
/**
* Creates an array composed of the own enumerable property names of `object`.
*
* @static
* @memberOf _
* @category Objects
* @param {Object} object The object to inspect.
* @returns {Array} Returns a new array of property names.
* @example
*
* _.keys({ 'one': 1, 'two': 2, 'three': 3 });
* // => ['one', 'two', 'three'] (order is not guaranteed)
*/
var keys = !nativeKeys ? shimKeys : function(object) {
return (isObject(object) ? nativeKeys(object) : []);
};
/**
* A fallback implementation of `isPlainObject` that checks if a given `value`
* is an object created by the `Object` constructor, assuming objects created
@@ -912,10 +929,15 @@
* // => { 'Moe': 'first', 'Larry': 'second', 'Curly': 'third' } (order is not guaranteed)
*/
function invert(object) {
var result = {};
forOwn(object, function(value, key) {
result[value] = key;
});
var index = -1,
props = keys(object),
length = props.length,
result = {};
while (++index < length) {
var key = props[index];
result[object[key]] = key;
}
return result;
}
@@ -1371,23 +1393,6 @@
return typeof value == 'undefined';
}
/**
* Creates an array composed of the own enumerable property names of `object`.
*
* @static
* @memberOf _
* @category Objects
* @param {Object} object The object to inspect.
* @returns {Array} Returns a new array of property names.
* @example
*
* _.keys({ 'one': 1, 'two': 2, 'three': 3 });
* // => ['one', 'two', 'three'] (order is not guaranteed)
*/
var keys = !nativeKeys ? shimKeys : function(object) {
return (isObject(object) ? nativeKeys(object) : []);
};
/**
* Creates a shallow clone of `object` excluding the specified properties.
* Property names may be specified as individual arguments or as arrays of
@@ -1440,10 +1445,15 @@
* // => [['moe', 30], ['larry', 40], ['curly', 50]] (order is not guaranteed)
*/
function pairs(object) {
var result = [];
forOwn(object, function(value, key) {
result.push([key, value]);
});
var index = -1,
props = keys(object),
length = props.length,
result = Array(length);
while (++index < length) {
var key = props[index];
result[index] = [key, object[key]];
}
return result;
}
@@ -1501,10 +1511,14 @@
* // => [1, 2, 3]
*/
function values(object) {
var result = [];
forOwn(object, function(value) {
result.push(value);
});
var index = -1,
props = keys(object),
length = props.length,
result = Array(length);
while (++index < length) {
result[index] = object[props[index]];
}
return result;
}