Socket
Socket
Sign inDemoInstall

array-includes

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-includes - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

4

CHANGELOG.md

@@ -0,1 +1,5 @@

1.0.4 / 2015-01-10
=================
* Use `es-abstract` for ECMAScript spec internal abstract operations
1.0.3 / 2015-01-06

@@ -2,0 +6,0 @@ =================

39

index.js
'use strict';
var define = require('define-properties');
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 maxSafeInteger = Number.MAX_SAFE_INTEGER || (Math.pow(2, 53) - 1);
var Obj = Object;
var toStr = Obj.prototype.toString;
var ES = {
CheckObjectCoercible: function (x, optMessage) {
if (x == null) {
throw new TypeError(optMessage || 'Cannot call method on ' + x);
}
return x;
},
ToObject: function (o, optMessage) {
return Obj(ES.CheckObjectCoercible(o, optMessage));
},
ToLength: function (value) {
var len = ES.ToInteger(value);
if (len <= 0) { return 0; } // includes converting -0 to +0
if (len > maxSafeInteger) { return maxSafeInteger; }
return len;
},
ToNumber: function (value) {
if (toStr.call(value) === '[object Symbol]') {
throw new TypeError('Symbols can not be converted to numbers');
}
return +value;
},
ToInteger: function (value) {
var number = ES.ToNumber(value);
if ($isNaN(number)) { return 0; }
if (number === 0 || !$isFinite(number)) { return number; }
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
},
SameValueZero: function (a, b) {
return a === b || ($isNaN(a) && $isNaN(b));
}
};

@@ -66,3 +32,4 @@ var includesShim = function includes(searchElement) {

/*eslint-enable no-unused-vars */
return includesShim.apply(ES.CheckObjectCoercible(array), Array.prototype.slice.call(arguments, 1));
ES.RequireObjectCoercible(array);
return includesShim.apply(array, Array.prototype.slice.call(arguments, 1));
};

@@ -69,0 +36,0 @@ define(boundIncludesShim, {

{
"name": "array-includes",
"version": "1.0.3",
"version": "1.0.4",
"author": "Jordan Harband",

@@ -35,3 +35,4 @@ "description": "A spec-compliant `Array.prototype.includes` shim/polyfill/replacement that works as far down as ES3.",

"dependencies": {
"define-properties": "~1.0.1"
"define-properties": "~1.0.1",
"es-abstract": "~1.0.0"
},

@@ -38,0 +39,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc