Clarify a bit more the order is not guaranteed notes on object iteration.

Former-commit-id: bfe3033325bc941a03948fe41056634663a10989
This commit is contained in:
John-David Dalton
2013-08-14 23:30:29 -07:00
parent ab66e77740
commit 0669a053db
8 changed files with 71 additions and 77 deletions

View File

@@ -810,7 +810,7 @@
* @example
*
* _.keys({ 'one': 1, 'two': 2, 'three': 3 });
* // => ['one', 'two', 'three'] (order is not guaranteed)
* // => ['one', 'two', 'three'] (property order is not guaranteed across environments)
*/
var keys = !nativeKeys ? shimKeys : function(object) {
if (!isObject(object)) {
@@ -1000,7 +1000,7 @@
* _.forIn(new Dog('Dagny'), function(value, key) {
* console.log(key);
* });
* // => logs 'bark' and 'name' (order is not guaranteed)
* // => logs 'bark' and 'name' (property order is not guaranteed across environments)
*/
var forIn = function(collection, callback) {
var index, iterable = collection, result = iterable;
@@ -1031,7 +1031,7 @@
* _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
* console.log(key);
* });
* // => logs '0', '1', and 'length' (order is not guaranteed)
* // => logs '0', '1', and 'length' (property order is not guaranteed across environments)
*/
var forOwn = function(collection, callback) {
var index, iterable = collection, result = iterable;
@@ -1499,7 +1499,7 @@
* @example
*
* _.pairs({ 'moe': 30, 'larry': 40 });
* // => [['moe', 30], ['larry', 40]] (order is not guaranteed)
* // => [['moe', 30], ['larry', 40]] (property order is not guaranteed across environments)
*/
function pairs(object) {
var index = -1,
@@ -1567,7 +1567,7 @@
* @example
*
* _.values({ 'one': 1, 'two': 2, 'three': 3 });
* // => [1, 2, 3] (order is not guaranteed)
* // => [1, 2, 3] (property order is not guaranteed across environments)
*/
function values(object) {
var index = -1,
@@ -1903,7 +1903,7 @@
* // => logs each number and returns '1,2,3'
*
* _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
* // => logs each number value and returns the object (order is not guaranteed)
* // => logs each number and returns the object (property order is not guaranteed across environments)
*/
function forEach(collection, callback, thisArg) {
var index = -1,
@@ -2054,7 +2054,7 @@
* // => [3, 6, 9]
*
* _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
* // => [3, 6, 9] (order is not guaranteed)
* // => [3, 6, 9] (property order is not guaranteed across environments)
*
* var stooges = [
* { 'name': 'moe', 'age': 40 },
@@ -3670,9 +3670,7 @@
var isCalled = trailing && (!leading || callCount > 1);
clear();
if (isCalled) {
if (maxWait !== false) {
lastCalled = +new Date;
}
lastCalled = +new Date;
result = func.apply(thisArg, args);
}
};