Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

polyfills

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polyfills - npm Package Compare versions

Comparing version 1.9.6 to 1.9.7

2

package.json
{
"name": "polyfills",
"description": "user-agent-based polyfill combinator",
"version": "1.9.6",
"version": "1.9.7",
"dependencies": {

@@ -6,0 +6,0 @@ "bluebird": "2",

@@ -15,2 +15,4 @@ /*!

(function (root, factory) {
'use strict';
/*global define, exports, module */
if (typeof define === 'function' && define.amd) {

@@ -117,3 +119,3 @@ // AMD. Register as an anonymous module.

// `configurable`.
var descriptor = { enumerable: true, configurable: true };
var descriptor = { enumerable: true, configurable: true };

@@ -180,9 +182,10 @@ // If JS engine supports accessor properties then property may be a

var createEmpty;
var supportsProto = !({__proto__:null} instanceof Object);
var supportsProto = !({ __proto__: null } instanceof Object);
// the following produces false positives
// in Opera Mini => not a reliable check
// Object.prototype.__proto__ === null
/*global document */
if (supportsProto || typeof document === 'undefined') {
createEmpty = function () {
return { '__proto__': null };
return { __proto__: null };
};

@@ -327,5 +330,3 @@ } else {

if (supportsAccessors && (lookupGetter(object, property) ||
lookupSetter(object, property)))
{
if (supportsAccessors && (lookupGetter(object, property) || lookupSetter(object, property))) {
// As accessors are supported only on engines implementing

@@ -418,3 +419,3 @@ // `__proto__` we can safely override `__proto__` while defining

};
})(Object.freeze);
}(Object.freeze));
}

@@ -470,2 +471,1 @@

}));

@@ -9,8 +9,9 @@ /*!

//Add semicolon to prevent IIFE from being passed as argument to concatenated code.
;
// UMD (Universal Module Definition)
// see https://github.com/umdjs/umd/blob/master/returnExports.js
(function (root, factory) {
// Add semicolon to prevent IIFE from being passed as argument to concatenated code.
;(function (root, factory) {
'use strict';
/*global define, exports, module */
if (typeof define === 'function' && define.amd) {

@@ -52,27 +53,27 @@ // AMD. Register as an anonymous module.

// Having a toString local variable name breaks in Opera so use _toString.
var _toString = ObjectPrototype.toString;
// Having a toString local variable name breaks in Opera so use to_string.
var to_string = ObjectPrototype.toString;
var isFunction = function (val) {
return ObjectPrototype.toString.call(val) === '[object Function]';
return to_string.call(val) === '[object Function]';
};
var isRegex = function (val) {
return ObjectPrototype.toString.call(val) === '[object RegExp]';
return to_string.call(val) === '[object RegExp]';
};
var isArray = function isArray(obj) {
return _toString.call(obj) === '[object Array]';
return to_string.call(obj) === '[object Array]';
};
var isString = function isString(obj) {
return _toString.call(obj) === '[object String]';
return to_string.call(obj) === '[object String]';
};
var isArguments = function isArguments(value) {
var str = _toString.call(value);
var str = to_string.call(value);
var isArgs = str === '[object Arguments]';
if (!isArgs) {
isArgs = !isArray(value)
&& value !== null
&& typeof value === 'object'
&& typeof value.length === 'number'
&& value.length >= 0
&& isFunction(value.callee);
isArgs = !isArray(value) &&
value !== null &&
typeof value === 'object' &&
typeof value.length === 'number' &&
value.length >= 0 &&
isFunction(value.callee);
}

@@ -139,9 +140,7 @@ return isArgs;

var type = typeof input;
return (
input === null ||
return input === null ||
type === 'undefined' ||
type === 'boolean' ||
type === 'number' ||
type === 'string'
);
type === 'string';
}

@@ -171,15 +170,17 @@

// ES5 9.9
// http://es5.github.com/#x9.9
var toObject = function (o) {
if (o == null) { // this matches both null and undefined
throw new TypeError("can't convert " + o + ' to object');
var ES = {
// ES5 9.9
// http://es5.github.com/#x9.9
ToObject: function (o) {
/*jshint eqnull: true */
if (o == null) { // this matches both null and undefined
throw new TypeError("can't convert " + o + ' to object');
}
return Object(o);
},
ToUint32: function ToUint32(x) {
return x >>> 0;
}
return Object(o);
};
var ToUint32 = function ToUint32(x) {
return x >>> 0;
};
//

@@ -193,3 +194,3 @@ // Function

function Empty() {}
var Empty = function Empty() {};

@@ -217,2 +218,3 @@ defineProperties(FunctionPrototype, {

// 15.3.4.5.3.
var bound;
var binder = function () {

@@ -296,3 +298,3 @@

// and so this code will never be executed.
var bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder);
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder);

@@ -335,15 +337,2 @@ if (target.prototype) {

// If JS engine supports accessors creating shortcuts.
var defineGetter;
var defineSetter;
var lookupGetter;
var lookupSetter;
var supportsAccessors;
if ((supportsAccessors = owns(ObjectPrototype, '__defineGetter__'))) {
defineGetter = call.bind(ObjectPrototype.__defineGetter__);
defineSetter = call.bind(ObjectPrototype.__defineSetter__);
lookupGetter = call.bind(ObjectPrototype.__lookupGetter__);
lookupSetter = call.bind(ObjectPrototype.__lookupSetter__);
}
//

@@ -452,3 +441,3 @@ // Array

forEach: function forEach(fun /*, thisp*/) {
var object = toObject(this),
var object = ES.ToObject(this),
self = splitString && isString(this) ? this.split('') : object,

@@ -480,3 +469,3 @@ thisp = arguments[1],

map: function map(fun /*, thisp*/) {
var object = toObject(this),
var object = ES.ToObject(this),
self = splitString && isString(this) ? this.split('') : object,

@@ -506,3 +495,3 @@ length = self.length >>> 0,

filter: function filter(fun /*, thisp */) {
var object = toObject(this),
var object = ES.ToObject(this),
self = splitString && isString(this) ? this.split('') : object,

@@ -536,3 +525,3 @@ length = self.length >>> 0,

every: function every(fun /*, thisp */) {
var object = toObject(this),
var object = ES.ToObject(this),
self = splitString && isString(this) ? this.split('') : object,

@@ -561,3 +550,3 @@ length = self.length >>> 0,

some: function some(fun /*, thisp */) {
var object = toObject(this),
var object = ES.ToObject(this),
self = splitString && isString(this) ? this.split('') : object,

@@ -590,3 +579,3 @@ length = self.length >>> 0,

reduce: function reduce(fun /*, initial*/) {
var object = toObject(this),
var object = ES.ToObject(this),
self = splitString && isString(this) ? this.split('') : object,

@@ -642,3 +631,3 @@ length = self.length >>> 0;

reduceRight: function reduceRight(fun /*, initial*/) {
var object = toObject(this),
var object = ES.ToObject(this),
self = splitString && isString(this) ? this.split('') : object,

@@ -693,4 +682,4 @@ length = self.length >>> 0;

defineProperties(ArrayPrototype, {
indexOf: function indexOf(sought /*, fromIndex */ ) {
var self = splitString && isString(this) ? this.split('') : toObject(this),
indexOf: function indexOf(sought /*, fromIndex */) {
var self = splitString && isString(this) ? this.split('') : ES.ToObject(this),
length = self.length >>> 0;

@@ -724,3 +713,3 @@

lastIndexOf: function lastIndexOf(sought /*, fromIndex */) {
var self = splitString && isString(this) ? this.split('') : toObject(this),
var self = splitString && isString(this) ? this.split('') : ES.ToObject(this),
length = self.length >>> 0;

@@ -756,3 +745,3 @@

var hasDontEnumBug = !({'toString': null}).propertyIsEnumerable('toString'),
hasProtoEnumBug = (function () {}).propertyIsEnumerable('prototype'),
hasProtoEnumBug = function () {}.propertyIsEnumerable('prototype'),
dontEnums = [

@@ -944,2 +933,3 @@ 'toString',

// an alternate object for the context.
/*global Date: true */
Date = (function (NativeDate) {

@@ -973,3 +963,3 @@

var isoDateExpression = new RegExp('^' +
'(\\d{4}|[\+\-]\\d{6})' + // four-digit year capture or sign +
'(\\d{4}|[+-]\\d{6})' + // four-digit year capture or sign +
// 6-digit extended year

@@ -1083,3 +1073,4 @@ '(?:-(\\d{2})' + // optional month capture

return Date;
})(Date);
}(Date));
/*global Date: false */
}

@@ -1104,6 +1095,6 @@

var hasToFixedBugs = NumberPrototype.toFixed && (
(0.00008).toFixed(3) !== '0.000'
|| (0.9).toFixed(0) !== '1'
|| (1.255).toFixed(2) !== '1.25'
|| (1000000000000000128).toFixed(0) !== '1000000000000000128'
(0.00008).toFixed(3) !== '0.000' ||
(0.9).toFixed(0) !== '1' ||
(1.255).toFixed(2) !== '1.25' ||
(1000000000000000128).toFixed(0) !== '1000000000000000128'
);

@@ -1281,7 +1272,7 @@

(function () {
var compliantExecNpcg = /()??/.exec('')[1] === void 0; // NPCG: nonparticipating capturing group
var compliantExecNpcg = typeof (/()??/).exec('')[1] === 'undefined'; // NPCG: nonparticipating capturing group
StringPrototype.split = function (separator, limit) {
var string = this;
if (separator === void 0 && limit === 0) {
if (typeof separator === 'undefined' && limit === 0) {
return [];

@@ -1291,3 +1282,3 @@ }

// If `separator` is not a regex, use native split
if (_toString.call(separator) !== '[object RegExp]') {
if (to_string.call(separator) !== '[object RegExp]') {
return string_split.call(this, separator, limit);

@@ -1298,5 +1289,5 @@ }

flags = (separator.ignoreCase ? 'i' : '') +
(separator.multiline ? 'm' : '') +
(separator.extended ? 'x' : '') + // Proposed for ES6
(separator.sticky ? 'y' : ''), // Firefox 3+
(separator.multiline ? 'm' : '') +
(separator.extended ? 'x' : '') + // Proposed for ES6
(separator.sticky ? 'y' : ''), // Firefox 3+
lastLastIndex = 0,

@@ -1318,5 +1309,5 @@ // Make `global` and avoid `lastIndex` issues by working with a copy

*/
limit = limit === void 0 ?
limit = typeof limit === 'undefined' ?
-1 >>> 0 : // Math.pow(2, 32) - 1
ToUint32(limit);
ES.ToUint32(limit);
while (match = separator.exec(string)) {

@@ -1332,3 +1323,3 @@ // `separator.lastIndex` is not reliable cross-browser

for (var i = 1; i < arguments.length - 2; i++) {
if (arguments[i] === void 0) {
if (typeof arguments[i] === 'undefined') {
match[i] = void 0;

@@ -1340,3 +1331,3 @@ }

if (match.length > 1 && match.index < string.length) {
ArrayPrototype.push.apply(output, match.slice(1));
array_push.apply(output, match.slice(1));
}

@@ -1372,3 +1363,3 @@ lastLength = match[0].length;

StringPrototype.split = function split(separator, limit) {
if (separator === void 0 && limit === 0) { return []; }
if (typeof separator === 'undefined' && limit === 0) { return []; }
return string_split.call(this, separator, limit);

@@ -1439,3 +1430,3 @@ };

trim: function trim() {
if (this === void 0 || this === null) {
if (typeof this === 'undefined' || this === null) {
throw new TypeError("can't convert " + this + ' to object');

@@ -1449,2 +1440,3 @@ }

if (parseInt(ws + '08') !== 8 || parseInt(ws + '0x16') !== 22) {
/*global parseInt: true */
parseInt = (function (origParseInt) {

@@ -1451,0 +1443,0 @@ var hexRegex = /^0[xX]/;

@@ -11,3 +11,18 @@ /*!

(function (undefined) {
// UMD (Universal Module Definition)
// see https://github.com/umdjs/umd/blob/master/returnExports.js
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(factory);
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like enviroments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.returnExports = factory();
}
}(this, function (undefined) {
'use strict';

@@ -19,97 +34,88 @@

var main = function () {
var globals = getGlobal();
var Object = globals.Object;
var globals = getGlobal();
var Object = globals.Object;
// NOTE: This versions needs object ownership
// beacuse every promoted object needs to be reassigned
// otherwise uncompatible browsers cannot work as expected
//
// NOTE: This might need es5-shim or polyfills upfront
// because it's based on ES5 API.
// (probably just an IE <= 8 problem)
//
// NOTE: nodejs is fine in version 0.8, 0.10, and future versions.
(function () {
if (Object.setPrototypeOf) { return; }
// NOTE: This versions needs object ownership
// beacuse every promoted object needs to be reassigned
// otherwise uncompatible browsers cannot work as expected
//
// NOTE: This might need es5-shim or polyfills upfront
// because it's based on ES5 API.
// (probably just an IE <= 8 problem)
//
// NOTE: nodejs is fine in version 0.8, 0.10, and future versions.
(function () {
if (Object.setPrototypeOf) { return; }
/*jshint proto: true */
// @author Andrea Giammarchi - @WebReflection
// define into target descriptors from source
var copyDescriptors = function (target, source) {
getOwnPropertyNames(source).forEach(function (key) {
defineProperty(
target,
key,
getOwnPropertyDescriptor(source, key)
);
});
return target;
/*jshint proto: true */
// @author Andrea Giammarchi - @WebReflection
// define into target descriptors from source
var copyDescriptors = function (target, source) {
getOwnPropertyNames(source).forEach(function (key) {
defineProperty(
target,
key,
getOwnPropertyDescriptor(source, key)
);
});
return target;
};
// used as fallback when no promotion is possible
var createAndCopy = function (origin, proto) {
return copyDescriptors(create(proto), origin);
};
var create = Object.create;
var defineProperty = Object.defineProperty;
var getPrototypeOf = Object.getPrototypeOf;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var proto = Object.prototype;
var set, setPrototypeOf;
try {
// this might fail for various reasons
// ignore if Chrome cought it at runtime
set = getOwnPropertyDescriptor(proto, '__proto__').set;
set.call({}, null);
// setter not poisoned, it can promote
// Firefox, Chrome
setPrototypeOf = function (origin, proto) {
set.call(origin, proto);
return origin;
};
// used as fallback when no promotion is possible
var createAndCopy = function (origin, proto) {
return copyDescriptors(create(proto), origin);
};
var create = Object.create;
var defineProperty = Object.defineProperty;
var getPrototypeOf = Object.getPrototypeOf;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var proto = Object.prototype;
var set, setPrototypeOf;
try {
// this might fail for various reasons
// ignore if Chrome cought it at runtime
set = getOwnPropertyDescriptor(proto, '__proto__').set;
set.call({}, null);
// setter not poisoned, it can promote
// Firefox, Chrome
setPrototypeOf = function (origin, proto) {
set.call(origin, proto);
return origin;
};
} catch (e) {
// do one or more feature detections
set = {__proto__: null};
// if proto does not work, needs to fallback
// some Opera, Rhino, ducktape
} catch (e) {
// do one or more feature detections
set = {__proto__: null};
// if proto does not work, needs to fallback
// some Opera, Rhino, ducktape
if (set instanceof Object) {
setPrototypeOf = createAndCopy;
} else {
// verify if null objects are buggy
set.__proto__ = proto;
// if null objects are buggy
// nodejs 0.8 to 0.10
if (set instanceof Object) {
setPrototypeOf = createAndCopy;
setPrototypeOf = function (origin, proto) {
// use such bug to promote
origin.__proto__ = proto;
return origin;
};
} else {
// verify if null objects are buggy
set.__proto__ = proto;
// if null objects are buggy
// nodejs 0.8 to 0.10
if (set instanceof Object) {
setPrototypeOf = function (origin, proto) {
// use such bug to promote
origin.__proto__ = proto;
return origin;
};
} else {
// try to use proto or fallback
// Safari, old Firefox, many others
setPrototypeOf = function (origin, proto) {
// if proto is not null
return getPrototypeOf(origin) ?
// use __proto__ to promote
((origin.__proto__ = proto), origin) :
// otherwise unable to promote: fallback
createAndCopy(origin, proto);
};
}
// try to use proto or fallback
// Safari, old Firefox, many others
setPrototypeOf = function (origin, proto) {
// if proto is not null
return getPrototypeOf(origin) ?
// use __proto__ to promote
((origin.__proto__ = proto), origin) :
// otherwise unable to promote: fallback
createAndCopy(origin, proto);
};
}
}
Object.setPrototypeOf = setPrototypeOf;
}());
}
Object.setPrototypeOf = setPrototypeOf;
}());
};
}));
if (typeof define === 'function' && define.amd) {
define(main); // RequireJS
} else {
main(); // CommonJS and <script>
}
}());

Sorry, the diff of this file is too big to display

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