Comparing version 0.7.0 to 0.7.1
// Generate an array built of repeated arguments | ||
'use strict'; | ||
var slice = Array.prototype.slice; | ||
@@ -11,3 +13,3 @@ | ||
} | ||
arr = slice.call(arguments, 1, 1 + length); | ||
arr = slice.call(arguments, 1, 1 + length); | ||
while ((l = arr.length) < length) { | ||
@@ -14,0 +16,0 @@ arr = arr.concat(arr.slice(0, length - l)); |
@@ -1,8 +0,11 @@ | ||
// Returns first element | ||
// Returns value for first index | ||
var assertNotNull = require('../../assert-not-null'); | ||
var firstIndex = require('./first-index'); | ||
module.exports = function () { | ||
assertNotNull(this); | ||
return this[0]; | ||
var i; | ||
if ((i = firstIndex.call(this)) !== null) { | ||
return this[i]; | ||
} | ||
return undefined; | ||
}; |
@@ -15,3 +15,3 @@ // forEach starting from last element | ||
for (i = self.length; i >= 0; --i) { | ||
for (i = self.length >>> 0; i >= 0; --i) { | ||
if (self.hasOwnProperty(i)) { | ||
@@ -18,0 +18,0 @@ call.call(cb, thisArg, self[i], i, self); |
@@ -14,2 +14,3 @@ 'use strict'; | ||
first: require('./first'), | ||
firstIndex: require('./first-index'), | ||
flatten: require('./flatten'), | ||
@@ -16,0 +17,0 @@ forEachRight: require('./for-each-right'), |
@@ -8,6 +8,18 @@ // Analogous to Array.prototype.map | ||
var forEach = require('./for-each'); | ||
var assertCallable = require('../assert-callable') | ||
, forEach = require('./for-each') | ||
, defaultCb; | ||
defaultCb = function (value, key) { | ||
return [key, value]; | ||
}; | ||
module.exports = function (cb, thisArg, compareFn, byKeys) { | ||
var a = []; | ||
if (cb != null) { | ||
assertCallable(cb); | ||
} else { | ||
cb = defaultCb; | ||
} | ||
forEach.call(this, function (value, key) { | ||
@@ -14,0 +26,0 @@ a.push(cb.call(thisArg, value, key, this)); |
{ | ||
"name": "es5-ext", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"description": "ECMAScript5 extensions", | ||
@@ -5,0 +5,0 @@ "keywords": ["ecmascript", "ecmascript5", "es5", "extensions", "ext", |
@@ -51,3 +51,3 @@ # es5-ext - ECMAScript5 extensions | ||
* `Array.prototype` and `Object.prototype` methods can be run on any object (any | ||
value that's neither null nor undefined), | ||
value that's neither _null_ nor _undefined_), | ||
* `Date.prototype` methods should be called only on `Date` instances. | ||
@@ -87,2 +87,3 @@ * `Function.prototype` methods can be called on any callable objects (not | ||
* `Array.prototype.first()` | ||
* `Array.prototype.firstIndex()` | ||
* `Array.prototype.flatten()` | ||
@@ -202,3 +203,3 @@ * `Array.prototype.forEachRight(cb[, thisArg])` | ||
* `Object.prototype.mapKeys(cb[, thisArg[, compareFn[, byKeys]]])` | ||
* `Object.prototype.mapToArray(cb[, thisArg[, compareFn[, byKeys]]])` | ||
* `Object.prototype.mapToArray([cb[, thisArg[, compareFn[, byKeys]]]])` | ||
* `Object.prototype.merge(arg)` | ||
@@ -205,0 +206,0 @@ * `Object.prototype.mergeProperties(arg)` |
@@ -6,1 +6,8 @@ 'use strict'; | ||
}; | ||
exports[''] = function (t, a) { | ||
var x; | ||
a(t.call([]), undefined, "Empty"); | ||
a(t.call(Array(234), undefined, "Sparse empty")) | ||
x = Array(2342); x[434] = {}; | ||
a(t.call(x), x[434], "Sparse"); | ||
}; |
@@ -11,2 +11,6 @@ 'use strict'; | ||
a.deep(o2, [2, 4, 6]); | ||
t.call(o).sort().forEach(function (item, index) { | ||
a.deep(item, [item[0], o[item[0]]], "Default"); | ||
}); | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
143084
285
4065
243
0