зеркало из https://github.com/nextcloud/news.git
update es6 shim
This commit is contained in:
Родитель
ec700890c0
Коммит
104cf2afe0
|
@ -27,12 +27,12 @@
|
|||
"test"
|
||||
],
|
||||
"homepage": "https://github.com/paulmillr/es6-shim",
|
||||
"version": "0.33.8",
|
||||
"_release": "0.33.8",
|
||||
"version": "0.33.12",
|
||||
"_release": "0.33.12",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.33.8",
|
||||
"commit": "bdc0510b2db1366713f084c1d2d2fde4b1500f0e"
|
||||
"tag": "0.33.12",
|
||||
"commit": "2fc76e7c759cbc1643722bc21132e246f935d4e1"
|
||||
},
|
||||
"_source": "git://github.com/paulmillr/es6-shim.git",
|
||||
"_target": "~0.*",
|
||||
|
|
|
@ -1,5 +1,35 @@
|
|||
# es6-shim x.x.x (not yet released)
|
||||
|
||||
# es6-shim 0.33.12 (11 Nov 2015)
|
||||
* [Fix] IE 8: more NFE madness.
|
||||
* [Dev Deps] update `es5-shim`
|
||||
* [Docs] removing now-fixed `Number` caveat
|
||||
* [Docs] use assertions so `evalmd` will test the readme better.
|
||||
* [Docs] fix incorrect isFinite note (#373)
|
||||
|
||||
# es6-shim 0.33.11 (9 Nov 2015)
|
||||
* [Fix] handle future change of RegExp.prototype not being a regex (#370, #371)
|
||||
* [Fix] disallow invalid hex strings in `Number` (#369)
|
||||
* [Tests] Tweak "polluted prototype" approach
|
||||
* [Dev Deps] update `chai`, `es5-shim`, `eslint`, `@ljharb/eslint-config`, `jscs`
|
||||
|
||||
# es6-shim 0.33.10 (2 Nov 2015)
|
||||
* [Fix] the `Number` constructor properly trims (or not) whitespace characters (#368)
|
||||
* [Fix] `Number('0b12')` and `Number('0o18')` should both be `NaN` (#366)
|
||||
* [Tests] Fix npm upgrades in older nodes
|
||||
* [Tests] add `npm run tests-only`
|
||||
* [Tests] on `node` `v5.0`
|
||||
* [Tests] ensure `JSON.stringify` has the right name
|
||||
* [Tests] add `npm run eslint`
|
||||
* [Dev Deps] update `es5-shim`, `jscs`
|
||||
* [Cleanup] Rearrange things so that they’re defined before they’re used
|
||||
* [Cleanup] Don't reassign to function or catch parameters
|
||||
* [Cleanup] Remove unused variables
|
||||
* [Refactor] String#trim shim should use `defineProperty`, and check more non-whitespace chars
|
||||
|
||||
# es6-shim 0.33.9 (29 Oct 2015)
|
||||
* [Fix] IE 8: `Number(new Number(1))` was throwing. More NFE madness. (#365)
|
||||
|
||||
# es6-shim 0.33.8 (23 Oct 2015)
|
||||
* [Fix] IE 8: `Promise.resolve(2)` was throwing. More named function expression madness.
|
||||
* [Tests] Reflect: Don't attempt to define properties on this test object unless we're in true ES5.
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = function (grunt) {
|
||||
var browsers = [
|
||||
{ browserName: "firefox", version: "19", platform: "XP" },
|
||||
{ browserName: "firefox", platform: "linux" },
|
||||
{ browserName: "firefox", platform: "OS X 10.10" },
|
||||
{ browserName: "chrome", platform: "linux" },
|
||||
{ browserName: "chrome", platform: "OS X 10.9" },
|
||||
{ browserName: "chrome", platform: "XP" },
|
||||
{ browserName: "internet explorer", platform: "Windows 8.1", version: "11" },
|
||||
{ browserName: "internet explorer", platform: "WIN8", version: "10" },
|
||||
{ browserName: "internet explorer", platform: "VISTA", version: "9" },
|
||||
{ browserName: 'firefox', version: '19', platform: 'XP' },
|
||||
{ browserName: 'firefox', platform: 'linux' },
|
||||
{ browserName: 'firefox', platform: 'OS X 10.10' },
|
||||
{ browserName: 'chrome', platform: 'linux' },
|
||||
{ browserName: 'chrome', platform: 'OS X 10.9' },
|
||||
{ browserName: 'chrome', platform: 'XP' },
|
||||
{ browserName: 'internet explorer', platform: 'Windows 8.1', version: '11' },
|
||||
{ browserName: 'internet explorer', platform: 'WIN8', version: '10' },
|
||||
{ browserName: 'internet explorer', platform: 'VISTA', version: '9' },
|
||||
{ browserName: 'safari', platform: 'OS X 10.6' },
|
||||
{ browserName: 'safari', platform: 'OS X 10.8' },
|
||||
{ browserName: 'safari', platform: 'OS X 10.9' },
|
||||
|
@ -17,16 +19,16 @@ module.exports = function (grunt) {
|
|||
{ browserName: 'android', platform: 'Linux', version: '4.4' },
|
||||
];
|
||||
var extraBrowsers = [
|
||||
{ browserName: "firefox", platform: "linux", version: "30" },
|
||||
{ browserName: "firefox", platform: "linux", version: "25" },
|
||||
{ browserName: 'firefox', platform: 'linux', version: '30' },
|
||||
{ browserName: 'firefox', platform: 'linux', version: '25' },
|
||||
{ browserName: 'iphone', platform: 'OS X 10.8', version: '6.1' },
|
||||
{ browserName: 'iphone', platform: 'OS X 10.8', version: '5.1' },
|
||||
{ browserName: 'android', platform: 'Linux', version: '4.2' },
|
||||
// XXX haven't investigated these:
|
||||
//{ browserName: "opera", platform: "Windows 7", version: "12" },
|
||||
//{ browserName: "opera", platform: "Windows 2008", version: "12" }
|
||||
//{ browserName: 'iphone', platform: 'OS X 10.6', version: '4.3' },
|
||||
//{ browserName: 'android', platform: 'Linux', version: '4.0' },
|
||||
// { browserName: 'opera', platform: 'Windows 7', version: '12' },
|
||||
// { browserName: 'opera', platform: 'Windows 2008', version: '12' }
|
||||
// { browserName: 'iphone', platform: 'OS X 10.6', version: '4.3' },
|
||||
// { browserName: 'android', platform: 'Linux', version: '4.0' },
|
||||
];
|
||||
if (grunt.option('extra')) {
|
||||
browsers = browsers.concat(extraBrowsers);
|
||||
|
@ -35,7 +37,7 @@ module.exports = function (grunt) {
|
|||
connect: {
|
||||
server: {
|
||||
options: {
|
||||
base: "",
|
||||
base: '',
|
||||
port: 9999,
|
||||
useAvailablePort: true
|
||||
}
|
||||
|
@ -45,56 +47,52 @@ module.exports = function (grunt) {
|
|||
all: {
|
||||
options: {
|
||||
urls: (function () {
|
||||
var urls = ["http://localhost:9999/test/"];
|
||||
var urls = ['http://localhost:9999/test/'];
|
||||
if (grunt.option('extra')) {
|
||||
urls.push("http://localhost:9999/test-sham/");
|
||||
urls.push('http://localhost:9999/test-sham/');
|
||||
}
|
||||
return urls;
|
||||
}()),
|
||||
//tunnelTimeout: 5,
|
||||
// tunnelTimeout: 5,
|
||||
build: process.env.TRAVIS_BUILD_NUMBER,
|
||||
tunneled: !process.env.SAUCE_HAS_TUNNEL,
|
||||
identifier: process.env.TRAVIS_JOB_NUMBER,
|
||||
sauceConfig: {
|
||||
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER
|
||||
},
|
||||
//concurrency: 3,
|
||||
// concurrency: 3,
|
||||
browsers: browsers,
|
||||
testname: (function () {
|
||||
var testname = "mocha";
|
||||
if (process.env.TRAVIS_PULL_REQUEST &&
|
||||
process.env.TRAVIS_PULL_REQUEST !== 'false') {
|
||||
testname += ' (PR '+process.env.TRAVIS_PULL_REQUEST+')';
|
||||
var testname = 'mocha';
|
||||
if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST !== 'false') {
|
||||
testname += ' (PR ' + process.env.TRAVIS_PULL_REQUEST + ')';
|
||||
}
|
||||
if (process.env.TRAVIS_BRANCH &&
|
||||
process.env.TRAVIS_BRANCH !== 'false') {
|
||||
testname += ' (branch '+process.env.TRAVIS_BRANCH+')';
|
||||
if (process.env.TRAVIS_BRANCH && process.env.TRAVIS_BRANCH !== 'false') {
|
||||
testname += ' (branch ' + process.env.TRAVIS_BRANCH + ')';
|
||||
}
|
||||
return testname;
|
||||
})(),
|
||||
}()),
|
||||
tags: (function () {
|
||||
var tags = [];
|
||||
if (process.env.TRAVIS_PULL_REQUEST &&
|
||||
process.env.TRAVIS_PULL_REQUEST !== 'false') {
|
||||
tags.push('PR-'+process.env.TRAVIS_PULL_REQUEST);
|
||||
if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST !== 'false') {
|
||||
tags.push('PR-' + process.env.TRAVIS_PULL_REQUEST);
|
||||
}
|
||||
if (process.env.TRAVIS_BRANCH &&
|
||||
process.env.TRAVIS_BRANCH !== 'false') {
|
||||
if (process.env.TRAVIS_BRANCH && process.env.TRAVIS_BRANCH !== 'false') {
|
||||
tags.push(process.env.TRAVIS_BRANCH);
|
||||
}
|
||||
return tags;
|
||||
})()
|
||||
}())
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {}
|
||||
});
|
||||
// Loading dependencies
|
||||
for (var key in grunt.file.readJSON("package.json").devDependencies) {
|
||||
if (key !== "grunt" && key.indexOf("grunt") === 0) {
|
||||
for (var key in grunt.file.readJSON('package.json').devDependencies) {
|
||||
if (key !== 'grunt' && key.indexOf('grunt') === 0) {
|
||||
grunt.loadNpmTasks(key);
|
||||
}
|
||||
}
|
||||
grunt.registerTask("dev", ["connect", "watch"]);
|
||||
grunt.registerTask("sauce", ["connect", "saucelabs-mocha"]);
|
||||
grunt.registerTask('dev', ['connect', 'watch']);
|
||||
grunt.registerTask('sauce', ['connect', 'saucelabs-mocha']);
|
||||
};
|
||||
|
|
|
@ -156,27 +156,43 @@ The [es6-collections](https://github.com/WebReflection/es6-collections) implemen
|
|||
## Getting started
|
||||
|
||||
```javascript
|
||||
var assert = require('assert');
|
||||
require('es6-shim');
|
||||
var assert = require('assert');
|
||||
|
||||
'abc'.startsWith('a'); // true
|
||||
'abc'.endsWith('a'); // false
|
||||
'john alice'.includes('john'); // true
|
||||
'123'.repeat(2); // '123123'
|
||||
assert.equal(true, 'abc'.startsWith('a'));
|
||||
assert.equal(false, 'abc'.endsWith('a'));
|
||||
assert.equal(true, 'john alice'.includes('john'));
|
||||
assert.equal('123'.repeat(2), '123123');
|
||||
|
||||
Object.is(NaN, NaN); // Fixes ===. 0 isnt -0, NaN is NaN
|
||||
Object.assign({a: 1}, {b: 2}); // {a: 1, b: 2}
|
||||
assert.equal(false, NaN === NaN);
|
||||
assert.equal(true, Object.is(NaN, NaN));
|
||||
assert.equal(true, -0 === 0);
|
||||
assert.equal(false, Object.is(-0, 0));
|
||||
|
||||
var result = Object.assign({ a: 1 }, { b: 2 });
|
||||
assert.deepEqual(result, { a: 1, b: 2 });
|
||||
|
||||
assert.equal(true, isNaN('a'));
|
||||
assert.equal(false, Number.isNaN('a'));
|
||||
assert.equal(true, Number.isNaN(NaN));
|
||||
|
||||
assert.equal(true, isFinite('123'));
|
||||
assert.equal(false, Number.isFinite('123'));
|
||||
assert.equal(false, Number.isFinite(Infinity));
|
||||
|
||||
Number.isNaN('123'); // false. Global isNaN('123') will give true.
|
||||
Number.isFinite('asd'); // false. Global isFinite() will give true.
|
||||
// Tests if value is a number, finite,
|
||||
// >= -9007199254740992 && <= 9007199254740992 and floor(value) === value
|
||||
Number.isInteger(2.4); // false.
|
||||
assert.equal(false, Number.isInteger(2.4));
|
||||
|
||||
Math.sign(400); // 1, 0 or -1 depending on sign. In this case 1.
|
||||
assert.equal(1, Math.sign(400));
|
||||
assert.equal(0, Math.sign(0));
|
||||
assert.equal(-1, Math.sign(-400));
|
||||
|
||||
[5, 10, 15, 10].find(function (item) { return item / 2 === 5; }); // 10
|
||||
[5, 10, 15, 10].findIndex(function (item) { return item / 2 === 5; }); // 1
|
||||
var found = [5, 10, 15, 10].find(function (item) { return item / 2 === 5; });
|
||||
assert.equal(10, found);
|
||||
|
||||
var foundIndex = [5, 10, 15, 10].findIndex(function (item) { return item / 2 === 5; });
|
||||
assert.equal(1, foundIndex);
|
||||
|
||||
// Replacement for `{}` key-value storage.
|
||||
// Keys can be anything.
|
||||
|
@ -184,30 +200,35 @@ var map = new Map([['Bob', 42], ['Foo', 'bar']]);
|
|||
map.set('John', 25);
|
||||
map.set('Alice', 400);
|
||||
map.set(['meh'], 555);
|
||||
assert(map.get(['meh']) === undefined); // undefined because you need to use exactly the same object.
|
||||
assert.equal(undefined, map.get(['meh'])); // undefined because you need to use exactly the same object.
|
||||
map.delete('Alice');
|
||||
map.keys();
|
||||
map.values();
|
||||
assert(map.size === 4);
|
||||
assert.equal(4, map.size);
|
||||
|
||||
// Useful for storing unique items.
|
||||
var set = new Set([0, 1]);
|
||||
set.add(2);
|
||||
set.add(5);
|
||||
assert(set.has(0) === true);
|
||||
assert(set.has(1) === true);
|
||||
assert(set.has(2) === true);
|
||||
assert(set.has(4) === false);
|
||||
assert.equal(true, set.has(0));
|
||||
assert.equal(true, set.has(1));
|
||||
assert.equal(true, set.has(2));
|
||||
assert.equal(false, set.has(4));
|
||||
assert.equal(true, set.has(5));
|
||||
set.delete(5);
|
||||
assert.equal(false, set.has(5));
|
||||
|
||||
// Promises, see
|
||||
// http://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript
|
||||
// https://github.com/petkaantonov/bluebird/#what-are-promises-and-why-should-i-use-them
|
||||
Promise.resolve(5).then(function (value) {
|
||||
if (value) throw new Error("whoops!");
|
||||
assert.equal(value, 5);
|
||||
if (value) throw new Error('whoops!');
|
||||
// do some stuff
|
||||
return anotherPromise();
|
||||
}).catch(function (e) {
|
||||
assert.equal(e.message, 'whoops!');
|
||||
assert.equal(true, e instanceof Error);
|
||||
// any errors thrown asynchronously end up here
|
||||
});
|
||||
```
|
||||
|
@ -216,12 +237,6 @@ Promise.resolve(5).then(function (value) {
|
|||
|
||||
- `Object.setPrototypeOf` / `Reflect.setPrototypeOf`
|
||||
- Note that null objects (`Object.create(null)`, eg, an object with `null` as its `[[Prototype]]`) can not have their `[[Prototype]]` changed except via a native `Object.setPrototypeOf`.
|
||||
- `Number`:
|
||||
- In order to support binary literals (`Number('0b1')`) and octal literals (`Number('0o7')`), the global `Number` constructor is wrapped in a shim. However, this can cause issues in the exceedingly unlikely event that you ever call `Number` as a function with a receiver (a “this” value) that is itself a number. Some problematic examples:
|
||||
```js
|
||||
assert(typeof Number.call(2, 3) === 'number'); // will fail when `Number` is wrapped, is "object"
|
||||
assert(typeof (1).constructor(2) === 'number'); // will fail when `Number` is wrapped, is "object"
|
||||
```
|
||||
|
||||
## [License][license-url]
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "es6-shim",
|
||||
"version": "0.33.8",
|
||||
"version": "0.33.12",
|
||||
"repo": "paulmillr/es6-shim",
|
||||
"description": "ECMAScript 6 (Harmony) compatibility shims for legacy JavaScript engines",
|
||||
"keywords": [
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* https://github.com/paulmillr/es6-shim
|
||||
* @license es6-shim Copyright 2013-2015 by Paul Miller (http://paulmillr.com)
|
||||
* and contributors, MIT License
|
||||
* es6-sham: v0.33.8
|
||||
* see https://github.com/paulmillr/es6-shim/blob/0.33.8/LICENSE
|
||||
* es6-sham: v0.33.12
|
||||
* see https://github.com/paulmillr/es6-shim/blob/0.33.12/LICENSE
|
||||
* Details and documentation:
|
||||
* https://github.com/paulmillr/es6-shim/
|
||||
*/
|
||||
|
@ -28,7 +28,9 @@
|
|||
'use strict';
|
||||
|
||||
/*jshint evil: true */
|
||||
/* eslint-disable no-new-func */
|
||||
var getGlobal = new Function('return this;');
|
||||
/* eslint-enable no-new-func */
|
||||
/*jshint evil: false */
|
||||
|
||||
var globals = getGlobal();
|
||||
|
@ -85,20 +87,24 @@
|
|||
};
|
||||
} catch (e) {
|
||||
// do one or more feature detections
|
||||
set = {__proto__: null};
|
||||
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
|
||||
/* eslint-disable no-proto */
|
||||
set.__proto__ = objProto;
|
||||
/* eslint-enable no-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
|
||||
/* eslint-disable no-proto */
|
||||
origin.__proto__ = proto;
|
||||
/* eslint-enable no-proto */
|
||||
return origin;
|
||||
};
|
||||
} else {
|
||||
|
@ -108,7 +114,9 @@
|
|||
// if proto is not null
|
||||
if (getPrototypeOf(origin)) {
|
||||
// use __proto__ to promote
|
||||
/* eslint-disable no-proto */
|
||||
origin.__proto__ = proto;
|
||||
/* eslint-enable no-proto */
|
||||
return origin;
|
||||
} else {
|
||||
// otherwise unable to promote: fallback
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"sources":["es6-sham.js"],"names":["root","factory","define","amd","exports","module","returnExports","this","getGlobal","Function","globals","Object","setPrototypeOf","getOwnPropertyNames","getOwnPropertyDescriptor","create","defineProperty","getPrototypeOf","objProto","prototype","copyDescriptors","target","source","forEach","key","createAndCopy","origin","proto","set","call","e","__proto__"],"mappings":";;;;;;;;;CAYC,SAAUA,EAAMC,GAEf,SAAWC,UAAW,YAAcA,OAAOC,IAAK,CAE9CD,OAAOD,OACF,UAAWG,WAAY,SAAU,CAItCC,OAAOD,QAAUH,QACZ,CAELD,EAAKM,cAAgBL,OAEvBM,KAAM,WACN,YAGA,IAAIC,GAAY,GAAIC,UAAS,eAG7B,IAAIC,GAAUF,GACd,IAAIG,GAASD,EAAQC,QAWpB,WACC,GAAIA,EAAOC,eAAgB,CAAE,OAK7B,GAAIC,GAAsBF,EAAOE,mBACjC,IAAIC,GAA2BH,EAAOG,wBACtC,IAAIC,GAASJ,EAAOI,MACpB,IAAIC,GAAiBL,EAAOK,cAC5B,IAAIC,GAAiBN,EAAOM,cAC5B,IAAIC,GAAWP,EAAOQ,SAEtB,IAAIC,GAAkB,SAAUC,EAAQC,GAEtCT,EAAoBS,GAAQC,QAAQ,SAAUC,GAC5CR,EACEK,EACAG,EACAV,EAAyBQ,EAAQE,KAGrC,OAAOH,GAGT,IAAII,GAAgB,SAAUC,EAAQC,GACpC,MAAOP,GAAgBL,EAAOY,GAAQD,GAExC,IAAIE,GAAKhB,CACT,KAGEgB,EAAMd,EAAyBI,EAAU,aAAaU,GACtDA,GAAIC,QAAS,KAGbjB,GAAiB,SAAUc,EAAQC,GACjCC,EAAIC,KAAKH,EAAQC,EACjB,OAAOD,IAET,MAAOI,GAEPF,GAAOG,UAAW,KAGlB,IAAIH,YAAejB,GAAQ,CACzBC,EAAiBa,MACZ,CAELG,EAAIG,UAAYb,CAGhB,IAAIU,YAAejB,GAAQ,CACzBC,EAAiB,SAAUc,EAAQC,GAEjCD,EAAOK,UAAYJ,CACnB,OAAOD,QAEJ,CAGLd,EAAiB,SAAUc,EAAQC,GAEjC,GAAIV,EAAeS,GAAS,CAE1BA,EAAOK,UAAYJ,CACnB,OAAOD,OACF,CAEL,MAAOD,GAAcC,EAAQC,OAMvChB,EAAOC,eAAiBA"}
|
||||
{"version":3,"sources":["es6-sham.js"],"names":["root","factory","define","amd","exports","module","returnExports","this","getGlobal","Function","globals","Object","setPrototypeOf","getOwnPropertyNames","getOwnPropertyDescriptor","create","defineProperty","getPrototypeOf","objProto","prototype","copyDescriptors","target","source","forEach","key","createAndCopy","origin","proto","set","call","e","__proto__"],"mappings":";;;;;;;;;CAYC,SAAUA,EAAMC,GAEf,SAAWC,UAAW,YAAcA,OAAOC,IAAK,CAE9CD,OAAOD,OACF,UAAWG,WAAY,SAAU,CAItCC,OAAOD,QAAUH,QACZ,CAELD,EAAKM,cAAgBL,OAEvBM,KAAM,WACN,YAIA,IAAIC,GAAY,GAAIC,UAAS,eAI7B,IAAIC,GAAUF,GACd,IAAIG,GAASD,EAAQC,QAWpB,WACC,GAAIA,EAAOC,eAAgB,CAAE,OAK7B,GAAIC,GAAsBF,EAAOE,mBACjC,IAAIC,GAA2BH,EAAOG,wBACtC,IAAIC,GAASJ,EAAOI,MACpB,IAAIC,GAAiBL,EAAOK,cAC5B,IAAIC,GAAiBN,EAAOM,cAC5B,IAAIC,GAAWP,EAAOQ,SAEtB,IAAIC,GAAkB,SAAUC,EAAQC,GAEtCT,EAAoBS,GAAQC,QAAQ,SAAUC,GAC5CR,EACEK,EACAG,EACAV,EAAyBQ,EAAQE,KAGrC,OAAOH,GAGT,IAAII,GAAgB,SAAUC,EAAQC,GACpC,MAAOP,GAAgBL,EAAOY,GAAQD,GAExC,IAAIE,GAAKhB,CACT,KAGEgB,EAAMd,EAAyBI,EAAU,aAAaU,GACtDA,GAAIC,QAAS,KAGbjB,GAAiB,SAAUc,EAAQC,GACjCC,EAAIC,KAAKH,EAAQC,EACjB,OAAOD,IAET,MAAOI,GAEPF,GAAQG,UAAW,KAGnB,IAAIH,YAAejB,GAAQ,CACzBC,EAAiBa,MACZ,CAGLG,EAAIG,UAAYb,CAIhB,IAAIU,YAAejB,GAAQ,CACzBC,EAAiB,SAAUc,EAAQC,GAGjCD,EAAOK,UAAYJ,CAEnB,OAAOD,QAEJ,CAGLd,EAAiB,SAAUc,EAAQC,GAEjC,GAAIV,EAAeS,GAAS,CAG1BA,EAAOK,UAAYJ,CAEnB,OAAOD,OACF,CAEL,MAAOD,GAAcC,EAAQC,OAMvChB,EAAOC,eAAiBA"}
|
|
@ -2,8 +2,8 @@
|
|||
* https://github.com/paulmillr/es6-shim
|
||||
* @license es6-shim Copyright 2013-2015 by Paul Miller (http://paulmillr.com)
|
||||
* and contributors, MIT License
|
||||
* es6-sham: v0.33.8
|
||||
* see https://github.com/paulmillr/es6-shim/blob/0.33.8/LICENSE
|
||||
* es6-sham: v0.33.12
|
||||
* see https://github.com/paulmillr/es6-shim/blob/0.33.12/LICENSE
|
||||
* Details and documentation:
|
||||
* https://github.com/paulmillr/es6-shim/
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* https://github.com/paulmillr/es6-shim
|
||||
* @license es6-shim Copyright 2013-2015 by Paul Miller (http://paulmillr.com)
|
||||
* and contributors, MIT License
|
||||
* es6-shim: v0.33.8
|
||||
* see https://github.com/paulmillr/es6-shim/blob/0.33.8/LICENSE
|
||||
* es6-shim: v0.33.12
|
||||
* see https://github.com/paulmillr/es6-shim/blob/0.33.12/LICENSE
|
||||
* Details and documentation:
|
||||
* https://github.com/paulmillr/es6-shim/
|
||||
*/
|
||||
|
@ -61,26 +61,8 @@
|
|||
var _forEach = Function.call.bind(Array.prototype.forEach);
|
||||
var _reduce = Function.call.bind(Array.prototype.reduce);
|
||||
var _filter = Function.call.bind(Array.prototype.filter);
|
||||
var _every = Function.call.bind(Array.prototype.every);
|
||||
var _some = Function.call.bind(Array.prototype.some);
|
||||
|
||||
var createDataProperty = function createDataProperty(object, name, value) {
|
||||
if (supportsDescriptors) {
|
||||
Object.defineProperty(object, name, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: value
|
||||
});
|
||||
} else {
|
||||
object[name] = value;
|
||||
}
|
||||
};
|
||||
var createDataPropertyOrThrow = function createDataPropertyOrThrow(object, name, value) {
|
||||
createDataProperty(object, name, value);
|
||||
if (!ES.SameValue(object[name], value)) {
|
||||
throw new TypeError('property is nonconfigurable');
|
||||
}
|
||||
};
|
||||
var defineProperty = function (object, name, value, force) {
|
||||
if (!force && name in object) { return; }
|
||||
if (supportsDescriptors) {
|
||||
|
@ -135,6 +117,7 @@
|
|||
};
|
||||
|
||||
var getGlobal = function () {
|
||||
/* global self, window, global */
|
||||
// the only reliable means to get the global object is
|
||||
// `Function('return this')()`
|
||||
// However, this causes CSP violations in Chrome apps.
|
||||
|
@ -146,7 +129,6 @@
|
|||
|
||||
var globals = getGlobal();
|
||||
var globalIsFinite = globals.isFinite;
|
||||
var hasStrictMode = (function () { return this === null; }.call(null));
|
||||
var _indexOf = Function.call.bind(String.prototype.indexOf);
|
||||
var _toString = Function.call.bind(Object.prototype.toString);
|
||||
var _concat = Function.call.bind(Array.prototype.concat);
|
||||
|
@ -167,89 +149,6 @@
|
|||
var Symbol = globals.Symbol || {};
|
||||
var symbolSpecies = Symbol.species || '@@species';
|
||||
|
||||
var Value = {
|
||||
getter: function (object, name, getter) {
|
||||
if (!supportsDescriptors) {
|
||||
throw new TypeError('getters require true ES5 support');
|
||||
}
|
||||
Object.defineProperty(object, name, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
get: getter
|
||||
});
|
||||
},
|
||||
proxy: function (originalObject, key, targetObject) {
|
||||
if (!supportsDescriptors) {
|
||||
throw new TypeError('getters require true ES5 support');
|
||||
}
|
||||
var originalDescriptor = Object.getOwnPropertyDescriptor(originalObject, key);
|
||||
Object.defineProperty(targetObject, key, {
|
||||
configurable: originalDescriptor.configurable,
|
||||
enumerable: originalDescriptor.enumerable,
|
||||
get: function getKey() { return originalObject[key]; },
|
||||
set: function setKey(value) { originalObject[key] = value; }
|
||||
});
|
||||
},
|
||||
redefine: function (object, property, newValue) {
|
||||
if (supportsDescriptors) {
|
||||
var descriptor = Object.getOwnPropertyDescriptor(object, property);
|
||||
descriptor.value = newValue;
|
||||
Object.defineProperty(object, property, descriptor);
|
||||
} else {
|
||||
object[property] = newValue;
|
||||
}
|
||||
},
|
||||
defineByDescriptor: function (object, property, descriptor) {
|
||||
if (supportsDescriptors) {
|
||||
Object.defineProperty(object, property, descriptor);
|
||||
} else if ('value' in descriptor) {
|
||||
object[property] = descriptor.value;
|
||||
}
|
||||
},
|
||||
preserveToString: function (target, source) {
|
||||
if (source && ES.IsCallable(source.toString)) {
|
||||
defineProperty(target, 'toString', source.toString.bind(source), true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var wrapConstructor = function wrapConstructor(original, replacement, keysToSkip) {
|
||||
Value.preserveToString(replacement, original);
|
||||
if (Object.setPrototypeOf) {
|
||||
// sets up proper prototype chain where possible
|
||||
Object.setPrototypeOf(original, replacement);
|
||||
}
|
||||
if (supportsDescriptors) {
|
||||
_forEach(Object.getOwnPropertyNames(original), function (key) {
|
||||
if (key in noop || keysToSkip[key]) { return; }
|
||||
Value.proxy(original, key, replacement);
|
||||
});
|
||||
} else {
|
||||
_forEach(Object.keys(original), function (key) {
|
||||
if (key in noop || keysToSkip[key]) { return; }
|
||||
replacement[key] = original[key];
|
||||
});
|
||||
}
|
||||
replacement.prototype = original.prototype;
|
||||
Value.redefine(original.prototype, 'constructor', replacement);
|
||||
};
|
||||
|
||||
var defaultSpeciesGetter = function () { return this; };
|
||||
var addDefaultSpecies = function (C) {
|
||||
if (supportsDescriptors && !_hasOwnProperty(C, symbolSpecies)) {
|
||||
Value.getter(C, symbolSpecies, defaultSpeciesGetter);
|
||||
}
|
||||
};
|
||||
var Type = {
|
||||
primitive: function (x) { return x === null || (typeof x !== 'function' && typeof x !== 'object'); },
|
||||
object: function (x) { return x !== null && typeof x === 'object'; },
|
||||
string: function (x) { return _toString(x) === '[object String]'; },
|
||||
regex: function (x) { return _toString(x) === '[object RegExp]'; },
|
||||
symbol: function (x) {
|
||||
return typeof globals.Symbol === 'function' && typeof x === 'symbol';
|
||||
}
|
||||
};
|
||||
|
||||
var numberIsNaN = Number.isNaN || function isNaN(value) {
|
||||
// NaN !== NaN, but they are identical.
|
||||
// NaNs are the only non-reflexive value, i.e., if x !== x,
|
||||
|
@ -262,33 +161,6 @@
|
|||
return typeof value === 'number' && globalIsFinite(value);
|
||||
};
|
||||
|
||||
var overrideNative = function overrideNative(object, property, replacement) {
|
||||
var original = object[property];
|
||||
defineProperty(object, property, replacement, true);
|
||||
Value.preserveToString(object[property], original);
|
||||
};
|
||||
|
||||
// This is a private name in the es6 spec, equal to '[Symbol.iterator]'
|
||||
// we're going to use an arbitrary _-prefixed name to make our shims
|
||||
// work properly with each other, even though we don't have full Iterator
|
||||
// support. That is, `Array.from(map.keys())` will work, but we don't
|
||||
// pretend to export a "real" Iterator interface.
|
||||
var $iterator$ = Type.symbol(Symbol.iterator) ? Symbol.iterator : '_es6-shim iterator_';
|
||||
// Firefox ships a partial implementation using the name @@iterator.
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14
|
||||
// So use that name if we detect it.
|
||||
if (globals.Set && typeof new globals.Set()['@@iterator'] === 'function') {
|
||||
$iterator$ = '@@iterator';
|
||||
}
|
||||
var addIterator = function (prototype, impl) {
|
||||
var implementation = impl || function iterator() { return this; };
|
||||
defineProperty(prototype, $iterator$, implementation);
|
||||
if (!prototype[$iterator$] && Type.symbol($iterator$)) {
|
||||
// implementations are buggy when $iterator$ is a Symbol
|
||||
prototype[$iterator$] = implementation;
|
||||
}
|
||||
};
|
||||
|
||||
// taken directly from https://github.com/ljharb/is-arguments/blob/master/index.js
|
||||
// can be replaced with require('is-arguments') if we ever use a build process instead
|
||||
var isStandardArguments = function isArguments(value) {
|
||||
|
@ -304,6 +176,35 @@
|
|||
};
|
||||
var isArguments = isStandardArguments(arguments) ? isStandardArguments : isLegacyArguments;
|
||||
|
||||
var Type = {
|
||||
primitive: function (x) { return x === null || (typeof x !== 'function' && typeof x !== 'object'); },
|
||||
object: function (x) { return x !== null && typeof x === 'object'; },
|
||||
string: function (x) { return _toString(x) === '[object String]'; },
|
||||
regex: function (x) { return _toString(x) === '[object RegExp]'; },
|
||||
symbol: function (x) {
|
||||
return typeof globals.Symbol === 'function' && typeof x === 'symbol';
|
||||
}
|
||||
};
|
||||
|
||||
// This is a private name in the es6 spec, equal to '[Symbol.iterator]'
|
||||
// we're going to use an arbitrary _-prefixed name to make our shims
|
||||
// work properly with each other, even though we don't have full Iterator
|
||||
// support. That is, `Array.from(map.keys())` will work, but we don't
|
||||
// pretend to export a "real" Iterator interface.
|
||||
var $iterator$ = Type.symbol(Symbol.iterator) ? Symbol.iterator : '_es6-shim iterator_';
|
||||
// Firefox ships a partial implementation using the name @@iterator.
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14
|
||||
// So use that name if we detect it.
|
||||
if (globals.Set && typeof new globals.Set()['@@iterator'] === 'function') {
|
||||
$iterator$ = '@@iterator';
|
||||
}
|
||||
|
||||
// Reflect
|
||||
if (!globals.Reflect) {
|
||||
defineProperty(globals, 'Reflect', {});
|
||||
}
|
||||
var Reflect = globals.Reflect;
|
||||
|
||||
var ES = {
|
||||
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-call-f-v-args
|
||||
Call: function Call(F, V) {
|
||||
|
@ -459,19 +360,18 @@
|
|||
},
|
||||
|
||||
Construct: function (C, args, newTarget, isES6internal) {
|
||||
if (newTarget === void 0) {
|
||||
newTarget = C;
|
||||
}
|
||||
var target = typeof newTarget === 'undefined' ? C : newTarget;
|
||||
|
||||
if (!isES6internal) {
|
||||
// Try to use Reflect.construct if available
|
||||
return Reflect.construct(C, args, newTarget);
|
||||
return Reflect.construct(C, args, target);
|
||||
}
|
||||
// OK, we have to fake it. This will only work if the
|
||||
// C.[[ConstructorKind]] == "base" -- but that's the only
|
||||
// kind we can make in ES5 code anyway.
|
||||
|
||||
// OrdinaryCreateFromConstructor(newTarget, "%ObjectPrototype%")
|
||||
var proto = newTarget.prototype;
|
||||
// OrdinaryCreateFromConstructor(target, "%ObjectPrototype%")
|
||||
var proto = target.prototype;
|
||||
if (!ES.TypeIsObject(proto)) {
|
||||
proto = Object.prototype;
|
||||
}
|
||||
|
@ -513,6 +413,114 @@
|
|||
}
|
||||
};
|
||||
|
||||
var Value = {
|
||||
getter: function (object, name, getter) {
|
||||
if (!supportsDescriptors) {
|
||||
throw new TypeError('getters require true ES5 support');
|
||||
}
|
||||
Object.defineProperty(object, name, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
get: getter
|
||||
});
|
||||
},
|
||||
proxy: function (originalObject, key, targetObject) {
|
||||
if (!supportsDescriptors) {
|
||||
throw new TypeError('getters require true ES5 support');
|
||||
}
|
||||
var originalDescriptor = Object.getOwnPropertyDescriptor(originalObject, key);
|
||||
Object.defineProperty(targetObject, key, {
|
||||
configurable: originalDescriptor.configurable,
|
||||
enumerable: originalDescriptor.enumerable,
|
||||
get: function getKey() { return originalObject[key]; },
|
||||
set: function setKey(value) { originalObject[key] = value; }
|
||||
});
|
||||
},
|
||||
redefine: function (object, property, newValue) {
|
||||
if (supportsDescriptors) {
|
||||
var descriptor = Object.getOwnPropertyDescriptor(object, property);
|
||||
descriptor.value = newValue;
|
||||
Object.defineProperty(object, property, descriptor);
|
||||
} else {
|
||||
object[property] = newValue;
|
||||
}
|
||||
},
|
||||
defineByDescriptor: function (object, property, descriptor) {
|
||||
if (supportsDescriptors) {
|
||||
Object.defineProperty(object, property, descriptor);
|
||||
} else if ('value' in descriptor) {
|
||||
object[property] = descriptor.value;
|
||||
}
|
||||
},
|
||||
preserveToString: function (target, source) {
|
||||
if (source && ES.IsCallable(source.toString)) {
|
||||
defineProperty(target, 'toString', source.toString.bind(source), true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var wrapConstructor = function wrapConstructor(original, replacement, keysToSkip) {
|
||||
Value.preserveToString(replacement, original);
|
||||
if (Object.setPrototypeOf) {
|
||||
// sets up proper prototype chain where possible
|
||||
Object.setPrototypeOf(original, replacement);
|
||||
}
|
||||
if (supportsDescriptors) {
|
||||
_forEach(Object.getOwnPropertyNames(original), function (key) {
|
||||
if (key in noop || keysToSkip[key]) { return; }
|
||||
Value.proxy(original, key, replacement);
|
||||
});
|
||||
} else {
|
||||
_forEach(Object.keys(original), function (key) {
|
||||
if (key in noop || keysToSkip[key]) { return; }
|
||||
replacement[key] = original[key];
|
||||
});
|
||||
}
|
||||
replacement.prototype = original.prototype;
|
||||
Value.redefine(original.prototype, 'constructor', replacement);
|
||||
};
|
||||
|
||||
var defaultSpeciesGetter = function () { return this; };
|
||||
var addDefaultSpecies = function (C) {
|
||||
if (supportsDescriptors && !_hasOwnProperty(C, symbolSpecies)) {
|
||||
Value.getter(C, symbolSpecies, defaultSpeciesGetter);
|
||||
}
|
||||
};
|
||||
|
||||
var overrideNative = function overrideNative(object, property, replacement) {
|
||||
var original = object[property];
|
||||
defineProperty(object, property, replacement, true);
|
||||
Value.preserveToString(object[property], original);
|
||||
};
|
||||
|
||||
var addIterator = function (prototype, impl) {
|
||||
var implementation = impl || function iterator() { return this; };
|
||||
defineProperty(prototype, $iterator$, implementation);
|
||||
if (!prototype[$iterator$] && Type.symbol($iterator$)) {
|
||||
// implementations are buggy when $iterator$ is a Symbol
|
||||
prototype[$iterator$] = implementation;
|
||||
}
|
||||
};
|
||||
|
||||
var createDataProperty = function createDataProperty(object, name, value) {
|
||||
if (supportsDescriptors) {
|
||||
Object.defineProperty(object, name, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: value
|
||||
});
|
||||
} else {
|
||||
object[name] = value;
|
||||
}
|
||||
};
|
||||
var createDataPropertyOrThrow = function createDataPropertyOrThrow(object, name, value) {
|
||||
createDataProperty(object, name, value);
|
||||
if (!ES.SameValue(object[name], value)) {
|
||||
throw new TypeError('property is nonconfigurable');
|
||||
}
|
||||
};
|
||||
|
||||
var emulateES6construct = function (o, defaultNewTarget, defaultProto, slots) {
|
||||
// This is an es5 approximation to es6 construct semantics. in es6,
|
||||
// 'new Foo' invokes Foo.[[Construct]] which (for almost all objects)
|
||||
|
@ -531,14 +539,14 @@
|
|||
if (!ES.TypeIsObject(proto)) {
|
||||
proto = defaultProto;
|
||||
}
|
||||
o = create(proto);
|
||||
var obj = create(proto);
|
||||
for (var name in slots) {
|
||||
if (_hasOwnProperty(slots, name)) {
|
||||
var value = slots[name];
|
||||
defineProperty(o, name, value, true);
|
||||
defineProperty(obj, name, value, true);
|
||||
}
|
||||
}
|
||||
return o;
|
||||
return obj;
|
||||
};
|
||||
|
||||
// Firefox 31 reports this function's length as 0
|
||||
|
@ -591,7 +599,7 @@
|
|||
next = nextIndex + 1 < arguments.length ? arguments[nextIndex + 1] : '';
|
||||
nextSub = String(next);
|
||||
_push(stringElements, nextSub);
|
||||
nextIndex++;
|
||||
nextIndex += 1;
|
||||
}
|
||||
return stringElements.join('');
|
||||
}
|
||||
|
@ -695,26 +703,25 @@
|
|||
|
||||
defineProperties(String.prototype, StringPrototypeShims);
|
||||
|
||||
var hasStringTrimBug = '\u0085'.trim().length !== 1;
|
||||
if (hasStringTrimBug) {
|
||||
delete String.prototype.trim;
|
||||
// whitespace from: http://es5.github.io/#x15.5.4.20
|
||||
// implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324
|
||||
var ws = [
|
||||
'\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003',
|
||||
'\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028',
|
||||
'\u2029\uFEFF'
|
||||
].join('');
|
||||
var trimRegexp = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g');
|
||||
defineProperties(String.prototype, {
|
||||
trim: function trim() {
|
||||
if (typeof this === 'undefined' || this === null) {
|
||||
throw new TypeError("can't convert " + this + ' to object');
|
||||
}
|
||||
return String(this).replace(trimRegexp, '');
|
||||
}
|
||||
});
|
||||
}
|
||||
// whitespace from: http://es5.github.io/#x15.5.4.20
|
||||
// implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324
|
||||
var ws = [
|
||||
'\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003',
|
||||
'\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028',
|
||||
'\u2029\uFEFF'
|
||||
].join('');
|
||||
var trimRegexp = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g');
|
||||
var trimShim = function trim() {
|
||||
if (typeof this === 'undefined' || this === null) {
|
||||
throw new TypeError("can't convert " + this + ' to object');
|
||||
}
|
||||
return String(this).replace(trimRegexp, '');
|
||||
};
|
||||
var nonWS = ['\u0085', '\u200b', '\ufffe'].join('');
|
||||
var nonWSregex = new RegExp('[' + nonWS + ']', 'g');
|
||||
var isBadHexRegex = /^[\-+]0x[0-9a-f]+$/i;
|
||||
var hasStringTrimBug = nonWS.trim().length !== nonWS.length;
|
||||
defineProperty(String.prototype, 'trim', trimShim, hasStringTrimBug);
|
||||
|
||||
// see https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype-@@iterator
|
||||
var StringIterator = function (s) {
|
||||
|
@ -760,10 +767,10 @@
|
|||
|
||||
// Note that that Arrays will use ArrayIterator:
|
||||
// https://bugs.ecmascript.org/show_bug.cgi?id=2416
|
||||
var usingIterator = isArguments(items) || ES.GetMethod(items, $iterator$);
|
||||
var usingIterator = typeof (isArguments(items) || ES.GetMethod(items, $iterator$)) !== 'undefined';
|
||||
|
||||
var length, result, i;
|
||||
if (usingIterator !== void 0) {
|
||||
if (usingIterator) {
|
||||
result = ES.IsConstructor(C) ? Object(new C()) : [];
|
||||
var iterator = ES.GetIterator(items);
|
||||
var next, nextValue;
|
||||
|
@ -777,7 +784,7 @@
|
|||
nextValue = next.value;
|
||||
try {
|
||||
if (mapping) {
|
||||
nextValue = T !== undefined ? _call(mapFn, T, nextValue, i) : mapFn(nextValue, i);
|
||||
nextValue = T === undefined ? mapFn(nextValue, i) : _call(mapFn, T, nextValue, i);
|
||||
}
|
||||
result[i] = nextValue;
|
||||
} catch (e) {
|
||||
|
@ -862,14 +869,6 @@
|
|||
});
|
||||
addIterator(ArrayIterator.prototype);
|
||||
|
||||
var ObjectIterator = function (object, kind) {
|
||||
defineProperties(this, {
|
||||
object: object,
|
||||
array: getAllKeys(object),
|
||||
kind: kind
|
||||
});
|
||||
};
|
||||
|
||||
var getAllKeys = function getAllKeys(object) {
|
||||
var keys = [];
|
||||
|
||||
|
@ -880,6 +879,14 @@
|
|||
return keys;
|
||||
};
|
||||
|
||||
var ObjectIterator = function (object, kind) {
|
||||
defineProperties(this, {
|
||||
object: object,
|
||||
array: getAllKeys(object),
|
||||
kind: kind
|
||||
});
|
||||
};
|
||||
|
||||
defineProperties(ObjectIterator.prototype, {
|
||||
next: function next() {
|
||||
var key;
|
||||
|
@ -1137,10 +1144,15 @@
|
|||
}, true);
|
||||
}
|
||||
|
||||
if (Number('0o10') !== 8 || Number('0b10') !== 2) {
|
||||
var lacksOctalSupport = Number('0o10') !== 8;
|
||||
var lacksBinarySupport = Number('0b10') !== 2;
|
||||
var trimsNonWhitespace = _some(nonWS, function (c) {
|
||||
return Number(c + 0 + c) === 0;
|
||||
});
|
||||
if (lacksOctalSupport || lacksBinarySupport || trimsNonWhitespace) {
|
||||
var OrigNumber = Number;
|
||||
var binaryRegex = /^0b/i;
|
||||
var octalRegex = /^0o/i;
|
||||
var binaryRegex = /^0b[01]+$/i;
|
||||
var octalRegex = /^0o[0-7]+$/i;
|
||||
// Note that in IE 8, RegExp.prototype.test doesn't seem to exist: ie, "test" is an own property of regexes. wtf.
|
||||
var isBinary = binaryRegex.test.bind(binaryRegex);
|
||||
var isOctal = octalRegex.test.bind(octalRegex);
|
||||
|
@ -1160,34 +1172,43 @@
|
|||
}
|
||||
throw new TypeError('No default value');
|
||||
};
|
||||
var hasNonWS = nonWSregex.test.bind(nonWSregex);
|
||||
var isBadHex = isBadHexRegex.test.bind(isBadHexRegex);
|
||||
var NumberShim = (function () {
|
||||
// this is wrapped in an IIFE because of IE 6-8's wacky scoping issues with named function expressions.
|
||||
return function Number(value) {
|
||||
var NumberShim = function Number(value) {
|
||||
var primValue = Type.primitive(value) ? value : toPrimitive(value, 'number');
|
||||
if (typeof primValue === 'string') {
|
||||
if (isBinary(primValue)) {
|
||||
primValue = parseInt(_strSlice(primValue, 2), 2);
|
||||
} else if (isOctal(primValue)) {
|
||||
primValue = parseInt(_strSlice(primValue, 2), 8);
|
||||
} else if (hasNonWS(primValue) || isBadHex(primValue)) {
|
||||
primValue = NaN;
|
||||
} else {
|
||||
primValue = _call(trimShim, primValue);
|
||||
}
|
||||
}
|
||||
var receiver = this;
|
||||
var valueOfSucceeds = valueOrFalseIfThrows(function () {
|
||||
Number.prototype.valueOf.call(receiver);
|
||||
OrigNumber.prototype.valueOf.call(receiver);
|
||||
return true;
|
||||
});
|
||||
if (receiver instanceof Number && !valueOfSucceeds) {
|
||||
if (receiver instanceof NumberShim && !valueOfSucceeds) {
|
||||
return new OrigNumber(primValue);
|
||||
}
|
||||
/* jshint newcap: false */
|
||||
return OrigNumber(primValue);
|
||||
/* jshint newcap: true */
|
||||
};
|
||||
return NumberShim;
|
||||
}());
|
||||
wrapConstructor(OrigNumber, NumberShim, {});
|
||||
/*globals Number: true */
|
||||
/* eslint-disable no-undef */
|
||||
Number = NumberShim;
|
||||
Value.redefine(globals, 'Number', NumberShim);
|
||||
/* eslint-enable no-undef */
|
||||
/*globals Number: false */
|
||||
}
|
||||
|
||||
|
@ -1220,12 +1241,14 @@
|
|||
// implementations of find/findIndex indirectly use shimmed
|
||||
// methods of Number, so this test has to happen down here.)
|
||||
/*jshint elision: true */
|
||||
/* eslint-disable no-sparse-arrays */
|
||||
if (![, 1].find(function (item, idx) { return idx === 0; })) {
|
||||
overrideNative(Array.prototype, 'find', ArrayPrototypeShims.find);
|
||||
}
|
||||
if ([, 1].findIndex(function (item, idx) { return idx === 0; }) !== 0) {
|
||||
overrideNative(Array.prototype, 'findIndex', ArrayPrototypeShims.findIndex);
|
||||
}
|
||||
/* eslint-enable no-sparse-arrays */
|
||||
/*jshint elision: false */
|
||||
|
||||
var isEnumerableOn = Function.bind.call(Function.bind, Object.prototype.propertyIsEnumerable);
|
||||
|
@ -1468,7 +1491,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (!RegExp.prototype.flags && supportsDescriptors) {
|
||||
var hasFlags = supportsDescriptors && (function () {
|
||||
var desc = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags');
|
||||
return desc && ES.IsCallable(desc.get);
|
||||
}());
|
||||
if (supportsDescriptors && !hasFlags) {
|
||||
var regExpFlagsGetter = function flags() {
|
||||
if (!ES.TypeIsObject(this)) {
|
||||
throw new TypeError('Method called on incompatible type: must be an object.');
|
||||
|
@ -1501,22 +1528,26 @@
|
|||
|
||||
if (!regExpSupportsFlagsWithRegex && supportsDescriptors) {
|
||||
var OrigRegExp = RegExp;
|
||||
var RegExpShim = function RegExp(pattern, flags) {
|
||||
var calledWithNew = this instanceof RegExp;
|
||||
if (!calledWithNew && (Type.regex(pattern) || (pattern && pattern.constructor === RegExp))) {
|
||||
return pattern;
|
||||
}
|
||||
if (Type.regex(pattern) && Type.string(flags)) {
|
||||
return new RegExp(pattern.source, flags);
|
||||
}
|
||||
return new OrigRegExp(pattern, flags);
|
||||
};
|
||||
var RegExpShim = (function () {
|
||||
return function RegExp(pattern, flags) {
|
||||
var calledWithNew = this instanceof RegExp;
|
||||
if (!calledWithNew && (Type.regex(pattern) || (pattern && pattern.constructor === RegExp))) {
|
||||
return pattern;
|
||||
}
|
||||
if (Type.regex(pattern) && Type.string(flags)) {
|
||||
return new RegExp(pattern.source, flags);
|
||||
}
|
||||
return new OrigRegExp(pattern, flags);
|
||||
};
|
||||
}());
|
||||
wrapConstructor(OrigRegExp, RegExpShim, {
|
||||
$input: true // Chrome < v39 & Opera < 26 have a nonstandard "$input" property
|
||||
});
|
||||
/*globals RegExp: true */
|
||||
/* eslint-disable no-undef */
|
||||
RegExp = RegExpShim;
|
||||
Value.redefine(globals, 'RegExp', RegExpShim);
|
||||
/* eslint-enable no-undef */
|
||||
/*globals RegExp: false */
|
||||
}
|
||||
|
||||
|
@ -1975,6 +2006,7 @@
|
|||
return C;
|
||||
};
|
||||
|
||||
var Promise$prototype;
|
||||
var Promise = (function () {
|
||||
var PromiseShim = function Promise(resolver) {
|
||||
if (!(this instanceof PromiseShim)) {
|
||||
|
@ -2006,7 +2038,7 @@
|
|||
};
|
||||
return PromiseShim;
|
||||
}());
|
||||
var Promise$prototype = Promise.prototype;
|
||||
Promise$prototype = Promise.prototype;
|
||||
|
||||
var _promiseAllResolver = function (index, values, capability, remaining) {
|
||||
var alreadyCalled = false;
|
||||
|
@ -2042,7 +2074,7 @@
|
|||
var resolveElement = _promiseAllResolver(
|
||||
index, values, resultCapability, remaining
|
||||
);
|
||||
remaining.count++;
|
||||
remaining.count += 1;
|
||||
nextPromise.then(resolveElement, resultCapability.reject);
|
||||
index += 1;
|
||||
}
|
||||
|
@ -2087,15 +2119,16 @@
|
|||
iteratorRecord = { iterator: iterator, done: false };
|
||||
return performPromiseAll(iteratorRecord, C, capability);
|
||||
} catch (e) {
|
||||
var exception = e;
|
||||
if (iteratorRecord && !iteratorRecord.done) {
|
||||
try {
|
||||
ES.IteratorClose(iterator, true);
|
||||
} catch (ee) {
|
||||
e = ee;
|
||||
exception = ee;
|
||||
}
|
||||
}
|
||||
var reject = capability.reject;
|
||||
reject(e);
|
||||
reject(exception);
|
||||
return capability.promise;
|
||||
}
|
||||
},
|
||||
|
@ -2109,15 +2142,16 @@
|
|||
iteratorRecord = { iterator: iterator, done: false };
|
||||
return performPromiseRace(iteratorRecord, C, capability);
|
||||
} catch (e) {
|
||||
var exception = e;
|
||||
if (iteratorRecord && !iteratorRecord.done) {
|
||||
try {
|
||||
ES.IteratorClose(iterator, true);
|
||||
} catch (ee) {
|
||||
e = ee;
|
||||
exception = ee;
|
||||
}
|
||||
}
|
||||
var reject = capability.reject;
|
||||
reject(e);
|
||||
reject(exception);
|
||||
return capability.promise;
|
||||
}
|
||||
},
|
||||
|
@ -2155,15 +2189,16 @@
|
|||
var C = ES.SpeciesConstructor(promise, Promise);
|
||||
var resultCapability = new PromiseCapability(C);
|
||||
// PerformPromiseThen(promise, onFulfilled, onRejected, resultCapability)
|
||||
if (!ES.IsCallable(onFulfilled)) {
|
||||
onFulfilled = PROMISE_IDENTITY;
|
||||
}
|
||||
if (!ES.IsCallable(onRejected)) {
|
||||
onRejected = PROMISE_THROWER;
|
||||
}
|
||||
var fulfillReaction = { capabilities: resultCapability, handler: onFulfilled };
|
||||
var rejectReaction = { capabilities: resultCapability, handler: onRejected };
|
||||
var _promise = promise._promise, value;
|
||||
var fulfillReaction = {
|
||||
capabilities: resultCapability,
|
||||
handler: ES.IsCallable(onFulfilled) ? onFulfilled : PROMISE_IDENTITY
|
||||
};
|
||||
var rejectReaction = {
|
||||
capabilities: resultCapability,
|
||||
handler: ES.IsCallable(onRejected) ? onRejected : PROMISE_THROWER
|
||||
};
|
||||
var _promise = promise._promise;
|
||||
var value;
|
||||
if (_promise.state === PROMISE_PENDING) {
|
||||
_push(_promise.fulfillReactions, fulfillReaction);
|
||||
_push(_promise.rejectReactions, rejectReaction);
|
||||
|
@ -2219,7 +2254,9 @@
|
|||
if (!promiseSupportsSubclassing || !promiseIgnoresNonFunctionThenCallbacks ||
|
||||
!promiseRequiresObjectContext || promiseResolveBroken) {
|
||||
/*globals Promise: true */
|
||||
/* eslint-disable no-undef */
|
||||
Promise = PromiseShim;
|
||||
/* eslint-enable no-undef */
|
||||
/*globals Promise: false */
|
||||
overrideNative(globals, 'Promise', PromiseShim);
|
||||
}
|
||||
|
@ -2399,6 +2436,7 @@
|
|||
};
|
||||
addIterator(MapIterator.prototype);
|
||||
|
||||
var Map$prototype;
|
||||
var MapShim = function Map() {
|
||||
if (!(this instanceof Map)) {
|
||||
throw new TypeError('Constructor Map requires "new"');
|
||||
|
@ -2424,7 +2462,7 @@
|
|||
}
|
||||
return map;
|
||||
};
|
||||
var Map$prototype = MapShim.prototype;
|
||||
Map$prototype = MapShim.prototype;
|
||||
|
||||
Value.getter(Map$prototype, 'size', function () {
|
||||
if (typeof this._size === 'undefined') {
|
||||
|
@ -2589,6 +2627,7 @@
|
|||
// Sets containing only string or numeric keys, we use an object
|
||||
// as backing storage and lazily create a full Map only when
|
||||
// required.
|
||||
var Set$prototype;
|
||||
var SetShim = function Set() {
|
||||
if (!(this instanceof Set)) {
|
||||
throw new TypeError('Constructor Set requires "new"');
|
||||
|
@ -2611,13 +2650,14 @@
|
|||
}
|
||||
return set;
|
||||
};
|
||||
var Set$prototype = SetShim.prototype;
|
||||
Set$prototype = SetShim.prototype;
|
||||
|
||||
// Switch from the object backing storage to a full Map.
|
||||
var ensureMap = function ensureMap(set) {
|
||||
if (!set['[[SetData]]']) {
|
||||
var m = set['[[SetData]]'] = new collectionShims.Map();
|
||||
_forEach(Object.keys(set._storage), function (k) {
|
||||
_forEach(Object.keys(set._storage), function (key) {
|
||||
var k = key;
|
||||
if (k === '^null') {
|
||||
k = null;
|
||||
} else if (k === '^undefined') {
|
||||
|
@ -2915,12 +2955,6 @@
|
|||
addDefaultSpecies(globals.Set);
|
||||
}
|
||||
|
||||
// Reflect
|
||||
if (!globals.Reflect) {
|
||||
defineProperty(globals, 'Reflect', {});
|
||||
}
|
||||
var Reflect = globals.Reflect;
|
||||
|
||||
var throwUnlessTargetIsObject = function throwUnlessTargetIsObject(target) {
|
||||
if (!ES.TypeIsObject(target)) {
|
||||
throw new TypeError('target must be an object');
|
||||
|
@ -2942,7 +2976,7 @@
|
|||
if (!ES.IsConstructor(constructor)) {
|
||||
throw new TypeError('First argument must be a constructor.');
|
||||
}
|
||||
var newTarget = (arguments.length < 3) ? constructor : arguments[2];
|
||||
var newTarget = arguments.length < 3 ? constructor : arguments[2];
|
||||
if (!ES.IsConstructor(newTarget)) {
|
||||
throw new TypeError('new.target must be a constructor.');
|
||||
}
|
||||
|
@ -3132,7 +3166,8 @@
|
|||
}
|
||||
|
||||
if (Object.setPrototypeOf && ReflectShims.getPrototypeOf) {
|
||||
var willCreateCircularPrototype = function (object, proto) {
|
||||
var willCreateCircularPrototype = function (object, lastProto) {
|
||||
var proto = lastProto;
|
||||
while (proto) {
|
||||
if (object === proto) {
|
||||
return true;
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "es6-shim",
|
||||
"version": "0.33.8",
|
||||
"version": "0.33.12",
|
||||
"author": "Paul Miller (http://paulmillr.com)",
|
||||
"description": "ECMAScript 6 (Harmony) compatibility shims for legacy JavaScript engines",
|
||||
"keywords": [
|
||||
|
@ -23,13 +23,17 @@
|
|||
},
|
||||
"main": "es6-shim",
|
||||
"scripts": {
|
||||
"test": "npm run lint && evalmd *.md && npm run test-shim && npm run test-sham",
|
||||
"test": "npm run lint && evalmd *.md && npm run tests-only",
|
||||
"tests-only": "npm run test-shim && npm run test-sham",
|
||||
"test-shim": "mocha test/*.js test/*/*.js",
|
||||
"test-sham": "mocha test-sham/*.js",
|
||||
"test-native": "npm run jshint-shim && NO_ES6_SHIM=1 mocha test/*.js test/*/*.js",
|
||||
"lint": "npm run lint-shim && npm run lint-sham",
|
||||
"lint-shim": "npm run jshint-shim && npm run jscs-shim",
|
||||
"lint-sham": "npm run jshint-sham && npm run jscs-sham",
|
||||
"lint-shim": "npm run jshint-shim && npm run jscs-shim && npm run eslint-shim",
|
||||
"lint-sham": "npm run jshint-sham && npm run jscs-sham && npm run eslint-sham",
|
||||
"eslint": "npm run eslint-shim && npm run eslint-sham",
|
||||
"eslint-shim": "eslint es6-shim.js test/*.js test/*/*.js",
|
||||
"eslint-sham": "eslint es6-sham.js test-sham/*.js",
|
||||
"jshint": "npm run jshint-shim && npm run jshint-sham",
|
||||
"jshint-shim": "jshint es6-shim.js test/*.js test/*/*.js",
|
||||
"jshint-sham": "jshint es6-sham.js test-sham/*.js",
|
||||
|
@ -63,13 +67,15 @@
|
|||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"chai": "^3.4.0",
|
||||
"es5-shim": "^4.1.15",
|
||||
"chai": "^3.4.1",
|
||||
"es5-shim": "^4.3.1",
|
||||
"eslint": "^1.9.0",
|
||||
"@ljharb/eslint-config": "^1.6.0",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-contrib-connect": "^0.11.2",
|
||||
"grunt-contrib-watch": "^0.6.1",
|
||||
"grunt-saucelabs": "^8.6.1",
|
||||
"jscs": "^2.3.5",
|
||||
"jscs": "^2.5.1",
|
||||
"jshint": "^2.8.0",
|
||||
"mocha": "^2.3.3",
|
||||
"promises-aplus-tests": "^2.1.1",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*global expect */
|
||||
/* global expect, describe, it */
|
||||
|
||||
describe('Object.setPrototypeOf(o, p)', function () {
|
||||
'use strict';
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче