array.prototype.findindex
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -0,1 +1,6 @@ | ||
# 2.0.1 | ||
- [Fix] use call instead of apply in bound entry point function (#17) | ||
- [Refactor] Remove unnecessary double ToLength call (#16) | ||
- [Tests] run tests on travis-ci | ||
# 2.0.0 | ||
@@ -2,0 +7,0 @@ - [Breaking] use es-shim API (#13) |
@@ -8,3 +8,3 @@ // Array.prototype.findIndex - MIT License (c) 2013 Paul Miller <http://paulmillr.com> | ||
var list = ES.ToObject(this); | ||
var length = ES.ToLength(ES.ToLength(list.length)); | ||
var length = ES.ToLength(list.length); | ||
if (!ES.IsCallable(predicate)) { | ||
@@ -11,0 +11,0 @@ throw new TypeError('Array#findIndex: predicate must be a function'); |
@@ -14,3 +14,4 @@ 'use strict'; | ||
ES.RequireObjectCoercible(array); | ||
return implementation.apply(array, predicate); | ||
var args = slice.call(arguments, 1); | ||
return implementation.apply(array, args); | ||
}; | ||
@@ -17,0 +18,0 @@ |
{ | ||
"name": "array.prototype.findindex", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Array.prototype.findIndex ES6 polyfill.", | ||
@@ -12,3 +12,4 @@ "keywords": [ | ||
"scripts": { | ||
"test": "es-shim-api --bound && mocha test.js" | ||
"tests-only": "es-shim-api --bound && mocha test.js", | ||
"test": "npm run tests-only" | ||
}, | ||
@@ -15,0 +16,0 @@ "repository": { |
@@ -22,13 +22,6 @@ # ES6 `Array.prototype.findIndex` polyfill | ||
Node.js: | ||
```javascript | ||
require('array.prototype.findindex'); | ||
``` | ||
var findIndex = require('array.prototype.findindex'); | ||
Browser: | ||
```javascript | ||
// component(1) | ||
require('array.prototype.findindex'); | ||
findIndex.shim(); // if you want to install it on the global environment | ||
``` | ||
@@ -35,0 +28,0 @@ |
18
test.js
@@ -105,1 +105,19 @@ var expect = require("chai").expect; | ||
}); | ||
describe('single function', function() { | ||
var findIndexAsFunction = function(func) { | ||
var args = Array.prototype.slice.call(arguments); | ||
args.unshift(this); | ||
return arrayFindIndex.apply(undefined, args); | ||
}; | ||
describe('clean Object.prototype', function() { | ||
runTests(findIndexAsFunction); | ||
}); | ||
describe('polluted Object.prototype', function() { | ||
Object.prototype[1] = 42; | ||
runTests(findIndexAsFunction); | ||
delete Object.prototype[1]; | ||
}); | ||
}); |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
14968
13
163
0
58