array-includes
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -48,3 +48,3 @@ { | ||
"disallowQuotedKeysInObjects": "allButReserved", | ||
"disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, | ||
@@ -158,4 +158,21 @@ "disallowSpaceAfterObjectKeys": true, | ||
"allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] | ||
} | ||
}, | ||
"requireImportAlphabetized": false, | ||
"requireSpaceBeforeObjectValues": true, | ||
"requireSpaceBeforeDestructuredValues": true, | ||
"disallowSpacesInsideTemplateStringPlaceholders": true, | ||
"disallowArrayDestructuringReturn": false, | ||
"requireNewlineBeforeSingleStatementsInIf": false, | ||
"disallowUnusedVariables": true, | ||
"requireSpacesInsideImportedObjectBraces": true, | ||
"requireUseStrict": true | ||
} | ||
@@ -0,1 +1,9 @@ | ||
3.0.3 / 2017-04-18 | ||
================= | ||
* [Fix] ensure that `shim.js` actually shims when the polyfill differs from native | ||
* [Tests] up to `node` `v7.9`, `v6.10`, `v4.8`; comment out OS X builds; improve test matrix | ||
* [Dev Deps] update `nsp`, `eslint`, `@ljharb/eslint-config`, `tape`, `jscs`, `semver`, `function-bind`, `@es-shims/api` | ||
* [Deps] update `es-abstract` | ||
* [Docs] update readme: add “getting started” and “usage” (#19) | ||
3.0.2 / 2015-06-06 | ||
@@ -2,0 +10,0 @@ ================= |
'use strict'; | ||
var ES = require('es-abstract/es6'); | ||
var $isNaN = Number.isNaN || function (a) { return a !== a; }; | ||
var $isFinite = Number.isFinite || function (n) { return typeof n === 'number' && global.isFinite(n); }; | ||
var $isNaN = Number.isNaN || function isNaN(a) { | ||
return a !== a; | ||
}; | ||
var $isFinite = Number.isFinite || function isFinite(n) { | ||
return typeof n === 'number' && global.isFinite(n); | ||
}; | ||
var indexOf = Array.prototype.indexOf; | ||
@@ -7,0 +11,0 @@ |
@@ -20,4 +20,4 @@ 'use strict'; | ||
define(boundIncludesShim, { | ||
getPolyfill: getPolyfill, | ||
implementation: implementation, | ||
getPolyfill: getPolyfill, | ||
shim: shim | ||
@@ -24,0 +24,0 @@ }); |
{ | ||
"name": "array-includes", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"author": { | ||
@@ -20,4 +20,6 @@ "name": "Jordan Harband", | ||
"scripts": { | ||
"test": "npm run lint && evalmd README.md && npm run tests-only && npm run security", | ||
"tests-only": "es-shim-api --bound && npm run test:shimmed && npm run test:module", | ||
"pretest": "npm run --silent lint && evalmd README.md", | ||
"test": "npm run --silent tests-only", | ||
"posttest": "npm run --silent security", | ||
"tests-only": "es-shim-api --bound && npm run --silent test:shimmed && npm run --silent test:module", | ||
"test:shimmed": "node test/shimmed.js", | ||
@@ -27,6 +29,5 @@ "test:module": "node test/index.js", | ||
"coverage:quiet": "covert test/*.js --quiet", | ||
"lint": "npm run jscs && npm run eslint", | ||
"lint": "npm run --silent jscs && npm run --silent eslint", | ||
"jscs": "jscs test/*.js *.js", | ||
"eslint": "eslint test/*.js *.js", | ||
"eccheck": "editorconfig-tools check *.js **/*.js > /dev/null", | ||
"security": "nsp check" | ||
@@ -51,19 +52,18 @@ }, | ||
"define-properties": "^1.1.2", | ||
"es-abstract": "^1.5.0" | ||
"es-abstract": "^1.7.0" | ||
}, | ||
"devDependencies": { | ||
"foreach": "^2.0.5", | ||
"function-bind": "^1.0.2", | ||
"tape": "^4.4.0", | ||
"function-bind": "^1.1.0", | ||
"tape": "^4.6.3", | ||
"indexof": "^0.0.1", | ||
"covert": "^1.1.0", | ||
"jscs": "^2.9.0", | ||
"editorconfig-tools": "^0.1.1", | ||
"nsp": "^2.2.0", | ||
"eslint": "^1.10.3", | ||
"@ljharb/eslint-config": "^1.6.1", | ||
"semver": "^5.1.0", | ||
"jscs": "^3.0.7", | ||
"nsp": "^2.6.3", | ||
"eslint": "^3.19.0", | ||
"@ljharb/eslint-config": "^11.0.0", | ||
"semver": "^5.3.0", | ||
"replace": "^0.3.0", | ||
"@es-shims/api": "^1.0.0", | ||
"evalmd": "^0.0.16" | ||
"@es-shims/api": "^1.2.0", | ||
"evalmd": "^0.0.17" | ||
}, | ||
@@ -70,0 +70,0 @@ "testling": { |
@@ -17,4 +17,25 @@ #array-includes <sup>[![Version Badge][npm-version-svg]][package-url]</sup> | ||
Because `Array.prototype.includes` depends on a receiver (the “this” value), the main export takes the array to operate on as the first argument. | ||
Because `Array.prototype.includes` depends on a receiver (the `this` value), the main export takes the array to operate on as the first argument. | ||
## Getting started | ||
```sh | ||
npm install --save array-includes | ||
``` | ||
## Usage | ||
Basic usage: **includes(array, value[, fromIndex=0])** | ||
```js | ||
var includes = require('array-includes'); | ||
var arr = [ 'one', 'two' ]; | ||
includes(arr, 'one'); // true | ||
includes(arr, 'three'); // false | ||
includes(arr, 'one', 1); // false | ||
``` | ||
## Example | ||
@@ -31,2 +52,3 @@ | ||
]; | ||
assert.equal(arr.indexOf(0) > -1, true); | ||
@@ -51,2 +73,3 @@ assert.equal(arr.indexOf(-0) > -1, true); | ||
var shimmedIncludes = includes.shim(); | ||
assert.equal(shimmedIncludes, includes.getPolyfill()); | ||
@@ -61,2 +84,3 @@ assert.deepEqual(arr.includes('foo', 1), includes(arr, 'foo', 1)); | ||
var shimmedIncludes = includes.shim(); | ||
assert.equal(shimmedIncludes, Array.prototype.includes); | ||
@@ -63,0 +87,0 @@ assert.deepEqual(arr.includes(1, 'foo'), includes(arr, 1, 'foo')); |
@@ -8,6 +8,8 @@ 'use strict'; | ||
var polyfill = getPolyfill(); | ||
if (Array.prototype.includes !== polyfill) { | ||
define(Array.prototype, { includes: polyfill }); | ||
} | ||
define( | ||
Array.prototype, | ||
{ includes: polyfill }, | ||
{ includes: function () { return Array.prototype.includes !== polyfill; } } | ||
); | ||
return polyfill; | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
30663
13
18
284
104
Updatedes-abstract@^1.7.0