Permalink
Browse files

Update docs and builds.

  • Loading branch information...
1 parent 565b968 commit ff27209df478b695d26f3f2d8c515265eda62025 @jdalton jdalton committed Mar 25, 2013
View
@@ -337,19 +337,6 @@
}
/**
- * Checks if `value` is a DOM node in IE < 9.
- *
- * @private
- * @param {Mixed} value The value to check.
- * @returns {Boolean} Returns `true` if the `value` is a DOM node, else `false`.
- */
- function isNode(value) {
- // IE < 9 presents DOM nodes as `Object` objects except they have `toString`
- // methods that are `typeof` "string" and still can coerce nodes to strings
- return typeof value.toString != 'function' && typeof String(value) == 'string';
- }
-
- /**
* A fast path for creating `lodash` wrapper objects.
*
* @private
@@ -372,28 +359,6 @@
}
/**
- * A fallback implementation of `Object.keys` that produces an array of the
- * given object's own enumerable property names.
- *
- * @private
- * @type Function
- * @param {Object} object The object to inspect.
- * @returns {Array} Returns a new array of property names.
- */
- var shimKeys = function (object) {
- var index, iterable = object, result = [];
- if (!iterable) return result;
- if (!(objectTypes[typeof object])) return result;
-
- for (index in iterable) {
- if (hasOwnProperty.call(iterable, index)) {
- result.push(index);
- }
- }
- return result
- };
-
- /**
* Used by `unescape` to convert HTML entities to characters.
*
* @private
@@ -455,6 +420,28 @@
};
/**
+ * A fallback implementation of `Object.keys` that produces an array of the
+ * given object's own enumerable property names.
+ *
+ * @private
+ * @type Function
+ * @param {Object} object The object to inspect.
+ * @returns {Array} Returns a new array of property names.
+ */
+ var shimKeys = function (object) {
+ var index, iterable = object, result = [];
+ if (!iterable) return result;
+ if (!(objectTypes[typeof object])) return result;
+
+ for (index in iterable) {
+ if (hasOwnProperty.call(iterable, index)) {
+ result.push(index);
+ }
+ }
+ return result
+ };
+
+ /**
* Creates an array composed of the own enumerable property names of `object`.
*
* @static
@@ -2073,9 +2060,12 @@
* // => [2, 3, 4]
*/
function toArray(collection) {
- if (collection && typeof collection.length == 'number') {
+ if (isArray(collection)) {
return slice.call(collection);
}
+ if (collection && typeof collection.length == 'number') {
+ return map(collection);
+ }
return values(collection);
}
Oops, something went wrong.
View
@@ -365,7 +365,7 @@
* @type Boolean
*/
try {
- support.nodeClass = !(toString.call(document) == objectClass && !String({ 'toString': 0 }));
+ support.nodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
} catch(e) {
support.nodeClass = true;
}
@@ -500,11 +500,9 @@
if (support.enumPrototypes || obj.useHas) {
__p += '\n }';
}
- __p += '\n } ';
- }
-
+ __p += '\n } ';
if (support.nonEnumShadows) {
- __p += '\n\n var ctor = iterable.constructor;\n ';
+ __p += '\n\n var ctor = iterable.constructor;\n ';
for (var k = 0; k < 7; k++) {
__p += '\n index = \'' +
(obj.shadowedProps[k]) +
@@ -514,7 +512,9 @@
}
__p += 'hasOwnProperty.call(iterable, index)) {\n ' +
(obj.loop) +
- '\n } ';
+ '\n } ';
+ }
+
}
}
@@ -745,22 +745,6 @@
}
/**
- * A function compiled to iterate `arguments` objects, arrays, objects, and
- * strings consistenly across environments, executing the `callback` for each
- * element in the `collection`. The `callback` is bound to `thisArg` and invoked
- * with three arguments; (value, index|key, collection). Callbacks may exit
- * iteration early by explicitly returning `false`.
- *
- * @private
- * @type Function
- * @param {Array|Object|String} collection The collection to iterate over.
- * @param {Function} [callback=identity] The function called per iteration.
- * @param {Mixed} [thisArg] The `this` binding of `callback`.
- * @returns {Array|Object|String} Returns `collection`.
- */
- var each = createIterator(eachIteratorOptions);
-
- /**
* Used by `template` to escape characters for inclusion in compiled
* string literals.
*
@@ -793,7 +777,7 @@
function isNode(value) {
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
// methods that are `typeof` "string" and still can coerce nodes to strings
- return typeof value.toString != 'function' && typeof String(value) == 'string';
+ return typeof value.toString != 'function' && typeof (value + '') == 'string';
}
/**
@@ -836,7 +820,8 @@
}
// check that the constructor is `Object` (i.e. `Object instanceof Object`)
var ctor = value.constructor;
- if ((!isFunction(ctor) && (support.nodeClass || !isNode(value))) || ctor instanceof ctor) {
+
+ if (isFunction(ctor) ? ctor instanceof ctor : (support.nodeClass || !isNode(value))) {
// IE < 9 iterates inherited properties before own properties. If the first
// iterated property is an object's own property then there are no inherited
// enumerable properties.
@@ -859,23 +844,6 @@
}
/**
- * A fallback implementation of `Object.keys` that produces an array of the
- * given object's own enumerable property names.
- *
- * @private
- * @type Function
- * @param {Object} object The object to inspect.
- * @returns {Array} Returns a new array of property names.
- */
- var shimKeys = createIterator({
- 'args': 'object',
- 'init': '[]',
- 'top': 'if (!(objectTypes[typeof object])) return result',
- 'loop': 'result.push(index)',
- 'arrays': false
- });
-
- /**
* Slices the `collection` from the `start` index up to, but not including,
* the `end` index.
*
@@ -965,6 +933,23 @@
};
/**
+ * A fallback implementation of `Object.keys` that produces an array of the
+ * given object's own enumerable property names.
+ *
+ * @private
+ * @type Function
+ * @param {Object} object The object to inspect.
+ * @returns {Array} Returns a new array of property names.
+ */
+ var shimKeys = createIterator({
+ 'args': 'object',
+ 'init': '[]',
+ 'top': 'if (!(objectTypes[typeof object])) return result',
+ 'loop': 'result.push(index)',
+ 'arrays': false
+ });
+
+ /**
* Creates an array composed of the own enumerable property names of `object`.
*
* @static
@@ -989,6 +974,22 @@
};
/**
+ * A function compiled to iterate `arguments` objects, arrays, objects, and
+ * strings consistenly across environments, executing the `callback` for each
+ * element in the `collection`. The `callback` is bound to `thisArg` and invoked
+ * with three arguments; (value, index|key, collection). Callbacks may exit
+ * iteration early by explicitly returning `false`.
+ *
+ * @private
+ * @type Function
+ * @param {Array|Object|String} collection The collection to iterate over.
+ * @param {Function} [callback=identity] The function called per iteration.
+ * @param {Mixed} [thisArg] The `this` binding of `callback`.
+ * @returns {Array|Object|String} Returns `collection`.
+ */
+ var each = createIterator(eachIteratorOptions);
+
+ /**
* Used to convert characters to HTML entities:
*
* Though the `>` character is escaped for symmetry, characters like `>` and `/`
Oops, something went wrong.

0 comments on commit ff27209

Please sign in to comment.