var isImplemented = function () {
var set, iterator, result;
- if (typeof Set !== 'function') return false;
+ if (typeof Set !== 'function') { return false; }
set = new Set(['raz', 'dwa', 'trzy']);
- if (String(set) !== '[object Set]') return false;
- if (set.size !== 3) return false;
- if (typeof set.add !== 'function') return false;
- if (typeof set.clear !== 'function') return false;
- if (typeof set.delete !== 'function') return false;
- if (typeof set.entries !== 'function') return false;
- if (typeof set.forEach !== 'function') return false;
- if (typeof set.has !== 'function') return false;
- if (typeof set.keys !== 'function') return false;
- if (typeof set.values !== 'function') return false;
+ if (String(set) !== '[object Set]') { return false; }
+ if (set.size !== 3) { return false; }
+ if (typeof set.add !== 'function') { return false; }
+ if (typeof set.clear !== 'function') { return false; }
+ if (typeof set.delete !== 'function') { return false; }
+ if (typeof set.entries !== 'function') { return false; }
+ if (typeof set.forEach !== 'function') { return false; }
+ if (typeof set.has !== 'function') { return false; }
+ if (typeof set.keys !== 'function') { return false; }
+ if (typeof set.values !== 'function') { return false; }
iterator = set.values();
result = iterator.next();
- if (result.done !== false) return false;
- if (result.value !== 'raz') return false;
+ if (result.done !== false) { return false; }
+ if (result.value !== 'raz') { return false; }
return true;
};
var _undefined = noop(); // Support ES3 engines
- var isValue = function (val) {
- return (val !== _undefined) && (val !== null);
- };
+ var isValue = function (val) { return val !== _undefined && val !== null; };
var validValue = function (value) {
- if (!isValue(value)) throw new TypeError("Cannot use null or undefined");
+ if (!isValue(value)) { throw new TypeError("Cannot use null or undefined"); }
return value;
};
var isImplemented$1 = function () {
var numberIsNaN = Number.isNaN;
- if (typeof numberIsNaN !== "function") return false;
+ if (typeof numberIsNaN !== "function") { return false; }
return !numberIsNaN({}) && numberIsNaN(NaN) && !numberIsNaN(34);
};
return value !== value;
};
- var isNan = isImplemented$1()
- ? Number.isNaN
- : shim;
+ var isNan = isImplemented$1() ? Number.isNaN : shim;
var isImplemented$2 = function () {
var sign = Math.sign;
- if (typeof sign !== "function") return false;
- return (sign(10) === 1) && (sign(-20) === -1);
+ if (typeof sign !== "function") { return false; }
+ return sign(10) === 1 && sign(-20) === -1;
};
var shim$1 = function (value) {
value = Number(value);
- if (isNaN(value) || (value === 0)) return value;
+ if (isNaN(value) || value === 0) { return value; }
return value > 0 ? 1 : -1;
};
- var sign = isImplemented$2()
- ? Math.sign
- : shim$1;
+ var sign = isImplemented$2() ? Math.sign : shim$1;
- var abs = Math.abs, floor = Math.floor;
+ var abs = Math.abs
+ , floor = Math.floor;
var toInteger = function (value) {
- if (isNaN(value)) return 0;
+ if (isNaN(value)) { return 0; }
value = Number(value);
- if ((value === 0) || !isFinite(value)) return value;
+ if (value === 0 || !isFinite(value)) { return value; }
return sign(value) * floor(abs(value));
};
- var max = Math.max;
+ var max = Math.max;
- var toPosInteger = function (value) {
- return max(0, toInteger(value));
- };
+ var toPosInteger = function (value) { return max(0, toInteger(value)); };
var indexOf = Array.prototype.indexOf
, objHasOwnProperty = Object.prototype.hasOwnProperty
, abs$1 = Math.abs
, floor$1 = Math.floor;
- var eIndexOf = function (searchElement /*, fromIndex*/) {
+ var eIndexOf = function (searchElement/*, fromIndex*/) {
var i, length, fromIndex, val;
- if (!isNan(searchElement)) return indexOf.apply(this, arguments);
+ if (!isNan(searchElement)) { return indexOf.apply(this, arguments); }
length = toPosInteger(validValue(this).length);
fromIndex = arguments[1];
- if (isNaN(fromIndex)) fromIndex = 0;
- else if (fromIndex >= 0) fromIndex = floor$1(fromIndex);
- else fromIndex = toPosInteger(this.length) - floor$1(abs$1(fromIndex));
+ if (isNaN(fromIndex)) { fromIndex = 0; }
+ else if (fromIndex >= 0) { fromIndex = floor$1(fromIndex); }
+ else { fromIndex = toPosInteger(this.length) - floor$1(abs$1(fromIndex)); }
for (i = fromIndex; i < length; ++i) {
if (objHasOwnProperty.call(this, i)) {
val = this[i];
- if (isNan(val)) return i; // Jslint: ignore
+ if (isNan(val)) { return i; } // Jslint: ignore
}
}
return -1;
var isImplemented$3 = function (/* CustomCreate*/) {
var setPrototypeOf = Object.setPrototypeOf, customCreate = arguments[0] || create;
- if (typeof setPrototypeOf !== "function") return false;
+ if (typeof setPrototypeOf !== "function") { return false; }
return getPrototypeOf(setPrototypeOf(customCreate(null), plainObject)) === plainObject;
};
var map = { function: true, object: true };
- var isObject = function (value) {
- return (isValue(value) && map[typeof value]) || false;
- };
+ var isObject = function (value) { return (isValue(value) && map[typeof value]) || false; };
var create$1 = Object.create, shim$2;
var create_1 = (function () {
var nullObject, polyProps, desc;
- if (!shim$2) return create$1;
- if (shim$2.level !== 1) return create$1;
+ if (!shim$2) { return create$1; }
+ if (shim$2.level !== 1) { return create$1; }
nullObject = {};
polyProps = {};
- desc = {
- configurable: false,
- enumerable: false,
- writable: true,
- value: undefined
- };
+ desc = { configurable: false, enumerable: false, writable: true, value: undefined };
Object.getOwnPropertyNames(Object.prototype).forEach(function (name) {
if (name === "__proto__") {
polyProps[name] = {
return function (prototype, props) {
return create$1(prototype === null ? nullObject : prototype, props);
};
- }());
+ })();
var objIsPrototypeOf = Object.prototype.isPrototypeOf
- , defineProperty = Object.defineProperty
- , nullDesc = {
- configurable: true,
- enumerable: false,
- writable: true,
- value: undefined
- }
+ , defineProperty = Object.defineProperty
+ , nullDesc = { configurable: true, enumerable: false, writable: true, value: undefined }
, validate;
validate = function (obj, prototype) {
validValue(obj);
- if (prototype === null || isObject(prototype)) return obj;
+ if (prototype === null || isObject(prototype)) { return obj; }
throw new TypeError("Prototype must be null or an object");
};
var shim$3 = (function (status) {
var fn, set;
- if (!status) return null;
+ if (!status) { return null; }
if (status.level === 2) {
if (status.set) {
set = status.set;
var isNullBase;
validate(obj, prototype);
isNullBase = objIsPrototypeOf.call(self.nullPolyfill, obj);
- if (isNullBase) delete self.nullPolyfill.__proto__;
- if (prototype === null) prototype = self.nullPolyfill;
+ if (isNullBase) { delete self.nullPolyfill.__proto__; }
+ if (prototype === null) { prototype = self.nullPolyfill; }
obj.__proto__ = prototype;
- if (isNullBase) defineProperty(self.nullPolyfill, "__proto__", nullDesc);
+ if (isNullBase) { defineProperty(self.nullPolyfill, "__proto__", nullDesc); }
return obj;
};
}
writable: false,
value: status.level
});
- }(
+ })(
(function () {
var tmpObj1 = Object.create(null)
, tmpObj2 = {}
set = desc.set; // Opera crashes at this point
set.call(tmpObj1, tmpObj2);
} catch (ignore) {}
- if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return { set: set, level: 2 };
+ if (Object.getPrototypeOf(tmpObj1) === tmpObj2) { return { set: set, level: 2 }; }
}
tmpObj1.__proto__ = tmpObj2;
- if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return { level: 2 };
+ if (Object.getPrototypeOf(tmpObj1) === tmpObj2) { return { level: 2 }; }
tmpObj1 = {};
tmpObj1.__proto__ = tmpObj2;
- if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return { level: 1 };
+ if (Object.getPrototypeOf(tmpObj1) === tmpObj2) { return { level: 1 }; }
return false;
})()
- ));
+ );
- var setPrototypeOf = isImplemented$3()
- ? Object.setPrototypeOf
- : shim$3;
+ var setPrototypeOf = isImplemented$3() ? Object.setPrototypeOf : shim$3;
var validCallable = function (fn) {
- if (typeof fn !== "function") throw new TypeError(fn + " is not a function");
+ if (typeof fn !== "function") { throw new TypeError(fn + " is not a function"); }
return fn;
};
+ // ES3 safe
+ var _undefined$1 = void 0;
+
+ var is = function (value) { return value !== _undefined$1 && value !== null; };
+
+ // prettier-ignore
+ var possibleTypes = { "object": true, "function": true, "undefined": true /* document.all */ };
+
+ var is$1 = function (value) {
+ if (!is(value)) { return false; }
+ return hasOwnProperty.call(possibleTypes, typeof value);
+ };
+
+ var is$2 = function (value) {
+ if (!is$1(value)) { return false; }
+ try {
+ if (!value.constructor) { return false; }
+ return value.constructor.prototype === value;
+ } catch (error) {
+ return false;
+ }
+ };
+
+ var is$3 = function (value) {
+ if (typeof value !== "function") { return false; }
+
+ if (!hasOwnProperty.call(value, "length")) { return false; }
+
+ try {
+ if (typeof value.length !== "number") { return false; }
+ if (typeof value.call !== "function") { return false; }
+ if (typeof value.apply !== "function") { return false; }
+ } catch (error) {
+ return false;
+ }
+
+ return !is$2(value);
+ };
+
+ var classRe = /^\s*class[\s{/}]/, functionToString = Function.prototype.toString;
+
+ var is$4 = function (value) {
+ if (!is$3(value)) { return false; }
+ if (classRe.test(functionToString.call(value))) { return false; }
+ return true;
+ };
+
var isImplemented$4 = function () {
var assign = Object.assign, obj;
- if (typeof assign !== "function") return false;
+ if (typeof assign !== "function") { return false; }
obj = { foo: "raz" };
assign(obj, { bar: "dwa" }, { trzy: "trzy" });
- return (obj.foo + obj.bar + obj.trzy) === "razdwatrzy";
+ return obj.foo + obj.bar + obj.trzy === "razdwatrzy";
};
var isImplemented$5 = function () {
var max$1 = Math.max;
- var shim$5 = function (dest, src /*, …srcn*/) {
+ var shim$5 = function (dest, src/*, …srcn*/) {
+ var arguments$1 = arguments;
+
var error, i, length = max$1(arguments.length, 2), assign;
dest = Object(validValue(dest));
assign = function (key) {
try {
dest[key] = src[key];
} catch (e) {
- if (!error) error = e;
+ if (!error) { error = e; }
}
};
for (i = 1; i < length; ++i) {
- src = arguments[i];
+ src = arguments$1[i];
keys$1(src).forEach(assign);
}
- if (error !== undefined) throw error;
+ if (error !== undefined) { throw error; }
return dest;
};
- var assign = isImplemented$4()
- ? Object.assign
- : shim$5;
+ var assign = isImplemented$4() ? Object.assign : shim$5;
var forEach = Array.prototype.forEach, create$2 = Object.create;
var process$1 = function (src, obj) {
var key;
- for (key in src) obj[key] = src[key];
+ for (key in src) { obj[key] = src[key]; }
};
// eslint-disable-next-line no-unused-vars
- var normalizeOptions = function (opts1 /*, …options*/) {
+ var normalizeOptions = function (opts1/*, …options*/) {
var result = create$2(null);
forEach.call(arguments, function (options) {
- if (!isValue(options)) return;
+ if (!isValue(options)) { return; }
process$1(Object(options), result);
});
return result;
};
- // Deprecated
-
- var isCallable = function (obj) {
- return typeof obj === "function";
- };
-
var str = "razdwatrzy";
var isImplemented$6 = function () {
- if (typeof str.contains !== "function") return false;
- return (str.contains("dwa") === true) && (str.contains("foo") === false);
+ if (typeof str.contains !== "function") { return false; }
+ return str.contains("dwa") === true && str.contains("foo") === false;
};
var indexOf$1 = String.prototype.indexOf;
return indexOf$1.call(this, searchString, arguments[1]) > -1;
};
- var contains = isImplemented$6()
- ? String.prototype.contains
- : shim$6;
+ var contains = isImplemented$6() ? String.prototype.contains : shim$6;
var d_1 = createCommonjsModule(function (module) {
- var d;
- d = module.exports = function (dscr, value/*, options*/) {
+
+ var d = (module.exports = function (dscr, value/*, options*/) {
var c, e, w, options, desc;
- if ((arguments.length < 2) || (typeof dscr !== 'string')) {
+ if (arguments.length < 2 || typeof dscr !== "string") {
options = value;
value = dscr;
dscr = null;
} else {
options = arguments[2];
}
- if (dscr == null) {
+ if (is(dscr)) {
+ c = contains.call(dscr, "c");
+ e = contains.call(dscr, "e");
+ w = contains.call(dscr, "w");
+ } else {
c = w = true;
e = false;
- } else {
- c = contains.call(dscr, 'c');
- e = contains.call(dscr, 'e');
- w = contains.call(dscr, 'w');
}
desc = { value: value, configurable: c, enumerable: e, writable: w };
return !options ? desc : assign(normalizeOptions(options), desc);
- };
+ });
d.gs = function (dscr, get, set/*, options*/) {
var c, e, options, desc;
- if (typeof dscr !== 'string') {
+ if (typeof dscr !== "string") {
options = set;
set = get;
get = dscr;
} else {
options = arguments[3];
}
- if (get == null) {
+ if (!is(get)) {
get = undefined;
- } else if (!isCallable(get)) {
+ } else if (!is$4(get)) {
options = get;
get = set = undefined;
- } else if (set == null) {
+ } else if (!is(set)) {
set = undefined;
- } else if (!isCallable(set)) {
+ } else if (!is$4(set)) {
options = set;
set = undefined;
}
- if (dscr == null) {
+ if (is(dscr)) {
+ c = contains.call(dscr, "c");
+ e = contains.call(dscr, "e");
+ } else {
c = true;
e = false;
- } else {
- c = contains.call(dscr, 'c');
- e = contains.call(dscr, 'e');
}
desc = { get: get, set: set, configurable: c, enumerable: e };
} else {
data = this.__ee__;
}
- if (!data[type]) data[type] = listener;
- else if (typeof data[type] === 'object') data[type].push(listener);
- else data[type] = [data[type], listener];
+ if (!data[type]) { data[type] = listener; }
+ else if (typeof data[type] === 'object') { data[type].push(listener); }
+ else { data[type] = [data[type], listener]; }
return this;
};
validCallable(listener);
- if (!hasOwnProperty.call(this, '__ee__')) return this;
+ if (!hasOwnProperty.call(this, '__ee__')) { return this; }
data = this.__ee__;
- if (!data[type]) return this;
+ if (!data[type]) { return this; }
listeners = data[type];
if (typeof listeners === 'object') {
for (i = 0; (candidate = listeners[i]); ++i) {
if ((candidate === listener) ||
(candidate.__eeOnceListener__ === listener)) {
- if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];
- else listeners.splice(i, 1);
+ if (listeners.length === 2) { data[type] = listeners[i ? 0 : 1]; }
+ else { listeners.splice(i, 1); }
}
}
} else {
};
emit = function (type) {
+ var arguments$1 = arguments;
+
var i, l, listener, listeners, args;
- if (!hasOwnProperty.call(this, '__ee__')) return;
+ if (!hasOwnProperty.call(this, '__ee__')) { return; }
listeners = this.__ee__[type];
- if (!listeners) return;
+ if (!listeners) { return; }
if (typeof listeners === 'object') {
l = arguments.length;
args = new Array(l - 1);
- for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
+ for (i = 1; i < l; ++i) { args[i - 1] = arguments$1[i]; }
listeners = listeners.slice();
for (i = 0; (listener = listeners[i]); ++i) {
l = arguments.length;
args = new Array(l - 1);
for (i = 1; i < l; ++i) {
- args[i - 1] = arguments[i];
+ args[i - 1] = arguments$1[i];
}
apply.call(listeners, this, args);
}
var isImplemented$7 = function () {
var symbol;
- if (typeof Symbol !== 'function') return false;
+ if (typeof Symbol !== 'function') { return false; }
symbol = Symbol('test symbol');
try { String(symbol); } catch (e) { return false; }
// Return 'true' also for polyfills
- if (!validTypes[typeof Symbol.iterator]) return false;
- if (!validTypes[typeof Symbol.toPrimitive]) return false;
- if (!validTypes[typeof Symbol.toStringTag]) return false;
+ if (!validTypes[typeof Symbol.iterator]) { return false; }
+ if (!validTypes[typeof Symbol.toPrimitive]) { return false; }
+ if (!validTypes[typeof Symbol.toStringTag]) { return false; }
return true;
};
var isSymbol = function (x) {
- if (!x) return false;
- if (typeof x === 'symbol') return true;
- if (!x.constructor) return false;
- if (x.constructor.name !== 'Symbol') return false;
+ if (!x) { return false; }
+ if (typeof x === 'symbol') { return true; }
+ if (!x.constructor) { return false; }
+ if (x.constructor.name !== 'Symbol') { return false; }
return (x[x.constructor.toStringTag] === 'Symbol');
};
var validateSymbol = function (value) {
- if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
+ if (!isSymbol(value)) { throw new TypeError(value + " is not a symbol"); }
return value;
};
var created = create$3(null);
return function (desc) {
var postfix = 0, name, ie11BugWorkaround;
- while (created[desc + (postfix || '')]) ++postfix;
+ while (created[desc + (postfix || '')]) { ++postfix; }
desc += (postfix || '');
created[desc] = true;
name = '@@' + desc;
// https://connect.microsoft.com/IE/feedbackdetail/view/1928508/
// ie11-broken-getters-on-dom-objects
// https://github.com/medikoo/es6-symbol/issues/12
- if (ie11BugWorkaround) return;
+ if (ie11BugWorkaround) { return; }
ie11BugWorkaround = true;
defineProperty$1(this, name, d_1(value));
ie11BugWorkaround = false;
// Internal constructor (not one exposed) for creating Symbol instances.
// This one is used to ensure that `someSymbol instanceof Symbol` always return false
HiddenSymbol = function Symbol(description) {
- if (this instanceof HiddenSymbol) throw new TypeError('Symbol is not a constructor');
+ if (this instanceof HiddenSymbol) { throw new TypeError('Symbol is not a constructor'); }
return SymbolPolyfill(description);
};
// (returns instances of HiddenSymbol)
var polyfill = SymbolPolyfill = function Symbol(description) {
var symbol;
- if (this instanceof Symbol) throw new TypeError('Symbol is not a constructor');
- if (isNativeSafe) return NativeSymbol(description);
+ if (this instanceof Symbol) { throw new TypeError('Symbol is not a constructor'); }
+ if (isNativeSafe) { return NativeSymbol(description); }
symbol = create$3(HiddenSymbol.prototype);
description = (description === undefined ? '' : String(description));
return defineProperties(symbol, {
};
defineProperties(SymbolPolyfill, {
for: d_1(function (key) {
- if (globalSymbols[key]) return globalSymbols[key];
+ if (globalSymbols[key]) { return globalSymbols[key]; }
return (globalSymbols[key] = SymbolPolyfill(String(key)));
}),
keyFor: d_1(function (s) {
var key;
validateSymbol(s);
- for (key in globalSymbols) if (globalSymbols[key] === s) return key;
+ for (key in globalSymbols) { if (globalSymbols[key] === s) { return key; } }
}),
// To ensure proper interoperability with other native functions (e.g. Array.from)
});
defineProperty$1(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d_1('', function () {
var symbol = validateSymbol(this);
- if (typeof symbol === 'symbol') return symbol;
+ if (typeof symbol === 'symbol') { return symbol; }
return symbol.toString();
}));
defineProperty$1(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d_1('c', 'Symbol'));
var es6Symbol = isImplemented$7() ? Symbol : polyfill;
var objToString = Object.prototype.toString
- , id = objToString.call(
- (function () {
- return arguments;
- })()
- );
+ , id = objToString.call((function () { return arguments; })());
- var isArguments = function (value) {
- return objToString.call(value) === id;
- };
+ var isArguments = function (value) { return objToString.call(value) === id; };
var objToString$1 = Object.prototype.toString, id$1 = objToString$1.call("");
);
};
- var iteratorSymbol = es6Symbol.iterator
+ var isImplemented$8 = function () {
+ if (typeof globalThis !== "object") { return false; }
+ if (!globalThis) { return false; }
+ return globalThis.Array === Array;
+ };
+
+ var naiveFallback = function () {
+ if (typeof self === "object" && self) { return self; }
+ if (typeof window === "object" && window) { return window; }
+ throw new Error("Unable to resolve global `this`");
+ };
+
+ var implementation = (function () {
+ if (this) { return this; }
+
+ // Unexpected strict mode (may happen if e.g. bundled into ESM module)
+
+ // Thanks @mathiasbynens -> https://mathiasbynens.be/notes/globalthis
+ // In all ES5+ engines global object inherits from Object.prototype
+ // (if you approached one that doesn't please report)
+ try {
+ Object.defineProperty(Object.prototype, "__global__", {
+ get: function () { return this; },
+ configurable: true
+ });
+ } catch (error) {
+ // Unfortunate case of Object.prototype being sealed (via preventExtensions, seal or freeze)
+ return naiveFallback();
+ }
+ try {
+ // Safari case (window.__global__ is resolved with global context, but __global__ does not)
+ if (!__global__) { return naiveFallback(); }
+ return __global__;
+ } finally {
+ delete Object.prototype.__global__;
+ }
+ })();
+
+ var globalThis_1 = isImplemented$8() ? globalThis : implementation;
+
+ var validTypes$1 = { object: true, symbol: true };
+
+ var isImplemented$9 = function () {
+ var Symbol = globalThis_1.Symbol;
+ var symbol;
+ if (typeof Symbol !== "function") { return false; }
+ symbol = Symbol("test symbol");
+ try { String(symbol); }
+ catch (e) { return false; }
+
+ // Return 'true' also for polyfills
+ if (!validTypes$1[typeof Symbol.iterator]) { return false; }
+ if (!validTypes$1[typeof Symbol.toPrimitive]) { return false; }
+ if (!validTypes$1[typeof Symbol.toStringTag]) { return false; }
+
+ return true;
+ };
+
+ var isSymbol$1 = function (value) {
+ if (!value) { return false; }
+ if (typeof value === "symbol") { return true; }
+ if (!value.constructor) { return false; }
+ if (value.constructor.name !== "Symbol") { return false; }
+ return value[value.constructor.toStringTag] === "Symbol";
+ };
+
+ var validateSymbol$1 = function (value) {
+ if (!isSymbol$1(value)) { throw new TypeError(value + " is not a symbol"); }
+ return value;
+ };
+
+ var create$4 = Object.create, defineProperty$2 = Object.defineProperty, objPrototype$1 = Object.prototype;
+
+ var created = create$4(null);
+ var generateName$1 = function (desc) {
+ var postfix = 0, name, ie11BugWorkaround;
+ while (created[desc + (postfix || "")]) { ++postfix; }
+ desc += postfix || "";
+ created[desc] = true;
+ name = "@@" + desc;
+ defineProperty$2(
+ objPrototype$1,
+ name,
+ d_1.gs(null, function (value) {
+ // For IE11 issue see:
+ // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/
+ // ie11-broken-getters-on-dom-objects
+ // https://github.com/medikoo/es6-symbol/issues/12
+ if (ie11BugWorkaround) { return; }
+ ie11BugWorkaround = true;
+ defineProperty$2(this, name, d_1(value));
+ ie11BugWorkaround = false;
+ })
+ );
+ return name;
+ };
+
+ var NativeSymbol$1 = globalThis_1.Symbol;
+
+ var standardSymbols = function (SymbolPolyfill) {
+ return Object.defineProperties(SymbolPolyfill, {
+ // To ensure proper interoperability with other native functions (e.g. Array.from)
+ // fallback to eventual native implementation of given symbol
+ hasInstance: d_1(
+ "", (NativeSymbol$1 && NativeSymbol$1.hasInstance) || SymbolPolyfill("hasInstance")
+ ),
+ isConcatSpreadable: d_1(
+ "",
+ (NativeSymbol$1 && NativeSymbol$1.isConcatSpreadable) ||
+ SymbolPolyfill("isConcatSpreadable")
+ ),
+ iterator: d_1("", (NativeSymbol$1 && NativeSymbol$1.iterator) || SymbolPolyfill("iterator")),
+ match: d_1("", (NativeSymbol$1 && NativeSymbol$1.match) || SymbolPolyfill("match")),
+ replace: d_1("", (NativeSymbol$1 && NativeSymbol$1.replace) || SymbolPolyfill("replace")),
+ search: d_1("", (NativeSymbol$1 && NativeSymbol$1.search) || SymbolPolyfill("search")),
+ species: d_1("", (NativeSymbol$1 && NativeSymbol$1.species) || SymbolPolyfill("species")),
+ split: d_1("", (NativeSymbol$1 && NativeSymbol$1.split) || SymbolPolyfill("split")),
+ toPrimitive: d_1(
+ "", (NativeSymbol$1 && NativeSymbol$1.toPrimitive) || SymbolPolyfill("toPrimitive")
+ ),
+ toStringTag: d_1(
+ "", (NativeSymbol$1 && NativeSymbol$1.toStringTag) || SymbolPolyfill("toStringTag")
+ ),
+ unscopables: d_1(
+ "", (NativeSymbol$1 && NativeSymbol$1.unscopables) || SymbolPolyfill("unscopables")
+ )
+ });
+ };
+
+ var registry = Object.create(null);
+
+ var symbolRegistry = function (SymbolPolyfill) {
+ return Object.defineProperties(SymbolPolyfill, {
+ for: d_1(function (key) {
+ if (registry[key]) { return registry[key]; }
+ return (registry[key] = SymbolPolyfill(String(key)));
+ }),
+ keyFor: d_1(function (symbol) {
+ var key;
+ validateSymbol$1(symbol);
+ for (key in registry) {
+ if (registry[key] === symbol) { return key; }
+ }
+ return undefined;
+ })
+ });
+ };
+
+ var NativeSymbol$2 = globalThis_1.Symbol;
+
+ var create$5 = Object.create
+ , defineProperties$1 = Object.defineProperties
+ , defineProperty$3 = Object.defineProperty;
+
+ var SymbolPolyfill$1, HiddenSymbol$1, isNativeSafe$1;
+
+ if (typeof NativeSymbol$2 === "function") {
+ try {
+ String(NativeSymbol$2());
+ isNativeSafe$1 = true;
+ } catch (ignore) {}
+ } else {
+ NativeSymbol$2 = null;
+ }
+
+ // Internal constructor (not one exposed) for creating Symbol instances.
+ // This one is used to ensure that `someSymbol instanceof Symbol` always return false
+ HiddenSymbol$1 = function Symbol(description) {
+ if (this instanceof HiddenSymbol$1) { throw new TypeError("Symbol is not a constructor"); }
+ return SymbolPolyfill$1(description);
+ };
+
+ // Exposed `Symbol` constructor
+ // (returns instances of HiddenSymbol)
+ var polyfill$1 = SymbolPolyfill$1 = function Symbol(description) {
+ var symbol;
+ if (this instanceof Symbol) { throw new TypeError("Symbol is not a constructor"); }
+ if (isNativeSafe$1) { return NativeSymbol$2(description); }
+ symbol = create$5(HiddenSymbol$1.prototype);
+ description = description === undefined ? "" : String(description);
+ return defineProperties$1(symbol, {
+ __description__: d_1("", description),
+ __name__: d_1("", generateName$1(description))
+ });
+ };
+
+ standardSymbols(SymbolPolyfill$1);
+ symbolRegistry(SymbolPolyfill$1);
+
+ // Internal tweaks for real symbol producer
+ defineProperties$1(HiddenSymbol$1.prototype, {
+ constructor: d_1(SymbolPolyfill$1),
+ toString: d_1("", function () { return this.__name__; })
+ });
+
+ // Proper implementation of methods exposed on Symbol.prototype
+ // They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype
+ defineProperties$1(SymbolPolyfill$1.prototype, {
+ toString: d_1(function () { return "Symbol (" + validateSymbol$1(this).__description__ + ")"; }),
+ valueOf: d_1(function () { return validateSymbol$1(this); })
+ });
+ defineProperty$3(
+ SymbolPolyfill$1.prototype,
+ SymbolPolyfill$1.toPrimitive,
+ d_1("", function () {
+ var symbol = validateSymbol$1(this);
+ if (typeof symbol === "symbol") { return symbol; }
+ return symbol.toString();
+ })
+ );
+ defineProperty$3(SymbolPolyfill$1.prototype, SymbolPolyfill$1.toStringTag, d_1("c", "Symbol"));
+
+ // Proper implementaton of toPrimitive and toStringTag for returned symbol instances
+ defineProperty$3(
+ HiddenSymbol$1.prototype, SymbolPolyfill$1.toStringTag,
+ d_1("c", SymbolPolyfill$1.prototype[SymbolPolyfill$1.toStringTag])
+ );
+
+ // Note: It's important to define `toPrimitive` as last one, as some implementations
+ // implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols)
+ // And that may invoke error in definition flow:
+ // See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149
+ defineProperty$3(
+ HiddenSymbol$1.prototype, SymbolPolyfill$1.toPrimitive,
+ d_1("c", SymbolPolyfill$1.prototype[SymbolPolyfill$1.toPrimitive])
+ );
+
+ var es6Symbol$1 = isImplemented$9()
+ ? globalThis_1.Symbol
+ : polyfill$1;
+
+ var iteratorSymbol = es6Symbol$1.iterator
, isArray = Array.isArray;
var isIterable = function (value) {
- if (!isValue(value)) return false;
- if (isArray(value)) return true;
- if (isString(value)) return true;
- if (isArguments(value)) return true;
+ if (!isValue(value)) { return false; }
+ if (isArray(value)) { return true; }
+ if (isString(value)) { return true; }
+ if (isArguments(value)) { return true; }
return typeof value[iteratorSymbol] === "function";
};
var validIterable = function (value) {
- if (!isIterable(value)) throw new TypeError(value + " is not iterable");
+ if (!isIterable(value)) { throw new TypeError(value + " is not iterable"); }
return value;
};
- var isImplemented$8 = function () {
+ var objectToString = Object.prototype.toString;
+
+ var coerce = function (value) {
+ if (!is(value)) { return null; }
+ if (is$1(value)) {
+ // Reject Object.prototype.toString coercion
+ var valueToString = value.toString;
+ if (typeof valueToString !== "function") { return null; }
+ if (valueToString === objectToString) { return null; }
+ // Note: It can be object coming from other realm, still as there's no ES3 and CSP compliant
+ // way to resolve its realm's Object.prototype.toString it's left as not addressed edge case
+ }
+ try {
+ return "" + value; // Ensure implicit coercion
+ } catch (error) {
+ return null;
+ }
+ };
+
+ var safeToString = function (value) {
+ try {
+ return value.toString();
+ } catch (error) {
+ try { return String(value); }
+ catch (error2) { return null; }
+ }
+ };
+
+ var reNewLine = /[\n\r\u2028\u2029]/g;
+
+ var toShortString = function (value) {
+ var string = safeToString(value);
+ if (string === null) { return "<Non-coercible to string value>"; }
+ // Trim if too long
+ if (string.length > 100) { string = string.slice(0, 99) + "…"; }
+ // Replace eventual new lines
+ string = string.replace(reNewLine, function (char) {
+ switch (char) {
+ case "\n":
+ return "\\n";
+ case "\r":
+ return "\\r";
+ case "\u2028":
+ return "\\u2028";
+ case "\u2029":
+ return "\\u2029";
+ /* istanbul ignore next */
+ default:
+ throw new Error("Unexpected character");
+ }
+ });
+ return string;
+ };
+
+ var resolveMessage = function (message, value) {
+ return message.replace("%v", toShortString(value));
+ };
+
+ var resolveException = function (value, defaultMessage, inputOptions) {
+ if (!is$1(inputOptions)) { throw new TypeError(resolveMessage(defaultMessage, value)); }
+ if (!is(value)) {
+ if ("default" in inputOptions) { return inputOptions["default"]; }
+ if (inputOptions.isOptional) { return null; }
+ }
+ var errorMessage = coerce(inputOptions.errorMessage);
+ if (!is(errorMessage)) { errorMessage = defaultMessage; }
+ throw new TypeError(resolveMessage(errorMessage, value));
+ };
+
+ var ensure = function (value/*, options*/) {
+ if (is(value)) { return value; }
+ return resolveException(value, "Cannot use %v", arguments[1]);
+ };
+
+ var ensure$1 = function (value/*, options*/) {
+ if (is$4(value)) { return value; }
+ return resolveException(value, "%v is not a plain function", arguments[1]);
+ };
+
+ var isImplemented$a = function () {
var from = Array.from, arr, result;
- if (typeof from !== "function") return false;
+ if (typeof from !== "function") { return false; }
arr = ["raz", "dwa"];
result = from(arr);
- return Boolean(result && (result !== arr) && (result[1] === "dwa"));
+ return Boolean(result && result !== arr && result[1] === "dwa");
};
- var objToString$2 = Object.prototype.toString, id$2 = objToString$2.call(noop);
+ var objToString$2 = Object.prototype.toString
+ , isFunctionStringTag = RegExp.prototype.test.bind(/^[object [A-Za-z0-9]*Function]$/);
var isFunction = function (value) {
- return typeof value === "function" && objToString$2.call(value) === id$2;
+ return typeof value === "function" && isFunctionStringTag(objToString$2.call(value));
};
- var iteratorSymbol$1 = es6Symbol.iterator
+ var iteratorSymbol$1 = es6Symbol$1.iterator
, isArray$1 = Array.isArray
, call = Function.prototype.call
, desc = { configurable: true, enumerable: true, writable: true, value: null }
- , defineProperty$2 = Object.defineProperty;
+ , defineProperty$4 = Object.defineProperty;
// eslint-disable-next-line complexity, max-lines-per-function
- var shim$7 = function (arrayLike /*, mapFn, thisArg*/) {
+ var shim$7 = function (arrayLike/*, mapFn, thisArg*/) {
var mapFn = arguments[1]
, thisArg = arguments[2]
, Context
arrayLike = Object(validValue(arrayLike));
- if (isValue(mapFn)) validCallable(mapFn);
+ if (isValue(mapFn)) { validCallable(mapFn); }
if (!this || this === Array || !isFunction(this)) {
// Result: Plain array
if (!mapFn) {
if (isArguments(arrayLike)) {
// Source: Arguments
length = arrayLike.length;
- if (length !== 1) return Array.apply(null, arrayLike);
+ if (length !== 1) { return Array.apply(null, arrayLike); }
arr = new Array(1);
arr[0] = arrayLike[0];
return arr;
}
if (isArray$1(arrayLike)) {
// Source: Array
- arr = new Array(length = arrayLike.length);
- for (i = 0; i < length; ++i) arr[i] = arrayLike[i];
+ arr = new Array((length = arrayLike.length));
+ for (i = 0; i < length; ++i) { arr[i] = arrayLike[i]; }
return arr;
}
}
if ((getIterator = arrayLike[iteratorSymbol$1]) !== undefined) {
// Source: Iterator
iterator = validCallable(getIterator).call(arrayLike);
- if (Context) arr = new Context();
+ if (Context) { arr = new Context(); }
result = iterator.next();
i = 0;
while (!result.done) {
value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value;
if (Context) {
desc.value = value;
- defineProperty$2(arr, i, desc);
+ defineProperty$4(arr, i, desc);
} else {
arr[i] = value;
}
} else if (isString(arrayLike)) {
// Source: String
length = arrayLike.length;
- if (Context) arr = new Context();
+ if (Context) { arr = new Context(); }
for (i = 0, j = 0; i < length; ++i) {
value = arrayLike[i];
if (i + 1 < length) {
code = value.charCodeAt(0);
// eslint-disable-next-line max-depth
- if (code >= 0xd800 && code <= 0xdbff) value += arrayLike[++i];
+ if (code >= 0xd800 && code <= 0xdbff) { value += arrayLike[++i]; }
}
value = mapFn ? call.call(mapFn, thisArg, value, j) : value;
if (Context) {
desc.value = value;
- defineProperty$2(arr, j, desc);
+ defineProperty$4(arr, j, desc);
} else {
arr[j] = value;
}
if (length === undefined) {
// Source: array or array-like
length = toPosInteger(arrayLike.length);
- if (Context) arr = new Context(length);
+ if (Context) { arr = new Context(length); }
for (i = 0; i < length; ++i) {
value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i];
if (Context) {
desc.value = value;
- defineProperty$2(arr, i, desc);
+ defineProperty$4(arr, i, desc);
} else {
arr[i] = value;
}
return arr;
};
- var from_1 = isImplemented$8()
- ? Array.from
- : shim$7;
+ var from_1 = isImplemented$a() ? Array.from : shim$7;
var copy = function (obj/*, propertyNames, options*/) {
var copy = Object(validValue(obj)), propertyNames = arguments[1], options = Object(arguments[2]);
- if (copy !== obj && !propertyNames) return copy;
+ if (copy !== obj && !propertyNames) { return copy; }
var result = {};
if (propertyNames) {
from_1(propertyNames, function (propertyName) {
- if (options.ensure || propertyName in obj) result[propertyName] = obj[propertyName];
+ if (options.ensure || propertyName in obj) { result[propertyName] = obj[propertyName]; }
});
} else {
assign(result, obj);
, objPropertyIsEnumerable = Object.prototype.propertyIsEnumerable;
var _iterate = function (method, defVal) {
- return function (obj, cb /*, thisArg, compareFn*/) {
+ return function (obj, cb/*, thisArg, compareFn*/) {
var list, thisArg = arguments[2], compareFn = arguments[3];
obj = Object(validValue(obj));
validCallable(cb);
if (compareFn) {
list.sort(typeof compareFn === "function" ? bind.call(compareFn, obj) : undefined);
}
- if (typeof method !== "function") method = list[method];
+ if (typeof method !== "function") { method = list[method]; }
return call$1.call(method, list, function (key, index) {
- if (!objPropertyIsEnumerable.call(obj, key)) return defVal;
+ if (!objPropertyIsEnumerable.call(obj, key)) { return defVal; }
return call$1.call(cb, thisArg, obj[key], key, obj, index);
});
};
var call$2 = Function.prototype.call;
- var map$1 = function (obj, cb /*, thisArg*/) {
+ var map$1 = function (obj, cb/*, thisArg*/) {
var result = {}, thisArg = arguments[2];
validCallable(cb);
forEach$1(obj, function (value, key, targetObj, index) {
return result;
};
- var callable = validCallable
-
- , bind$1 = Function.prototype.bind, defineProperty$3 = Object.defineProperty
- , hasOwnProperty = Object.prototype.hasOwnProperty
+ var bind$1 = Function.prototype.bind
+ , defineProperty$5 = Object.defineProperty
+ , hasOwnProperty$1 = Object.prototype.hasOwnProperty
, define;
define = function (name, desc, options) {
- var value = validValue(desc) && callable(desc.value), dgs;
+ var value = ensure(desc) && ensure$1(desc.value), dgs;
dgs = copy(desc);
delete dgs.writable;
delete dgs.value;
dgs.get = function () {
- if (!options.overwriteDefinition && hasOwnProperty.call(this, name)) return value;
+ if (!options.overwriteDefinition && hasOwnProperty$1.call(this, name)) { return value; }
desc.value = bind$1.call(value, options.resolveContext ? options.resolveContext(this) : this);
- defineProperty$3(this, name, desc);
+ defineProperty$5(this, name, desc);
return this[name];
};
return dgs;
var autoBind = function (props/*, options*/) {
var options = normalizeOptions(arguments[1]);
- if (options.resolveContext != null) validCallable(options.resolveContext);
+ if (is(options.resolveContext)) { ensure$1(options.resolveContext); }
return map$1(props, function (desc, name) { return define(name, desc, options); });
};
- var defineProperty$4 = Object.defineProperty, defineProperties$1 = Object.defineProperties, Iterator;
+ var defineProperty$6 = Object.defineProperty, defineProperties$2 = Object.defineProperties, Iterator;
var es6Iterator = Iterator = function (list, context) {
- if (!(this instanceof Iterator)) throw new TypeError("Constructor requires 'new'");
- defineProperties$1(this, {
+ if (!(this instanceof Iterator)) { throw new TypeError("Constructor requires 'new'"); }
+ defineProperties$2(this, {
__list__: d_1("w", validValue(list)),
__context__: d_1("w", context),
__nextIndex__: d_1("w", 0)
});
- if (!context) return;
+ if (!context) { return; }
validCallable(context.on);
context.on("_add", this._onAdd);
context.on("_delete", this._onDelete);
// Internal %IteratorPrototype% doesn't expose its constructor
delete Iterator.prototype.constructor;
- defineProperties$1(
+ defineProperties$2(
Iterator.prototype,
assign(
{
_next: d_1(function () {
var i;
- if (!this.__list__) return undefined;
+ if (!this.__list__) { return undefined; }
if (this.__redo__) {
i = this.__redo__.shift();
- if (i !== undefined) return i;
+ if (i !== undefined) { return i; }
}
- if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++;
+ if (this.__nextIndex__ < this.__list__.length) { return this.__nextIndex__++; }
this._unBind();
return undefined;
}),
return this._createResult(this._next());
}),
_createResult: d_1(function (i) {
- if (i === undefined) return { done: true, value: undefined };
+ if (i === undefined) { return { done: true, value: undefined }; }
return { done: false, value: this._resolve(i) };
}),
_resolve: d_1(function (i) {
_unBind: d_1(function () {
this.__list__ = null;
delete this.__redo__;
- if (!this.__context__) return;
+ if (!this.__context__) { return; }
this.__context__.off("_add", this._onAdd);
this.__context__.off("_delete", this._onDelete);
this.__context__.off("_clear", this._onClear);
this.__context__ = null;
}),
toString: d_1(function () {
- return "[object " + (this[es6Symbol.toStringTag] || "Object") + "]";
+ return "[object " + (this[es6Symbol$1.toStringTag] || "Object") + "]";
})
},
autoBind({
_onAdd: d_1(function (index) {
- if (index >= this.__nextIndex__) return;
+ if (index >= this.__nextIndex__) { return; }
++this.__nextIndex__;
if (!this.__redo__) {
- defineProperty$4(this, "__redo__", d_1("c", [index]));
+ defineProperty$6(this, "__redo__", d_1("c", [index]));
return;
}
this.__redo__.forEach(function (redo, i) {
- if (redo >= index) this.__redo__[i] = ++redo;
+ if (redo >= index) { this.__redo__[i] = ++redo; }
}, this);
this.__redo__.push(index);
}),
_onDelete: d_1(function (index) {
var i;
- if (index >= this.__nextIndex__) return;
+ if (index >= this.__nextIndex__) { return; }
--this.__nextIndex__;
- if (!this.__redo__) return;
+ if (!this.__redo__) { return; }
i = this.__redo__.indexOf(index);
- if (i !== -1) this.__redo__.splice(i, 1);
+ if (i !== -1) { this.__redo__.splice(i, 1); }
this.__redo__.forEach(function (redo, j) {
- if (redo > index) this.__redo__[j] = --redo;
+ if (redo > index) { this.__redo__[j] = --redo; }
}, this);
}),
_onClear: d_1(function () {
- if (this.__redo__) clear.call(this.__redo__);
+ if (this.__redo__) { clear.call(this.__redo__); }
this.__nextIndex__ = 0;
})
})
)
);
- defineProperty$4(
+ defineProperty$6(
Iterator.prototype,
- es6Symbol.iterator,
+ es6Symbol$1.iterator,
d_1(function () {
return this;
})
var defineProperty = Object.defineProperty, ArrayIterator;
ArrayIterator = module.exports = function (arr, kind) {
- if (!(this instanceof ArrayIterator)) throw new TypeError("Constructor requires 'new'");
+ if (!(this instanceof ArrayIterator)) { throw new TypeError("Constructor requires 'new'"); }
es6Iterator.call(this, arr);
- if (!kind) kind = "value";
- else if (contains.call(kind, "key+value")) kind = "key+value";
- else if (contains.call(kind, "key")) kind = "key";
- else kind = "value";
+ if (!kind) { kind = "value"; }
+ else if (contains.call(kind, "key+value")) { kind = "key+value"; }
+ else if (contains.call(kind, "key")) { kind = "key"; }
+ else { kind = "value"; }
defineProperty(this, "__kind__", d_1("", kind));
};
- if (setPrototypeOf) setPrototypeOf(ArrayIterator, es6Iterator);
+ if (setPrototypeOf) { setPrototypeOf(ArrayIterator, es6Iterator); }
// Internal %ArrayIteratorPrototype% doesn't expose its constructor
delete ArrayIterator.prototype.constructor;
ArrayIterator.prototype = Object.create(es6Iterator.prototype, {
_resolve: d_1(function (i) {
- if (this.__kind__ === "value") return this.__list__[i];
- if (this.__kind__ === "key+value") return [i, this.__list__[i]];
+ if (this.__kind__ === "value") { return this.__list__[i]; }
+ if (this.__kind__ === "key+value") { return [i, this.__list__[i]]; }
return i;
})
});
- defineProperty(ArrayIterator.prototype, es6Symbol.toStringTag, d_1("c", "Array Iterator"));
+ defineProperty(ArrayIterator.prototype, es6Symbol$1.toStringTag, d_1("c", "Array Iterator"));
});
var string = createCommonjsModule(function (module) {
var defineProperty = Object.defineProperty, StringIterator;
StringIterator = module.exports = function (str) {
- if (!(this instanceof StringIterator)) throw new TypeError("Constructor requires 'new'");
+ if (!(this instanceof StringIterator)) { throw new TypeError("Constructor requires 'new'"); }
str = String(str);
es6Iterator.call(this, str);
defineProperty(this, "__length__", d_1("", str.length));
};
- if (setPrototypeOf) setPrototypeOf(StringIterator, es6Iterator);
+ if (setPrototypeOf) { setPrototypeOf(StringIterator, es6Iterator); }
// Internal %ArrayIteratorPrototype% doesn't expose its constructor
delete StringIterator.prototype.constructor;
StringIterator.prototype = Object.create(es6Iterator.prototype, {
_next: d_1(function () {
- if (!this.__list__) return undefined;
- if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++;
+ if (!this.__list__) { return undefined; }
+ if (this.__nextIndex__ < this.__length__) { return this.__nextIndex__++; }
this._unBind();
return undefined;
}),
_resolve: d_1(function (i) {
var char = this.__list__[i], code;
- if (this.__nextIndex__ === this.__length__) return char;
+ if (this.__nextIndex__ === this.__length__) { return char; }
code = char.charCodeAt(0);
- if (code >= 0xd800 && code <= 0xdbff) return char + this.__list__[this.__nextIndex__++];
+ if (code >= 0xd800 && code <= 0xdbff) { return char + this.__list__[this.__nextIndex__++]; }
return char;
})
});
- defineProperty(StringIterator.prototype, es6Symbol.toStringTag, d_1("c", "String Iterator"));
+ defineProperty(StringIterator.prototype, es6Symbol$1.toStringTag, d_1("c", "String Iterator"));
});
- var iteratorSymbol$2 = es6Symbol.iterator;
+ var iteratorSymbol$2 = es6Symbol$1.iterator;
var get = function (obj) {
- if (typeof validIterable(obj)[iteratorSymbol$2] === "function") return obj[iteratorSymbol$2]();
- if (isArguments(obj)) return new array(obj);
- if (isString(obj)) return new string(obj);
+ if (typeof validIterable(obj)[iteratorSymbol$2] === "function") { return obj[iteratorSymbol$2](); }
+ if (isArguments(obj)) { return new array(obj); }
+ if (isString(obj)) { return new string(obj); }
return new array(obj);
};
var forOf = function (iterable, cb /*, thisArg*/) {
var mode, thisArg = arguments[2], result, doBreak, broken, i, length, char, code;
- if (isArray$2(iterable) || isArguments(iterable)) mode = "array";
- else if (isString(iterable)) mode = "string";
- else iterable = get(iterable);
+ if (isArray$2(iterable) || isArguments(iterable)) { mode = "array"; }
+ else if (isString(iterable)) { mode = "string"; }
+ else { iterable = get(iterable); }
validCallable(cb);
doBreak = function () {
char = iterable[i];
if (i + 1 < length) {
code = char.charCodeAt(0);
- if (code >= 0xd800 && code <= 0xdbff) char += iterable[++i];
+ if (code >= 0xd800 && code <= 0xdbff) { char += iterable[++i]; }
}
call$3.call(cb, thisArg, char, doBreak);
- if (broken) break;
+ if (broken) { break; }
}
return;
}
while (!result.done) {
call$3.call(cb, thisArg, result.value, doBreak);
- if (broken) return;
+ if (broken) { return; }
result = iterable.next();
}
};
, SetIterator;
SetIterator = module.exports = function (set, kind) {
- if (!(this instanceof SetIterator)) return new SetIterator(set, kind);
+ if (!(this instanceof SetIterator)) { return new SetIterator(set, kind); }
es6Iterator.call(this, set.__setData__, set);
- if (!kind) kind = 'value';
- else if (contains.call(kind, 'key+value')) kind = 'key+value';
- else kind = 'value';
+ if (!kind) { kind = 'value'; }
+ else if (contains.call(kind, 'key+value')) { kind = 'key+value'; }
+ else { kind = 'value'; }
defineProperty(this, '__kind__', d_1('', kind));
};
- if (setPrototypeOf) setPrototypeOf(SetIterator, es6Iterator);
+ if (setPrototypeOf) { setPrototypeOf(SetIterator, es6Iterator); }
SetIterator.prototype = Object.create(es6Iterator.prototype, {
constructor: d_1(SetIterator),
_resolve: d_1(function (i) {
- if (this.__kind__ === 'value') return this.__list__[i];
+ if (this.__kind__ === 'value') { return this.__list__[i]; }
return [this.__list__[i], this.__list__[i]];
}),
toString: d_1(function () { return '[object Set Iterator]'; })
// Exports true if environment provides native `Set` implementation,
var isNativeImplemented = (function () {
- if (typeof Set === 'undefined') return false;
+ if (typeof Set === 'undefined') { return false; }
return (Object.prototype.toString.call(Set.prototype) === '[object Set]');
}());
var iterator$1 = validIterable
, call$4 = Function.prototype.call
- , defineProperty$5 = Object.defineProperty, getPrototypeOf$1 = Object.getPrototypeOf
+ , defineProperty$7 = Object.defineProperty, getPrototypeOf$1 = Object.getPrototypeOf
, SetPoly, getValues, NativeSet;
- if (isNativeImplemented) NativeSet = Set;
+ if (isNativeImplemented) { NativeSet = Set; }
- var polyfill$1 = SetPoly = function Set(/*iterable*/) {
+ var polyfill$2 = SetPoly = function Set(/*iterable*/) {
var iterable = arguments[0], self;
- if (!(this instanceof SetPoly)) throw new TypeError('Constructor requires \'new\'');
- if (isNativeImplemented && setPrototypeOf) self = setPrototypeOf(new NativeSet(), getPrototypeOf$1(this));
- else self = this;
- if (iterable != null) iterator$1(iterable);
- defineProperty$5(self, '__setData__', d_1('c', []));
- if (!iterable) return self;
+ if (!(this instanceof SetPoly)) { throw new TypeError('Constructor requires \'new\''); }
+ if (isNativeImplemented && setPrototypeOf) { self = setPrototypeOf(new NativeSet(), getPrototypeOf$1(this)); }
+ else { self = this; }
+ if (iterable != null) { iterator$1(iterable); }
+ defineProperty$7(self, '__setData__', d_1('c', []));
+ if (!iterable) { return self; }
forOf(iterable, function (value) {
- if (eIndexOf.call(this, value) !== -1) return;
+ if (eIndexOf.call(this, value) !== -1) { return; }
this.push(value);
}, self.__setData__);
return self;
};
if (isNativeImplemented) {
- if (setPrototypeOf) setPrototypeOf(SetPoly, NativeSet);
+ if (setPrototypeOf) { setPrototypeOf(SetPoly, NativeSet); }
SetPoly.prototype = Object.create(NativeSet.prototype, { constructor: d_1(SetPoly) });
}
eventEmitter(Object.defineProperties(SetPoly.prototype, {
add: d_1(function (value) {
- if (this.has(value)) return this;
+ if (this.has(value)) { return this; }
this.emit('_add', this.__setData__.push(value) - 1, value);
return this;
}),
clear: d_1(function () {
- if (!this.__setData__.length) return;
+ if (!this.__setData__.length) { return; }
clear.call(this.__setData__);
this.emit('_clear');
}),
delete: d_1(function (value) {
var index = eIndexOf.call(this.__setData__, value);
- if (index === -1) return false;
+ if (index === -1) { return false; }
this.__setData__.splice(index, 1);
this.emit('_delete', index, value);
return true;
values: d_1(function () { return new iterator(this); }),
toString: d_1(function () { return '[object Set]'; })
}));
- defineProperty$5(SetPoly.prototype, es6Symbol.iterator, d_1(getValues));
- defineProperty$5(SetPoly.prototype, es6Symbol.toStringTag, d_1('c', 'Set'));
+ defineProperty$7(SetPoly.prototype, es6Symbol.iterator, d_1(getValues));
+ defineProperty$7(SetPoly.prototype, es6Symbol.toStringTag, d_1('c', 'Set'));
- var es6Set = isImplemented() ? Set : polyfill$1;
+ var es6Set = isImplemented() ? Set : polyfill$2;
- var isImplemented$9 = function () {
+ var isImplemented$b = function () {
var map, iterator, result;
- if (typeof Map !== 'function') return false;
+ if (typeof Map !== 'function') { return false; }
try {
// WebKit doesn't support arguments and crashes
map = new Map([['raz', 'one'], ['dwa', 'two'], ['trzy', 'three']]);
} catch (e) {
return false;
}
- if (String(map) !== '[object Map]') return false;
- if (map.size !== 3) return false;
- if (typeof map.clear !== 'function') return false;
- if (typeof map.delete !== 'function') return false;
- if (typeof map.entries !== 'function') return false;
- if (typeof map.forEach !== 'function') return false;
- if (typeof map.get !== 'function') return false;
- if (typeof map.has !== 'function') return false;
- if (typeof map.keys !== 'function') return false;
- if (typeof map.set !== 'function') return false;
- if (typeof map.values !== 'function') return false;
+ if (String(map) !== '[object Map]') { return false; }
+ if (map.size !== 3) { return false; }
+ if (typeof map.clear !== 'function') { return false; }
+ if (typeof map.delete !== 'function') { return false; }
+ if (typeof map.entries !== 'function') { return false; }
+ if (typeof map.forEach !== 'function') { return false; }
+ if (typeof map.get !== 'function') { return false; }
+ if (typeof map.has !== 'function') { return false; }
+ if (typeof map.keys !== 'function') { return false; }
+ if (typeof map.set !== 'function') { return false; }
+ if (typeof map.values !== 'function') { return false; }
iterator = map.entries();
result = iterator.next();
- if (result.done !== false) return false;
- if (!result.value) return false;
- if (result.value[0] !== 'raz') return false;
- if (result.value[1] !== 'one') return false;
+ if (result.done !== false) { return false; }
+ if (!result.value) { return false; }
+ if (result.value[0] !== 'raz') { return false; }
+ if (result.value[1] !== 'one') { return false; }
return true;
};
- var forEach$2 = Array.prototype.forEach, create$4 = Object.create;
+ var forEach$2 = Array.prototype.forEach, create$6 = Object.create;
// eslint-disable-next-line no-unused-vars
- var primitiveSet = function (arg /*, …args*/) {
- var set = create$4(null);
- forEach$2.call(arguments, function (name) {
- set[name] = true;
- });
+ var primitiveSet = function (arg/*, …args*/) {
+ var set = create$6(null);
+ forEach$2.call(arguments, function (name) { set[name] = true; });
return set;
};
var iterator$2 = createCommonjsModule(function (module) {
- var toStringTagSymbol = es6Symbol.toStringTag
+ var toStringTagSymbol = es6Symbol$1.toStringTag
, defineProperties = Object.defineProperties
, unBind = es6Iterator.prototype._unBind
, MapIterator;
MapIterator = module.exports = function (map, kind) {
- if (!(this instanceof MapIterator)) return new MapIterator(map, kind);
+ if (!(this instanceof MapIterator)) { return new MapIterator(map, kind); }
es6Iterator.call(this, map.__mapKeysData__, map);
- if (!kind || !iteratorKinds[kind]) kind = 'key+value';
+ if (!kind || !iteratorKinds[kind]) { kind = 'key+value'; }
defineProperties(this, {
__kind__: d_1('', kind),
__values__: d_1('w', map.__mapValuesData__)
});
};
- if (setPrototypeOf) setPrototypeOf(MapIterator, es6Iterator);
+ if (setPrototypeOf) { setPrototypeOf(MapIterator, es6Iterator); }
MapIterator.prototype = Object.create(es6Iterator.prototype, {
constructor: d_1(MapIterator),
_resolve: d_1(function (i) {
- if (this.__kind__ === 'value') return this.__values__[i];
- if (this.__kind__ === 'key') return this.__list__[i];
+ if (this.__kind__ === 'value') { return this.__values__[i]; }
+ if (this.__kind__ === 'key') { return this.__list__[i]; }
return [this.__list__[i], this.__values__[i]];
}),
_unBind: d_1(function () {
// Exports true if environment provides native `Map` implementation,
var isNativeImplemented$1 = (function () {
- if (typeof Map === 'undefined') return false;
+ if (typeof Map === 'undefined') { return false; }
return (Object.prototype.toString.call(new Map()) === '[object Map]');
}());
var iterator$3 = validIterable
, call$5 = Function.prototype.call
- , defineProperties$2 = Object.defineProperties, getPrototypeOf$2 = Object.getPrototypeOf
+ , defineProperties$3 = Object.defineProperties, getPrototypeOf$2 = Object.getPrototypeOf
, MapPoly;
- var polyfill$2 = MapPoly = function (/*iterable*/) {
+ var polyfill$3 = MapPoly = function (/*iterable*/) {
var iterable = arguments[0], keys, values, self;
- if (!(this instanceof MapPoly)) throw new TypeError('Constructor requires \'new\'');
+ if (!(this instanceof MapPoly)) { throw new TypeError('Constructor requires \'new\''); }
if (isNativeImplemented$1 && setPrototypeOf && (Map !== MapPoly)) {
self = setPrototypeOf(new Map(), getPrototypeOf$2(this));
} else {
self = this;
}
- if (iterable != null) iterator$3(iterable);
- defineProperties$2(self, {
+ if (iterable != null) { iterator$3(iterable); }
+ defineProperties$3(self, {
__mapKeysData__: d_1('c', keys = []),
__mapValuesData__: d_1('c', values = [])
});
- if (!iterable) return self;
+ if (!iterable) { return self; }
forOf(iterable, function (value) {
var key = validValue(value)[0];
value = value[1];
- if (eIndexOf.call(keys, key) !== -1) return;
+ if (eIndexOf.call(keys, key) !== -1) { return; }
keys.push(key);
values.push(value);
}, self);
};
if (isNativeImplemented$1) {
- if (setPrototypeOf) setPrototypeOf(MapPoly, Map);
+ if (setPrototypeOf) { setPrototypeOf(MapPoly, Map); }
MapPoly.prototype = Object.create(Map.prototype, {
constructor: d_1(MapPoly)
});
}
- eventEmitter(defineProperties$2(MapPoly.prototype, {
+ eventEmitter(defineProperties$3(MapPoly.prototype, {
clear: d_1(function () {
- if (!this.__mapKeysData__.length) return;
+ if (!this.__mapKeysData__.length) { return; }
clear.call(this.__mapKeysData__);
clear.call(this.__mapValuesData__);
this.emit('_clear');
}),
delete: d_1(function (key) {
var index = eIndexOf.call(this.__mapKeysData__, key);
- if (index === -1) return false;
+ if (index === -1) { return false; }
this.__mapKeysData__.splice(index, 1);
this.__mapValuesData__.splice(index, 1);
this.emit('_delete', index, key);
}),
get: d_1(function (key) {
var index = eIndexOf.call(this.__mapKeysData__, key);
- if (index === -1) return;
+ if (index === -1) { return; }
return this.__mapValuesData__[index];
}),
has: d_1(function (key) {
emit = true;
}
this.__mapValuesData__[index] = value;
- if (emit) this.emit('_add', index, key);
+ if (emit) { this.emit('_add', index, key); }
return this;
}),
size: d_1.gs(function () { return this.__mapKeysData__.length; }),
values: d_1(function () { return new iterator$2(this, 'value'); }),
toString: d_1(function () { return '[object Map]'; })
}));
- Object.defineProperty(MapPoly.prototype, es6Symbol.iterator, d_1(function () {
+ Object.defineProperty(MapPoly.prototype, es6Symbol$1.iterator, d_1(function () {
return this.entries();
}));
- Object.defineProperty(MapPoly.prototype, es6Symbol.toStringTag, d_1('c', 'Map'));
+ Object.defineProperty(MapPoly.prototype, es6Symbol$1.toStringTag, d_1('c', 'Map'));
- var es6Map = isImplemented$9() ? Map : polyfill$2;
+ var es6Map = isImplemented$b() ? Map : polyfill$3;
var toStr = Object.prototype.toString;
$frames: true,
$innerHeight: true,
$innerWidth: true,
+ $onmozfullscreenchange: true,
+ $onmozfullscreenerror: true,
$outerHeight: true,
$outerWidth: true,
$pageXOffset: true,
return theKeys;
};
}
- var implementation = keysShim;
+ var implementation$1 = keysShim;
var slice = Array.prototype.slice;
var origKeys = Object.keys;
- var keysShim$1 = origKeys ? function keys(o) { return origKeys(o); } : implementation;
+ var keysShim$1 = origKeys ? function keys(o) { return origKeys(o); } : implementation$1;
var originalKeys = Object.keys;
};
var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();
- var defineProperty$6 = function (object, name, value, predicate) {
+ var defineProperty$8 = function (object, name, value, predicate) {
if (name in object && (!isFunction$1(predicate) || !predicate())) {
return;
}
}
};
- var defineProperties$3 = function (object, map) {
+ var defineProperties$4 = function (object, map) {
var predicates = arguments.length > 2 ? arguments[2] : {};
var props = objectKeys(map);
if (hasSymbols) {
props = concat.call(props, Object.getOwnPropertySymbols(map));
}
for (var i = 0; i < props.length; i += 1) {
- defineProperty$6(object, props[i], map[props[i]], predicates[props[i]]);
+ defineProperty$8(object, props[i], map[props[i]], predicates[props[i]]);
}
};
- defineProperties$3.supportsDescriptors = !!supportsDescriptors;
+ defineProperties$4.supportsDescriptors = !!supportsDescriptors;
- var defineProperties_1 = defineProperties$3;
+ var defineProperties_1 = defineProperties$4;
/* eslint no-invalid-this: 1 */
var toStr$3 = Object.prototype.toString;
var funcType = '[object Function]';
- var implementation$1 = function bind(that) {
+ var implementation$2 = function bind(that) {
var target = this;
if (typeof target !== 'function' || toStr$3.call(target) !== funcType) {
throw new TypeError(ERROR_MESSAGE + target);
return bound;
};
- var functionBind = Function.prototype.bind || implementation$1;
+ var functionBind = Function.prototype.bind || implementation$2;
var src = functionBind.call(Function.call, Object.prototype.hasOwnProperty);
var genClass = '[object GeneratorFunction]';
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
- var isCallable$1 = function isCallable(value) {
+ var isCallable = function isCallable(value) {
if (!value) { return false; }
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
if (typeof value === 'function' && !value.prototype) { return true; }
return shams();
};
- var isSymbol$1 = createCommonjsModule(function (module) {
+ var isSymbol$2 = createCommonjsModule(function (module) {
var toStr = Object.prototype.toString;
var hasSymbols = hasSymbols$1();
var method, result, i;
for (i = 0; i < methodNames.length; ++i) {
method = O[methodNames[i]];
- if (isCallable$1(method)) {
+ if (isCallable(method)) {
result = method.call(O);
if (isPrimitive(result)) {
return result;
var GetMethod = function GetMethod(O, P) {
var func = O[P];
if (func !== null && typeof func !== 'undefined') {
- if (!isCallable$1(func)) {
+ if (!isCallable(func)) {
throw new TypeError(func + ' returned for property ' + P + ' of object ' + O + ' is not a function');
}
return func;
if (hasSymbols$2) {
if (Symbol.toPrimitive) {
exoticToPrim = GetMethod(input, Symbol.toPrimitive);
- } else if (isSymbol$1(input)) {
+ } else if (isSymbol$2(input)) {
exoticToPrim = Symbol.prototype.valueOf;
}
}
}
throw new TypeError('unable to convert exotic object to primitive');
}
- if (hint === 'default' && (isDateObject(input) || isSymbol$1(input))) {
+ if (hint === 'default' && (isDateObject(input) || isSymbol$2(input))) {
hint = 'string';
}
return ordinaryToPrimitive(input, hint === 'default' ? 'number' : hint);
var es6 = es2015;
- /* globals
- Set,
- Map,
- WeakSet,
- WeakMap,
+ var objectInspect = function inspect_ (obj, opts, depth, seen) {
+ if (!opts) { opts = {}; }
+
+ var maxDepth = opts.depth === undefined ? 5 : opts.depth;
+ if (depth === undefined) { depth = 0; }
+ if (depth > maxDepth && maxDepth > 0) { return '...'; }
+
+ if (seen === undefined) { seen = []; }
+ else if (indexOf$2(seen, obj) >= 0) {
+ return '[Circular]';
+ }
+
+ function inspect (value, from) {
+ if (from) {
+ seen = seen.slice();
+ seen.push(from);
+ }
+ return inspect_(value, opts, depth + 1, seen);
+ }
+
+ if (typeof obj === 'string') {
+ return inspectString(obj);
+ }
+ else if (typeof obj === 'function') {
+ var name = nameOf(obj);
+ return '[Function' + (name ? ': ' + name : '') + ']';
+ }
+ else if (obj === null) {
+ return 'null';
+ }
+ else if (isElement(obj)) {
+ var s = '<' + String(obj.nodeName).toLowerCase();
+ var attrs = obj.attributes || [];
+ for (var i = 0; i < attrs.length; i++) {
+ s += ' ' + attrs[i].name + '="' + quote(attrs[i].value) + '"';
+ }
+ s += '>';
+ if (obj.childNodes && obj.childNodes.length) { s += '...'; }
+ s += '</' + String(obj.tagName).toLowerCase() + '>';
+ return s;
+ }
+ else if (isArray$3(obj)) {
+ if (obj.length === 0) { return '[]'; }
+ var xs = Array(obj.length);
+ for (var i = 0; i < obj.length; i++) {
+ xs[i] = has$1(obj, i) ? inspect(obj[i], obj) : '';
+ }
+ return '[ ' + xs.join(', ') + ' ]';
+ }
+ else if (typeof obj === 'object' && typeof obj.inspect === 'function') {
+ return obj.inspect();
+ }
+ else if (typeof obj === 'object' && !isDate(obj) && !isRegExp(obj)) {
+ var xs = [], keys = [];
+ for (var key in obj) {
+ if (has$1(obj, key)) { keys.push(key); }
+ }
+ keys.sort();
+ for (var i = 0; i < keys.length; i++) {
+ var key = keys[i];
+ if (/[^\w$]/.test(key)) {
+ xs.push(inspect(key) + ': ' + inspect(obj[key], obj));
+ }
+ else { xs.push(key + ': ' + inspect(obj[key], obj)); }
+ }
+ if (xs.length === 0) { return '{}'; }
+ return '{ ' + xs.join(', ') + ' }';
+ }
+ else { return String(obj); }
+ };
+
+ function quote (s) {
+ return String(s).replace(/"/g, '"');
+ }
+
+ function isArray$3 (obj) {
+ return {}.toString.call(obj) === '[object Array]';
+ }
+
+ function isDate (obj) {
+ return {}.toString.call(obj) === '[object Date]';
+ }
- Promise,
+ function isRegExp (obj) {
+ return {}.toString.call(obj) === '[object RegExp]';
+ }
+
+ function has$1 (obj, key) {
+ if (!{}.hasOwnProperty) { return key in obj; }
+ return {}.hasOwnProperty.call(obj, key);
+ }
+
+ function nameOf (f) {
+ if (f.name) { return f.name; }
+ var m = f.toString().match(/^function\s*([\w$]+)/);
+ if (m) { return m[1]; }
+ }
+
+ function indexOf$2 (xs, x) {
+ if (xs.indexOf) { return xs.indexOf(x); }
+ for (var i = 0, l = xs.length; i < l; i++) {
+ if (xs[i] === x) { return i; }
+ }
+ return -1;
+ }
+
+ function isElement (x) {
+ if (!x || typeof x !== 'object') { return false; }
+ if (typeof HTMLElement !== 'undefined') {
+ return x instanceof HTMLElement;
+ }
+ else { return typeof x.nodeName === 'string'
+ && typeof x.getAttribute === 'function'
+ ; }
+ }
- Symbol,
- Proxy,
+ function inspectString (str) {
+ var s = str.replace(/(['\\])/g, '\\$1').replace(/[\x00-\x1f]/g, lowbyte);
+ return "'" + s + "'";
+
+ function lowbyte (c) {
+ var n = c.charCodeAt(0);
+ var x = { 8: 'b', 9: 't', 10: 'n', 12: 'f', 13: 'r' }[n];
+ if (x) { return '\\' + x; }
+ return '\\x' + (n < 0x10 ? '0' : '') + n.toString(16);
+ }
+ }
+ /* globals
Atomics,
SharedArrayBuffer,
-
- ArrayBuffer,
- DataView,
- Uint8Array,
- Float32Array,
- Float64Array,
- Int8Array,
- Int16Array,
- Int32Array,
- Uint8ClampedArray,
- Uint16Array,
- Uint32Array,
*/
var undefined$1; // eslint-disable-line no-shadow-restricted-names
+ var $TypeError = TypeError;
+
var ThrowTypeError = Object.getOwnPropertyDescriptor
? (function () { return Object.getOwnPropertyDescriptor(arguments, 'callee').get; }())
- : function () { throw new TypeError(); };
+ : function () { throw new $TypeError(); };
- var hasSymbols$3 = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol';
+ var hasSymbols$3 = hasSymbols$1();
var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
var generatorFunction = undefined$1;
'$ %ThrowTypeError%': ThrowTypeError,
'$ %TypedArray%': TypedArray,
'$ %TypedArrayPrototype%': TypedArray ? TypedArray.prototype : undefined$1,
- '$ %TypeError%': TypeError,
- '$ %TypeErrorPrototype%': TypeError.prototype,
+ '$ %TypeError%': $TypeError,
+ '$ %TypeErrorPrototype%': $TypeError.prototype,
'$ %Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
'$ %Uint8ArrayPrototype%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array.prototype,
'$ %Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
'$ %WeakSetPrototype%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet.prototype
};
- var GetIntrinsic = function GetIntrinsic(name, allowMissing) {
- if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
- throw new TypeError('"allowMissing" argument must be a boolean');
- }
+ var $replace = functionBind.call(Function.call, String.prototype.replace);
+
+ /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
+ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
+ var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
+ var stringToPath = function stringToPath(string) {
+ var result = [];
+ $replace(string, rePropName, function (match, number, quote, subString) {
+ result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : (number || match);
+ });
+ return result;
+ };
+ /* end adaptation */
+
+ var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
var key = '$ ' + name;
if (!(key in INTRINSICS)) {
throw new SyntaxError('intrinsic ' + name + ' does not exist!');
// istanbul ignore if // hopefully this is impossible to test :-)
if (typeof INTRINSICS[key] === 'undefined' && !allowMissing) {
- throw new TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
+ throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
}
+
return INTRINSICS[key];
};
- var $TypeError = GetIntrinsic('%TypeError%');
+ var GetIntrinsic = function GetIntrinsic(name, allowMissing) {
+ if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
+ throw new TypeError('"allowMissing" argument must be a boolean');
+ }
+
+ var parts = stringToPath(name);
+
+ if (parts.length === 0) {
+ return getBaseIntrinsic(name, allowMissing);
+ }
+
+ var value = getBaseIntrinsic('%' + parts[0] + '%', allowMissing);
+ for (var i = 1; i < parts.length; i += 1) {
+ if (value != null) {
+ value = value[parts[i]];
+ }
+ }
+ return value;
+ };
+
+ var $TypeError$1 = GetIntrinsic('%TypeError%');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var predicates = {
- // https://ecma-international.org/ecma-262/6.0/#sec-property-descriptor-specification-type
- 'Property Descriptor': function isPropertyDescriptor(ES, Desc) {
- if (ES.Type(Desc) !== 'Object') {
- return false;
- }
- var allowed = {
- '[[Configurable]]': true,
- '[[Enumerable]]': true,
- '[[Get]]': true,
- '[[Set]]': true,
- '[[Value]]': true,
- '[[Writable]]': true
- };
+ // https://ecma-international.org/ecma-262/6.0/#sec-property-descriptor-specification-type
+ 'Property Descriptor': function isPropertyDescriptor(ES, Desc) {
+ if (ES.Type(Desc) !== 'Object') {
+ return false;
+ }
+ var allowed = {
+ '[[Configurable]]': true,
+ '[[Enumerable]]': true,
+ '[[Get]]': true,
+ '[[Set]]': true,
+ '[[Value]]': true,
+ '[[Writable]]': true
+ };
- for (var key in Desc) { // eslint-disable-line
- if (src(Desc, key) && !allowed[key]) {
- return false;
- }
- }
+ for (var key in Desc) { // eslint-disable-line
+ if (src(Desc, key) && !allowed[key]) {
+ return false;
+ }
+ }
- var isData = src(Desc, '[[Value]]');
- var IsAccessor = src(Desc, '[[Get]]') || src(Desc, '[[Set]]');
- if (isData && IsAccessor) {
- throw new $TypeError('Property Descriptors may not be both accessor and data descriptors');
- }
- return true;
- }
+ var isData = src(Desc, '[[Value]]');
+ var IsAccessor = src(Desc, '[[Get]]') || src(Desc, '[[Set]]');
+ if (isData && IsAccessor) {
+ throw new $TypeError$1('Property Descriptors may not be both accessor and data descriptors');
+ }
+ return true;
+ }
};
var assertRecord = function assertRecord(ES, recordType, argumentName, value) {
- var predicate = predicates[recordType];
- if (typeof predicate !== 'function') {
- throw new $SyntaxError('unknown record type: ' + recordType);
- }
- if (!predicate(ES, value)) {
- throw new $TypeError(argumentName + ' must be a ' + recordType);
- }
- console.log(predicate(ES, value), value);
+ var predicate = predicates[recordType];
+ if (typeof predicate !== 'function') {
+ throw new $SyntaxError('unknown record type: ' + recordType);
+ }
+ if (!predicate(ES, value)) {
+ throw new $TypeError$1(argumentName + ' must be a ' + recordType);
+ }
};
var _isNaN = Number.isNaN || function isNaN(a) {
var _isFinite = Number.isFinite || function (x) { return typeof x === 'number' && !$isNaN(x) && x !== Infinity && x !== -Infinity; };
- var has$1 = functionBind.call(Function.call, Object.prototype.hasOwnProperty);
+ var $Math = GetIntrinsic('%Math%');
+ var $Number = GetIntrinsic('%Number%');
+
+ var maxSafeInteger = $Number.MAX_SAFE_INTEGER || $Math.pow(2, 53) - 1;
- var $assign = Object.assign;
+ var $assign = GetIntrinsic('%Object%').assign;
var assign$1 = function assign(target, source) {
if ($assign) {
return $assign(target, source);
}
+ // eslint-disable-next-line no-restricted-syntax
for (var key in source) {
- if (has$1(source, key)) {
+ if (src(source, key)) {
target[key] = source[key];
}
}
return value === null || (typeof value !== 'function' && typeof value !== 'object');
};
+ var forEach$3 = function forEach(array, callback) {
+ for (var i = 0; i < array.length; i += 1) {
+ callback(array[i], i, array); // eslint-disable-line callback-return
+ }
+ };
+
+ var every = function every(array, predicate) {
+ for (var i = 0; i < array.length; i += 1) {
+ if (!predicate(array[i], i, array)) {
+ return false;
+ }
+ }
+ return true;
+ };
+
+ var isSamePropertyDescriptor = function isSamePropertyDescriptor(ES, D1, D2) {
+ var fields = [
+ '[[Configurable]]',
+ '[[Enumerable]]',
+ '[[Get]]',
+ '[[Set]]',
+ '[[Value]]',
+ '[[Writable]]'
+ ];
+ return every(fields, function (field) {
+ if ((field in D1) !== (field in D2)) {
+ return false;
+ }
+ return ES.SameValue(D1[field], D2[field]);
+ });
+ };
+
+ var $TypeError$2 = GetIntrinsic('%TypeError%');
+
+ var isPropertyDescriptor = function IsPropertyDescriptor(ES, Desc) {
+ if (ES.Type(Desc) !== 'Object') {
+ return false;
+ }
+ var allowed = {
+ '[[Configurable]]': true,
+ '[[Enumerable]]': true,
+ '[[Get]]': true,
+ '[[Set]]': true,
+ '[[Value]]': true,
+ '[[Writable]]': true
+ };
+
+ for (var key in Desc) { // eslint-disable-line
+ if (src(Desc, key) && !allowed[key]) {
+ return false;
+ }
+ }
+
+ if (ES.IsDataDescriptor(Desc) && ES.IsAccessorDescriptor(Desc)) {
+ throw new $TypeError$2('Property Descriptors may not be both accessor and data descriptors');
+ }
+ return true;
+ };
+
+ var $Function = GetIntrinsic('%Function%');
+ var $apply = $Function.apply;
+ var $call = $Function.call;
+
+ var callBind = function callBind() {
+ return functionBind.apply($call, arguments);
+ };
+
+ var apply = function applyBind() {
+ return functionBind.apply($apply, arguments);
+ };
+ callBind.apply = apply;
+
+ var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
+
+ var callBound = function callBoundIntrinsic(name, allowMissing) {
+ var intrinsic = GetIntrinsic(name, !!allowMissing);
+ if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.')) {
+ return callBind(intrinsic);
+ }
+ return intrinsic;
+ };
+
+ var $test = GetIntrinsic('RegExp.prototype.test');
+
+
+
+ var regexTester = function regexTester(regex) {
+ return callBind($test, regex);
+ };
+
+ var hasSymbols$4 = hasSymbols$1();
+
+
+
+ var $iterator = GetIntrinsic('%Symbol.iterator%', true);
+ var $arraySlice = callBound('Array.prototype.slice');
+ var $arrayJoin = callBound('Array.prototype.join');
+
+ var getIteratorMethod = function getIteratorMethod(ES, iterable) {
+ var usingIterator;
+ if (hasSymbols$4) {
+ usingIterator = ES.GetMethod(iterable, $iterator);
+ } else if (ES.IsArray(iterable)) {
+ usingIterator = function () {
+ var i = -1;
+ var arr = this; // eslint-disable-line no-invalid-this
+ return {
+ next: function () {
+ i += 1;
+ return {
+ done: i >= arr.length,
+ value: arr[i]
+ };
+ }
+ };
+ };
+ } else if (ES.Type(iterable) === 'String') {
+ usingIterator = function () {
+ var i = 0;
+ return {
+ next: function () {
+ var nextIndex = ES.AdvanceStringIndex(iterable, i, true);
+ var value = $arrayJoin($arraySlice(iterable, i, nextIndex), '');
+ i = nextIndex;
+ return {
+ done: nextIndex > iterable.length,
+ value: value
+ };
+ }
+ };
+ };
+ }
+ return usingIterator;
+ };
+
+ var getInferredName;
+ try {
+ // eslint-disable-next-line no-new-func
+ getInferredName = Function('s', 'return { [s]() {} }[s].name;');
+ } catch (e) {}
+
+ var inferred = function () {};
+ var getInferredName_1 = getInferredName && inferred.name === 'inferred' ? getInferredName : null;
+
+ var $SyntaxError$1 = GetIntrinsic('%SyntaxError%');
+ var symToStr = callBound('Symbol.prototype.toString', true);
+
+
+
+ var getSymbolDescription = function getSymbolDescription(symbol) {
+ if (!symToStr) {
+ throw new $SyntaxError$1('Symbols are not supported in this environment');
+ }
+ var str = symToStr(symbol); // will throw if not a symbol
+
+ if (getInferredName_1) {
+ var name = getInferredName_1(symbol);
+ if (name === '') { return; }
+ // eslint-disable-next-line consistent-return
+ return name.slice(1, -1); // name.slice('['.length, -']'.length);
+ }
+
+ var desc = str.slice(7, -1); // str.slice('Symbol('.length, -')'.length);
+ if (desc) {
+ // eslint-disable-next-line consistent-return
+ return desc;
+ }
+ };
+
+ var originalSetProto = GetIntrinsic('%Object.setPrototypeOf%', true);
+ var $ArrayProto = GetIntrinsic('%Array.prototype%');
+
+ var setProto = originalSetProto || (
+ // eslint-disable-next-line no-proto, no-negated-condition
+ [].__proto__ !== $ArrayProto
+ ? null
+ : function (O, proto) {
+ O.__proto__ = proto; // eslint-disable-line no-proto
+ return O;
+ }
+ );
+
+ var $strSlice = callBound('String.prototype.slice');
+
+ var isPrefixOf = function isPrefixOf(prefix, string) {
+ if (prefix === string) {
+ return true;
+ }
+ if (prefix.length > string.length) {
+ return false;
+ }
+ return $strSlice(string, 0, prefix.length) === prefix;
+ };
+
var toStr$6 = Object.prototype.toString;
var methods = actualHint === String ? ['toString', 'valueOf'] : ['valueOf', 'toString'];
var value, i;
for (i = 0; i < methods.length; ++i) {
- if (isCallable$1(O[methods[i]])) {
+ if (isCallable(O[methods[i]])) {
value = O[methods[i]]();
if (isPrimitive(value)) {
return value;
};
var $Object = GetIntrinsic('%Object%');
- var $TypeError$1 = GetIntrinsic('%TypeError%');
+ var $EvalError = GetIntrinsic('%EvalError%');
+ var $TypeError$3 = GetIntrinsic('%TypeError%');
var $String = GetIntrinsic('%String%');
+ var $Date = GetIntrinsic('%Date%');
+ var $Number$1 = GetIntrinsic('%Number%');
+ var $floor = GetIntrinsic('%Math.floor%');
+ var $DateUTC = GetIntrinsic('%Date.UTC%');
+ var $abs = GetIntrinsic('%Math.abs%');
+
+
+
+ var $getUTCFullYear = callBound('Date.prototype.getUTCFullYear');
+
+ var HoursPerDay = 24;
+ var MinutesPerHour = 60;
+ var SecondsPerMinute = 60;
+ var msPerSecond = 1e3;
+ var msPerMinute = msPerSecond * SecondsPerMinute;
+ var msPerHour = msPerMinute * MinutesPerHour;
+ var msPerDay = 86400000;
// https://es5.github.io/#x9
var ES5 = {
CheckObjectCoercible: function CheckObjectCoercible(value, optMessage) {
/* jshint eqnull:true */
if (value == null) {
- throw new $TypeError$1(optMessage || 'Cannot call method on ' + value);
+ throw new $TypeError$3(optMessage || 'Cannot call method on ' + value);
}
return value;
},
- IsCallable: isCallable$1,
+ IsCallable: isCallable,
SameValue: function SameValue(x, y) {
if (x === y) { // 0 === -0, but they are not identical.
if (x === 0) { return 1 / x === 1 / y; }
return _isNaN(x) && _isNaN(y);
},
- // https://www.ecma-international.org/ecma-262/5.1/#sec-8
+ // https://ecma-international.org/ecma-262/5.1/#sec-8
Type: function Type(x) {
if (x === null) {
return 'Null';
// https://ecma-international.org/ecma-262/6.0/#sec-property-descriptor-specification-type
IsPropertyDescriptor: function IsPropertyDescriptor(Desc) {
- if (this.Type(Desc) !== 'Object') {
- return false;
- }
- var allowed = {
- '[[Configurable]]': true,
- '[[Enumerable]]': true,
- '[[Get]]': true,
- '[[Set]]': true,
- '[[Value]]': true,
- '[[Writable]]': true
- };
-
- for (var key in Desc) { // eslint-disable-line
- if (src(Desc, key) && !allowed[key]) {
- return false;
- }
- }
-
- var isData = src(Desc, '[[Value]]');
- var IsAccessor = src(Desc, '[[Get]]') || src(Desc, '[[Set]]');
- if (isData && IsAccessor) {
- throw new $TypeError$1('Property Descriptors may not be both accessor and data descriptors');
- }
- return true;
+ return isPropertyDescriptor(this, Desc);
},
// https://ecma-international.org/ecma-262/5.1/#sec-8.10.1
configurable: !!Desc['[[Configurable]]']
};
} else {
- throw new $TypeError$1('FromPropertyDescriptor must be called with a fully populated Property Descriptor');
+ throw new $TypeError$3('FromPropertyDescriptor must be called with a fully populated Property Descriptor');
}
},
// https://ecma-international.org/ecma-262/5.1/#sec-8.10.5
ToPropertyDescriptor: function ToPropertyDescriptor(Obj) {
if (this.Type(Obj) !== 'Object') {
- throw new $TypeError$1('ToPropertyDescriptor requires an object');
+ throw new $TypeError$3('ToPropertyDescriptor requires an object');
}
var desc = {};
if (src(Obj, 'set')) {
var setter = Obj.set;
if (typeof setter !== 'undefined' && !this.IsCallable(setter)) {
- throw new $TypeError$1('setter must be a function');
+ throw new $TypeError$3('setter must be a function');
}
desc['[[Set]]'] = setter;
}
if ((src(desc, '[[Get]]') || src(desc, '[[Set]]')) && (src(desc, '[[Value]]') || src(desc, '[[Writable]]'))) {
- throw new $TypeError$1('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute');
+ throw new $TypeError$3('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute');
}
return desc;
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-11.9.3
+ 'Abstract Equality Comparison': function AbstractEqualityComparison(x, y) {
+ var xType = this.Type(x);
+ var yType = this.Type(y);
+ if (xType === yType) {
+ return x === y; // ES6+ specified this shortcut anyways.
+ }
+ if (x == null && y == null) {
+ return true;
+ }
+ if (xType === 'Number' && yType === 'String') {
+ return this['Abstract Equality Comparison'](x, this.ToNumber(y));
+ }
+ if (xType === 'String' && yType === 'Number') {
+ return this['Abstract Equality Comparison'](this.ToNumber(x), y);
+ }
+ if (xType === 'Boolean') {
+ return this['Abstract Equality Comparison'](this.ToNumber(x), y);
+ }
+ if (yType === 'Boolean') {
+ return this['Abstract Equality Comparison'](x, this.ToNumber(y));
+ }
+ if ((xType === 'String' || xType === 'Number') && yType === 'Object') {
+ return this['Abstract Equality Comparison'](x, this.ToPrimitive(y));
+ }
+ if (xType === 'Object' && (yType === 'String' || yType === 'Number')) {
+ return this['Abstract Equality Comparison'](this.ToPrimitive(x), y);
+ }
+ return false;
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-11.9.6
+ 'Strict Equality Comparison': function StrictEqualityComparison(x, y) {
+ var xType = this.Type(x);
+ var yType = this.Type(y);
+ if (xType !== yType) {
+ return false;
+ }
+ if (xType === 'Undefined' || xType === 'Null') {
+ return true;
+ }
+ return x === y; // shortcut for steps 4-7
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-11.8.5
+ // eslint-disable-next-line max-statements
+ 'Abstract Relational Comparison': function AbstractRelationalComparison(x, y, LeftFirst) {
+ if (this.Type(LeftFirst) !== 'Boolean') {
+ throw new $TypeError$3('Assertion failed: LeftFirst argument must be a Boolean');
+ }
+ var px;
+ var py;
+ if (LeftFirst) {
+ px = this.ToPrimitive(x, $Number$1);
+ py = this.ToPrimitive(y, $Number$1);
+ } else {
+ py = this.ToPrimitive(y, $Number$1);
+ px = this.ToPrimitive(x, $Number$1);
+ }
+ var bothStrings = this.Type(px) === 'String' && this.Type(py) === 'String';
+ if (!bothStrings) {
+ var nx = this.ToNumber(px);
+ var ny = this.ToNumber(py);
+ if (_isNaN(nx) || _isNaN(ny)) {
+ return undefined;
+ }
+ if (_isFinite(nx) && _isFinite(ny) && nx === ny) {
+ return false;
+ }
+ if (nx === 0 && ny === 0) {
+ return false;
+ }
+ if (nx === Infinity) {
+ return false;
+ }
+ if (ny === Infinity) {
+ return true;
+ }
+ if (ny === -Infinity) {
+ return false;
+ }
+ if (nx === -Infinity) {
+ return true;
+ }
+ return nx < ny; // by now, these are both nonzero, finite, and not equal
+ }
+ if (isPrefixOf(py, px)) {
+ return false;
+ }
+ if (isPrefixOf(px, py)) {
+ return true;
+ }
+ return px < py; // both strings, neither a prefix of the other. shortcut for steps c-f
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.10
+ msFromTime: function msFromTime(t) {
+ return mod(t, msPerSecond);
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.10
+ SecFromTime: function SecFromTime(t) {
+ return mod($floor(t / msPerSecond), SecondsPerMinute);
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.10
+ MinFromTime: function MinFromTime(t) {
+ return mod($floor(t / msPerMinute), MinutesPerHour);
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.10
+ HourFromTime: function HourFromTime(t) {
+ return mod($floor(t / msPerHour), HoursPerDay);
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.2
+ Day: function Day(t) {
+ return $floor(t / msPerDay);
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.2
+ TimeWithinDay: function TimeWithinDay(t) {
+ return mod(t, msPerDay);
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.3
+ DayFromYear: function DayFromYear(y) {
+ return (365 * (y - 1970)) + $floor((y - 1969) / 4) - $floor((y - 1901) / 100) + $floor((y - 1601) / 400);
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.3
+ TimeFromYear: function TimeFromYear(y) {
+ return msPerDay * this.DayFromYear(y);
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.3
+ YearFromTime: function YearFromTime(t) {
+ // largest y such that this.TimeFromYear(y) <= t
+ return $getUTCFullYear(new $Date(t));
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.6
+ WeekDay: function WeekDay(t) {
+ return mod(this.Day(t) + 4, 7);
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.3
+ DaysInYear: function DaysInYear(y) {
+ if (mod(y, 4) !== 0) {
+ return 365;
+ }
+ if (mod(y, 100) !== 0) {
+ return 366;
+ }
+ if (mod(y, 400) !== 0) {
+ return 365;
+ }
+ return 366;
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.3
+ InLeapYear: function InLeapYear(t) {
+ var days = this.DaysInYear(this.YearFromTime(t));
+ if (days === 365) {
+ return 0;
+ }
+ if (days === 366) {
+ return 1;
+ }
+ throw new $EvalError('Assertion failed: there are not 365 or 366 days in a year, got: ' + days);
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.4
+ DayWithinYear: function DayWithinYear(t) {
+ return this.Day(t) - this.DayFromYear(this.YearFromTime(t));
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.4
+ MonthFromTime: function MonthFromTime(t) {
+ var day = this.DayWithinYear(t);
+ if (0 <= day && day < 31) {
+ return 0;
+ }
+ var leap = this.InLeapYear(t);
+ if (31 <= day && day < (59 + leap)) {
+ return 1;
+ }
+ if ((59 + leap) <= day && day < (90 + leap)) {
+ return 2;
+ }
+ if ((90 + leap) <= day && day < (120 + leap)) {
+ return 3;
+ }
+ if ((120 + leap) <= day && day < (151 + leap)) {
+ return 4;
+ }
+ if ((151 + leap) <= day && day < (181 + leap)) {
+ return 5;
+ }
+ if ((181 + leap) <= day && day < (212 + leap)) {
+ return 6;
+ }
+ if ((212 + leap) <= day && day < (243 + leap)) {
+ return 7;
+ }
+ if ((243 + leap) <= day && day < (273 + leap)) {
+ return 8;
+ }
+ if ((273 + leap) <= day && day < (304 + leap)) {
+ return 9;
+ }
+ if ((304 + leap) <= day && day < (334 + leap)) {
+ return 10;
+ }
+ if ((334 + leap) <= day && day < (365 + leap)) {
+ return 11;
+ }
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.5
+ DateFromTime: function DateFromTime(t) {
+ var m = this.MonthFromTime(t);
+ var d = this.DayWithinYear(t);
+ if (m === 0) {
+ return d + 1;
+ }
+ if (m === 1) {
+ return d - 30;
+ }
+ var leap = this.InLeapYear(t);
+ if (m === 2) {
+ return d - 58 - leap;
+ }
+ if (m === 3) {
+ return d - 89 - leap;
+ }
+ if (m === 4) {
+ return d - 119 - leap;
+ }
+ if (m === 5) {
+ return d - 150 - leap;
+ }
+ if (m === 6) {
+ return d - 180 - leap;
+ }
+ if (m === 7) {
+ return d - 211 - leap;
+ }
+ if (m === 8) {
+ return d - 242 - leap;
+ }
+ if (m === 9) {
+ return d - 272 - leap;
+ }
+ if (m === 10) {
+ return d - 303 - leap;
+ }
+ if (m === 11) {
+ return d - 333 - leap;
+ }
+ throw new $EvalError('Assertion failed: MonthFromTime returned an impossible value: ' + m);
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.12
+ MakeDay: function MakeDay(year, month, date) {
+ if (!_isFinite(year) || !_isFinite(month) || !_isFinite(date)) {
+ return NaN;
+ }
+ var y = this.ToInteger(year);
+ var m = this.ToInteger(month);
+ var dt = this.ToInteger(date);
+ var ym = y + $floor(m / 12);
+ var mn = mod(m, 12);
+ var t = $DateUTC(ym, mn, 1);
+ if (this.YearFromTime(t) !== ym || this.MonthFromTime(t) !== mn || this.DateFromTime(t) !== 1) {
+ return NaN;
+ }
+ return this.Day(t) + dt - 1;
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.13
+ MakeDate: function MakeDate(day, time) {
+ if (!_isFinite(day) || !_isFinite(time)) {
+ return NaN;
+ }
+ return (day * msPerDay) + time;
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.11
+ MakeTime: function MakeTime(hour, min, sec, ms) {
+ if (!_isFinite(hour) || !_isFinite(min) || !_isFinite(sec) || !_isFinite(ms)) {
+ return NaN;
+ }
+ var h = this.ToInteger(hour);
+ var m = this.ToInteger(min);
+ var s = this.ToInteger(sec);
+ var milli = this.ToInteger(ms);
+ var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli;
+ return t;
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.14
+ TimeClip: function TimeClip(time) {
+ if (!_isFinite(time) || $abs(time) > 8.64e15) {
+ return NaN;
+ }
+ return $Number$1(new $Date(this.ToNumber(time)));
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-5.2
+ modulo: function modulo(x, y) {
+ return mod(x, y);
}
};
return tryRegexExecCall(value);
};
- var $TypeError$2 = GetIntrinsic('%TypeError%');
- var $SyntaxError$1 = GetIntrinsic('%SyntaxError%');
+ var $TypeError$4 = GetIntrinsic('%TypeError%');
+ var $RangeError = GetIntrinsic('%RangeError%');
+ var $SyntaxError$2 = GetIntrinsic('%SyntaxError%');
var $Array = GetIntrinsic('%Array%');
+ var $ArrayPrototype = $Array.prototype;
var $String$1 = GetIntrinsic('%String%');
var $Object$1 = GetIntrinsic('%Object%');
- var $Number = GetIntrinsic('%Number%');
+ var $Number$2 = GetIntrinsic('%Number%');
var $Symbol = GetIntrinsic('%Symbol%', true);
var $RegExp = GetIntrinsic('%RegExp%');
+ var $Date$1 = GetIntrinsic('%Date%');
+ var $Function$1 = GetIntrinsic('%Function%');
+ var $preventExtensions = $Object$1.preventExtensions;
+
+ var hasSymbols$5 = hasSymbols$1();
+
+
+
+
+ var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1;
- var hasSymbols$4 = !!$Symbol;
- var MAX_SAFE_INTEGER = $Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1;
var parseInteger = parseInt;
- var arraySlice = functionBind.call(Function.call, $Array.prototype.slice);
- var strSlice = functionBind.call(Function.call, $String$1.prototype.slice);
- var isBinary = functionBind.call(Function.call, $RegExp.prototype.test, /^0b[01]+$/i);
- var isOctal = functionBind.call(Function.call, $RegExp.prototype.test, /^0o[0-7]+$/i);
- var regexExec$1 = functionBind.call(Function.call, $RegExp.prototype.exec);
+
+
+
+
+ var $PromiseThen = callBound('Promise.prototype.then', true);
+ var arraySlice = callBound('Array.prototype.slice');
+ var strSlice = callBound('String.prototype.slice');
+ var $indexOf$1 = callBound('Array.prototype.indexOf');
+ var $push = callBound('Array.prototype.push');
+
+ var isBinary = regexTester(/^0b[01]+$/i);
+ var isOctal = regexTester(/^0o[0-7]+$/i);
+ var isDigit = regexTester(/^[0-9]$/);
+ var regexExec$1 = callBound('RegExp.prototype.exec');
var nonWS = ['\u0085', '\u200b', '\ufffe'].join('');
var nonWSregex = new $RegExp('[' + nonWS + ']', 'g');
- var hasNonWS = functionBind.call(Function.call, $RegExp.prototype.test, nonWSregex);
- var invalidHexLiteral = /^[-+]0x[0-9a-f]+$/i;
- var isInvalidHexLiteral = functionBind.call(Function.call, $RegExp.prototype.test, invalidHexLiteral);
- var $charCodeAt = functionBind.call(Function.call, $String$1.prototype.charCodeAt);
+ var hasNonWS = regexTester(nonWSregex);
+ var isInvalidHexLiteral = regexTester(/^[-+]0x[0-9a-f]+$/i);
+ var $charCodeAt = callBound('String.prototype.charCodeAt');
+ var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');
- var toStr$8 = functionBind.call(Function.call, Object.prototype.toString);
+ var toStr$8 = callBound('Object.prototype.toString');
- var $NumberValueOf = functionBind.call(Function.call, GetIntrinsic('%NumberPrototype%').valueOf);
- var $BooleanValueOf = functionBind.call(Function.call, GetIntrinsic('%BooleanPrototype%').valueOf);
- var $StringValueOf = functionBind.call(Function.call, GetIntrinsic('%StringPrototype%').valueOf);
- var $DateValueOf = functionBind.call(Function.call, GetIntrinsic('%DatePrototype%').valueOf);
+ var $NumberValueOf = callBound('Number.prototype.valueOf');
+ var $BooleanValueOf = callBound('Boolean.prototype.valueOf');
+ var $StringValueOf = callBound('String.prototype.valueOf');
+ var $DateValueOf = callBound('Date.prototype.valueOf');
+ var $SymbolToString = callBound('Symbol.prototype.toString', true);
- var $floor = Math.floor;
- var $abs = Math.abs;
+ var $floor$1 = Math.floor;
+ var $abs$1 = Math.abs;
- var $ObjectCreate = Object.create;
+ var $ObjectCreate = $Object$1.create;
var $gOPD = $Object$1.getOwnPropertyDescriptor;
-
+ var $gOPN = $Object$1.getOwnPropertyNames;
+ var $gOPS = $Object$1.getOwnPropertySymbols;
var $isExtensible = $Object$1.isExtensible;
-
var $defineProperty = $Object$1.defineProperty;
- // whitespace from: http://es5.github.io/#x15.5.4.20
+
+ var DefineOwnProperty = function DefineOwnProperty(ES, O, P, desc) {
+ if (!$defineProperty) {
+ if (!ES.IsDataDescriptor(desc)) {
+ // ES3 does not support getters/setters
+ return false;
+ }
+ if (!desc['[[Configurable]]'] || !desc['[[Writable]]']) {
+ return false;
+ }
+
+ // fallback for ES3
+ if (P in O && $isEnumerable(O, P) !== !!desc['[[Enumerable]]']) {
+ // a non-enumerable existing property
+ return false;
+ }
+
+ // property does not exist at all, or exists but is enumerable
+ var V = desc['[[Value]]'];
+ O[P] = V; // will use [[Define]]
+ return ES.SameValue(O[P], V);
+ }
+ $defineProperty(O, P, ES.FromPropertyDescriptor(desc));
+ return true;
+ };
+
+ // whitespace from: https://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',
'\u2029\uFEFF'
].join('');
var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g');
- var replace = functionBind.call(Function.call, $String$1.prototype.replace);
+ var $replace$1 = callBound('String.prototype.replace');
var trim = function (value) {
- return replace(value, trimRegex, '');
+ return $replace$1(value, trimRegex, '');
};
Call: function Call(F, V) {
var args = arguments.length > 2 ? arguments[2] : [];
if (!this.IsCallable(F)) {
- throw new $TypeError$2(F + ' is not a function');
+ throw new $TypeError$4(objectInspect(F) + ' is not a function');
}
return F.apply(V, args);
},
// https://ecma-international.org/ecma-262/6.0/#sec-tonumber
ToNumber: function ToNumber(argument) {
- var value = isPrimitive$1(argument) ? argument : es6(argument, $Number);
+ var value = isPrimitive$1(argument) ? argument : es6(argument, $Number$2);
if (typeof value === 'symbol') {
- throw new $TypeError$2('Cannot convert a Symbol value to a number');
+ throw new $TypeError$4('Cannot convert a Symbol value to a number');
}
if (typeof value === 'string') {
if (isBinary(value)) {
}
}
}
- return $Number(value);
+ return $Number$2(value);
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger
ToUint8: function ToUint8(argument) {
var number = this.ToNumber(argument);
if (_isNaN(number) || number === 0 || !_isFinite(number)) { return 0; }
- var posInt = sign$1(number) * $floor($abs(number));
+ var posInt = sign$1(number) * $floor$1($abs$1(number));
return mod(posInt, 0x100);
},
var number = this.ToNumber(argument);
if (_isNaN(number) || number <= 0) { return 0; }
if (number >= 0xFF) { return 0xFF; }
- var f = $floor(argument);
+ var f = $floor$1(argument);
if (f + 0.5 < number) { return f + 1; }
if (number < f + 0.5) { return f; }
if (f % 2 !== 0) { return f + 1; }
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring
ToString: function ToString(argument) {
if (typeof argument === 'symbol') {
- throw new $TypeError$2('Cannot convert a Symbol value to a string');
+ throw new $TypeError$4('Cannot convert a Symbol value to a string');
}
return $String$1(argument);
},
ToLength: function ToLength(argument) {
var len = this.ToInteger(argument);
if (len <= 0) { return 0; } // includes converting -0 to +0
- if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; }
+ if (len > maxSafeInteger) { return maxSafeInteger; }
return len;
},
// https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring
CanonicalNumericIndexString: function CanonicalNumericIndexString(argument) {
if (toStr$8(argument) !== '[object String]') {
- throw new $TypeError$2('must be a string');
+ throw new $TypeError$4('must be a string');
}
if (argument === '-0') { return -0; }
var n = this.ToNumber(argument);
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor
IsConstructor: function IsConstructor(argument) {
- return typeof argument === 'function' && !!argument.prototype; // unfortunately there's no way to truly check this without try/catch `new argument`
+ return typeof argument === 'function' && !!argument.prototype; // unfortunately there's no way to truly check this without try/catch `new argument` or Proxy
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o
- IsExtensible: Object.preventExtensions
+ IsExtensible: $preventExtensions
? function IsExtensible(obj) {
if (isPrimitive$1(obj)) {
return false;
if (typeof argument !== 'number' || _isNaN(argument) || !_isFinite(argument)) {
return false;
}
- var abs = $abs(argument);
- return $floor(abs) === abs;
+ var abs = $abs$1(argument);
+ return $floor$1(abs) === abs;
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey
if (!argument || typeof argument !== 'object') {
return false;
}
- if (hasSymbols$4) {
+ if (hasSymbols$5) {
var isRegExp = argument[$Symbol.match];
if (typeof isRegExp !== 'undefined') {
return es5$1.ToBoolean(isRegExp);
GetV: function GetV(V, P) {
// 7.3.2.1
if (!this.IsPropertyKey(P)) {
- throw new $TypeError$2('Assertion failed: IsPropertyKey(P) is not true');
+ throw new $TypeError$4('Assertion failed: IsPropertyKey(P) is not true');
}
// 7.3.2.2-3
GetMethod: function GetMethod(O, P) {
// 7.3.9.1
if (!this.IsPropertyKey(P)) {
- throw new $TypeError$2('Assertion failed: IsPropertyKey(P) is not true');
+ throw new $TypeError$4('Assertion failed: IsPropertyKey(P) is not true');
}
// 7.3.9.2
// 7.3.9.5
if (!this.IsCallable(func)) {
- throw new $TypeError$2(P + 'is not a function');
+ throw new $TypeError$4(P + 'is not a function');
}
// 7.3.9.6
Get: function Get(O, P) {
// 7.3.1.1
if (this.Type(O) !== 'Object') {
- throw new $TypeError$2('Assertion failed: Type(O) is not Object');
+ throw new $TypeError$4('Assertion failed: Type(O) is not Object');
}
// 7.3.1.2
if (!this.IsPropertyKey(P)) {
- throw new $TypeError$2('Assertion failed: IsPropertyKey(P) is not true');
+ throw new $TypeError$4('Assertion failed: IsPropertyKey(P) is not true, got ' + objectInspect(P));
}
// 7.3.1.3
return O[P];
// https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor
SpeciesConstructor: function SpeciesConstructor(O, defaultConstructor) {
if (this.Type(O) !== 'Object') {
- throw new $TypeError$2('Assertion failed: Type(O) is not Object');
+ throw new $TypeError$4('Assertion failed: Type(O) is not Object');
}
var C = O.constructor;
if (typeof C === 'undefined') {
return defaultConstructor;
}
if (this.Type(C) !== 'Object') {
- throw new $TypeError$2('O.constructor is not an Object');
+ throw new $TypeError$4('O.constructor is not an Object');
}
- var S = hasSymbols$4 && $Symbol.species ? C[$Symbol.species] : void 0;
+ var S = hasSymbols$5 && $Symbol.species ? C[$Symbol.species] : void 0;
if (S == null) {
return defaultConstructor;
}
if (this.IsConstructor(S)) {
return S;
}
- throw new $TypeError$2('no constructor found');
+ throw new $TypeError$4('no constructor found');
+ },
+
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor
+ FromPropertyDescriptor: function FromPropertyDescriptor(Desc) {
+ if (typeof Desc === 'undefined') {
+ return Desc;
+ }
+
+ assertRecord(this, 'Property Descriptor', 'Desc', Desc);
+
+ var obj = {};
+ if ('[[Value]]' in Desc) {
+ obj.value = Desc['[[Value]]'];
+ }
+ if ('[[Writable]]' in Desc) {
+ obj.writable = Desc['[[Writable]]'];
+ }
+ if ('[[Get]]' in Desc) {
+ obj.get = Desc['[[Get]]'];
+ }
+ if ('[[Set]]' in Desc) {
+ obj.set = Desc['[[Set]]'];
+ }
+ if ('[[Enumerable]]' in Desc) {
+ obj.enumerable = Desc['[[Enumerable]]'];
+ }
+ if ('[[Configurable]]' in Desc) {
+ obj.configurable = Desc['[[Configurable]]'];
+ }
+ return obj;
},
// https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor
// https://ecma-international.org/ecma-262/6.0/#sec-set-o-p-v-throw
Set: function Set(O, P, V, Throw) {
if (this.Type(O) !== 'Object') {
- throw new $TypeError$2('O must be an Object');
+ throw new $TypeError$4('O must be an Object');
}
if (!this.IsPropertyKey(P)) {
- throw new $TypeError$2('P must be a Property Key');
+ throw new $TypeError$4('P must be a Property Key');
}
if (this.Type(Throw) !== 'Boolean') {
- throw new $TypeError$2('Throw must be a Boolean');
+ throw new $TypeError$4('Throw must be a Boolean');
}
if (Throw) {
O[P] = V;
// https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty
HasOwnProperty: function HasOwnProperty(O, P) {
if (this.Type(O) !== 'Object') {
- throw new $TypeError$2('O must be an Object');
+ throw new $TypeError$4('O must be an Object');
}
if (!this.IsPropertyKey(P)) {
- throw new $TypeError$2('P must be a Property Key');
+ throw new $TypeError$4('P must be a Property Key');
}
return src(O, P);
},
// https://ecma-international.org/ecma-262/6.0/#sec-hasproperty
HasProperty: function HasProperty(O, P) {
if (this.Type(O) !== 'Object') {
- throw new $TypeError$2('O must be an Object');
+ throw new $TypeError$4('O must be an Object');
}
if (!this.IsPropertyKey(P)) {
- throw new $TypeError$2('P must be a Property Key');
+ throw new $TypeError$4('P must be a Property Key');
}
return P in O;
},
if (this.Type(O) !== 'Object') {
return false;
}
- if (hasSymbols$4 && typeof $Symbol.isConcatSpreadable === 'symbol') {
+ if (hasSymbols$5 && typeof $Symbol.isConcatSpreadable === 'symbol') {
var spreadable = this.Get(O, Symbol.isConcatSpreadable);
if (typeof spreadable !== 'undefined') {
return this.ToBoolean(spreadable);
// https://ecma-international.org/ecma-262/6.0/#sec-invoke
Invoke: function Invoke(O, P) {
if (!this.IsPropertyKey(P)) {
- throw new $TypeError$2('P must be a Property Key');
+ throw new $TypeError$4('P must be a Property Key');
}
var argumentsList = arraySlice(arguments, 2);
var func = this.GetV(O, P);
// https://ecma-international.org/ecma-262/6.0/#sec-getiterator
GetIterator: function GetIterator(obj, method) {
- if (!hasSymbols$4) {
- throw new SyntaxError('ES.GetIterator depends on native iterator support.');
- }
-
var actualMethod = method;
if (arguments.length < 2) {
- actualMethod = this.GetMethod(obj, $Symbol.iterator);
+ actualMethod = getIteratorMethod(this, obj);
}
var iterator = this.Call(actualMethod, obj);
if (this.Type(iterator) !== 'Object') {
- throw new $TypeError$2('iterator must return an object');
+ throw new $TypeError$4('iterator must return an object');
}
return iterator;
IteratorNext: function IteratorNext(iterator, value) {
var result = this.Invoke(iterator, 'next', arguments.length < 2 ? [] : [value]);
if (this.Type(result) !== 'Object') {
- throw new $TypeError$2('iterator next must return an object');
+ throw new $TypeError$4('iterator next must return an object');
}
return result;
},
// https://ecma-international.org/ecma-262/6.0/#sec-iteratorcomplete
IteratorComplete: function IteratorComplete(iterResult) {
if (this.Type(iterResult) !== 'Object') {
- throw new $TypeError$2('Assertion failed: Type(iterResult) is not Object');
+ throw new $TypeError$4('Assertion failed: Type(iterResult) is not Object');
}
return this.ToBoolean(this.Get(iterResult, 'done'));
},
// https://ecma-international.org/ecma-262/6.0/#sec-iteratorvalue
IteratorValue: function IteratorValue(iterResult) {
if (this.Type(iterResult) !== 'Object') {
- throw new $TypeError$2('Assertion failed: Type(iterResult) is not Object');
+ throw new $TypeError$4('Assertion failed: Type(iterResult) is not Object');
}
return this.Get(iterResult, 'value');
},
// https://ecma-international.org/ecma-262/6.0/#sec-iteratorclose
IteratorClose: function IteratorClose(iterator, completion) {
if (this.Type(iterator) !== 'Object') {
- throw new $TypeError$2('Assertion failed: Type(iterator) is not Object');
+ throw new $TypeError$4('Assertion failed: Type(iterator) is not Object');
}
if (!this.IsCallable(completion)) {
- throw new $TypeError$2('Assertion failed: completion is not a thunk for a Completion Record');
+ throw new $TypeError$4('Assertion failed: completion is not a thunk for a Completion Record');
}
var completionThunk = completion;
completionThunk = null; // ensure it's not called twice.
if (this.Type(innerResult) !== 'Object') {
- throw new $TypeError$2('iterator .return must return an object');
+ throw new $TypeError$4('iterator .return must return an object');
}
return completionRecord;
// https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject
CreateIterResultObject: function CreateIterResultObject(value, done) {
if (this.Type(done) !== 'Boolean') {
- throw new $TypeError$2('Assertion failed: Type(done) is not Boolean');
+ throw new $TypeError$4('Assertion failed: Type(done) is not Boolean');
}
return {
value: value,
// https://ecma-international.org/ecma-262/6.0/#sec-regexpexec
RegExpExec: function RegExpExec(R, S) {
if (this.Type(R) !== 'Object') {
- throw new $TypeError$2('R must be an Object');
+ throw new $TypeError$4('R must be an Object');
}
if (this.Type(S) !== 'String') {
- throw new $TypeError$2('S must be a String');
+ throw new $TypeError$4('S must be a String');
}
var exec = this.Get(R, 'exec');
if (this.IsCallable(exec)) {
if (result === null || this.Type(result) === 'Object') {
return result;
}
- throw new $TypeError$2('"exec" method must return `null` or an Object');
+ throw new $TypeError$4('"exec" method must return `null` or an Object');
}
return regexExec$1(R, S);
},
// https://ecma-international.org/ecma-262/6.0/#sec-arrayspeciescreate
ArraySpeciesCreate: function ArraySpeciesCreate(originalArray, length) {
if (!this.IsInteger(length) || length < 0) {
- throw new $TypeError$2('Assertion failed: length must be an integer >= 0');
+ throw new $TypeError$4('Assertion failed: length must be an integer >= 0');
}
var len = length === 0 ? 0 : length;
var C;
// if C is another realm's Array, C = undefined
// Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Array))) === null ?
// }
- if (this.Type(C) === 'Object' && hasSymbols$4 && $Symbol.species) {
+ if (this.Type(C) === 'Object' && hasSymbols$5 && $Symbol.species) {
C = this.Get(C, $Symbol.species);
if (C === null) {
C = void 0;
return $Array(len);
}
if (!this.IsConstructor(C)) {
- throw new $TypeError$2('C must be a constructor');
+ throw new $TypeError$4('C must be a constructor');
}
return new C(len); // this.Construct(C, len);
},
CreateDataProperty: function CreateDataProperty(O, P, V) {
if (this.Type(O) !== 'Object') {
- throw new $TypeError$2('Assertion failed: Type(O) is not Object');
+ throw new $TypeError$4('Assertion failed: Type(O) is not Object');
}
if (!this.IsPropertyKey(P)) {
- throw new $TypeError$2('Assertion failed: IsPropertyKey(P) is not true');
+ throw new $TypeError$4('Assertion failed: IsPropertyKey(P) is not true');
}
var oldDesc = $gOPD(O, P);
- var extensible = oldDesc || (typeof $isExtensible !== 'function' || $isExtensible(O));
+ var extensible = oldDesc || this.IsExtensible(O);
var immutable = oldDesc && (!oldDesc.writable || !oldDesc.configurable);
if (immutable || !extensible) {
return false;
}
- var newDesc = {
- configurable: true,
- enumerable: true,
- value: V,
- writable: true
- };
- $defineProperty(O, P, newDesc);
- return true;
+ return DefineOwnProperty(this, O, P, {
+ '[[Configurable]]': true,
+ '[[Enumerable]]': true,
+ '[[Value]]': V,
+ '[[Writable]]': true
+ });
},
// https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow
CreateDataPropertyOrThrow: function CreateDataPropertyOrThrow(O, P, V) {
if (this.Type(O) !== 'Object') {
- throw new $TypeError$2('Assertion failed: Type(O) is not Object');
+ throw new $TypeError$4('Assertion failed: Type(O) is not Object');
}
if (!this.IsPropertyKey(P)) {
- throw new $TypeError$2('Assertion failed: IsPropertyKey(P) is not true');
+ throw new $TypeError$4('Assertion failed: IsPropertyKey(P) is not true');
}
var success = this.CreateDataProperty(O, P, V);
if (!success) {
- throw new $TypeError$2('unable to create data property');
+ throw new $TypeError$4('unable to create data property');
}
return success;
},
// https://www.ecma-international.org/ecma-262/6.0/#sec-objectcreate
ObjectCreate: function ObjectCreate(proto, internalSlotsList) {
if (proto !== null && this.Type(proto) !== 'Object') {
- throw new $TypeError$2('Assertion failed: proto must be null or an object');
+ throw new $TypeError$4('Assertion failed: proto must be null or an object');
}
var slots = arguments.length < 2 ? [] : internalSlotsList;
if (slots.length > 0) {
- throw new $SyntaxError$1('es-abstract does not yet support internal slots');
+ throw new $SyntaxError$2('es-abstract does not yet support internal slots');
}
if (proto === null && !$ObjectCreate) {
- throw new $SyntaxError$1('native Object.create support is required to create null objects');
+ throw new $SyntaxError$2('native Object.create support is required to create null objects');
}
return $ObjectCreate(proto);
// https://ecma-international.org/ecma-262/6.0/#sec-advancestringindex
AdvanceStringIndex: function AdvanceStringIndex(S, index, unicode) {
if (this.Type(S) !== 'String') {
- throw new $TypeError$2('S must be a String');
+ throw new $TypeError$4('S must be a String');
}
- if (!this.IsInteger(index) || index < 0 || index > MAX_SAFE_INTEGER) {
- throw new $TypeError$2('Assertion failed: length must be an integer >= 0 and <= 2**53');
+ if (!this.IsInteger(index) || index < 0 || index > maxSafeInteger) {
+ throw new $TypeError$4('Assertion failed: length must be an integer >= 0 and <= 2**53');
}
if (this.Type(unicode) !== 'Boolean') {
- throw new $TypeError$2('Assertion failed: unicode must be a Boolean');
+ throw new $TypeError$4('Assertion failed: unicode must be a Boolean');
}
if (!unicode) {
return index + 1;
// https://www.ecma-international.org/ecma-262/6.0/#sec-createmethodproperty
CreateMethodProperty: function CreateMethodProperty(O, P, V) {
if (this.Type(O) !== 'Object') {
- throw new $TypeError$2('Assertion failed: Type(O) is not Object');
+ throw new $TypeError$4('Assertion failed: Type(O) is not Object');
}
if (!this.IsPropertyKey(P)) {
- throw new $TypeError$2('Assertion failed: IsPropertyKey(P) is not true');
+ throw new $TypeError$4('Assertion failed: IsPropertyKey(P) is not true');
}
var newDesc = {
- configurable: true,
- enumerable: false,
- value: V,
- writable: true
+ '[[Configurable]]': true,
+ '[[Enumerable]]': false,
+ '[[Value]]': V,
+ '[[Writable]]': true
};
- return !!$defineProperty(O, P, newDesc);
+ return DefineOwnProperty(this, O, P, newDesc);
},
// https://www.ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow
DefinePropertyOrThrow: function DefinePropertyOrThrow(O, P, desc) {
if (this.Type(O) !== 'Object') {
- throw new $TypeError$2('Assertion failed: Type(O) is not Object');
+ throw new $TypeError$4('Assertion failed: Type(O) is not Object');
}
if (!this.IsPropertyKey(P)) {
- throw new $TypeError$2('Assertion failed: IsPropertyKey(P) is not true');
+ throw new $TypeError$4('Assertion failed: IsPropertyKey(P) is not true');
+ }
+
+ var Desc = isPropertyDescriptor(this, desc) ? desc : this.ToPropertyDescriptor(desc);
+ if (!isPropertyDescriptor(this, Desc)) {
+ throw new $TypeError$4('Assertion failed: Desc is not a valid Property Descriptor');
}
- return !!$defineProperty(O, P, desc);
+ return DefineOwnProperty(this, O, P, Desc);
},
// https://www.ecma-international.org/ecma-262/6.0/#sec-deletepropertyorthrow
DeletePropertyOrThrow: function DeletePropertyOrThrow(O, P) {
if (this.Type(O) !== 'Object') {
- throw new $TypeError$2('Assertion failed: Type(O) is not Object');
+ throw new $TypeError$4('Assertion failed: Type(O) is not Object');
}
if (!this.IsPropertyKey(P)) {
- throw new $TypeError$2('Assertion failed: IsPropertyKey(P) is not true');
+ throw new $TypeError$4('Assertion failed: IsPropertyKey(P) is not true');
}
var success = delete O[P];
// https://www.ecma-international.org/ecma-262/6.0/#sec-enumerableownnames
EnumerableOwnNames: function EnumerableOwnNames(O) {
if (this.Type(O) !== 'Object') {
- throw new $TypeError$2('Assertion failed: Type(O) is not Object');
+ throw new $TypeError$4('Assertion failed: Type(O) is not Object');
}
return objectKeys(O);
// https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-date-prototype-object
thisTimeValue: function thisTimeValue(value) {
return $DateValueOf(value);
+ },
+
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-setintegritylevel
+ SetIntegrityLevel: function SetIntegrityLevel(O, level) {
+ if (this.Type(O) !== 'Object') {
+ throw new $TypeError$4('Assertion failed: Type(O) is not Object');
+ }
+ if (level !== 'sealed' && level !== 'frozen') {
+ throw new $TypeError$4('Assertion failed: `level` must be `"sealed"` or `"frozen"`');
+ }
+ if (!$preventExtensions) {
+ throw new $SyntaxError$2('SetIntegrityLevel requires native `Object.preventExtensions` support');
+ }
+ var status = $preventExtensions(O);
+ if (!status) {
+ return false;
+ }
+ if (!$gOPN) {
+ throw new $SyntaxError$2('SetIntegrityLevel requires native `Object.getOwnPropertyNames` support');
+ }
+ var theKeys = $gOPN(O);
+ var ES = this;
+ if (level === 'sealed') {
+ forEach$3(theKeys, function (k) {
+ ES.DefinePropertyOrThrow(O, k, { configurable: false });
+ });
+ } else if (level === 'frozen') {
+ forEach$3(theKeys, function (k) {
+ var currentDesc = $gOPD(O, k);
+ if (typeof currentDesc !== 'undefined') {
+ var desc;
+ if (ES.IsAccessorDescriptor(ES.ToPropertyDescriptor(currentDesc))) {
+ desc = { configurable: false };
+ } else {
+ desc = { configurable: false, writable: false };
+ }
+ ES.DefinePropertyOrThrow(O, k, desc);
+ }
+ });
+ }
+ return true;
+ },
+
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-testintegritylevel
+ TestIntegrityLevel: function TestIntegrityLevel(O, level) {
+ if (this.Type(O) !== 'Object') {
+ throw new $TypeError$4('Assertion failed: Type(O) is not Object');
+ }
+ if (level !== 'sealed' && level !== 'frozen') {
+ throw new $TypeError$4('Assertion failed: `level` must be `"sealed"` or `"frozen"`');
+ }
+ var status = this.IsExtensible(O);
+ if (status) {
+ return false;
+ }
+ var theKeys = $gOPN(O);
+ var ES = this;
+ return theKeys.length === 0 || every(theKeys, function (k) {
+ var currentDesc = $gOPD(O, k);
+ if (typeof currentDesc !== 'undefined') {
+ if (currentDesc.configurable) {
+ return false;
+ }
+ if (level === 'frozen' && ES.IsDataDescriptor(ES.ToPropertyDescriptor(currentDesc)) && currentDesc.writable) {
+ return false;
+ }
+ }
+ return true;
+ });
+ },
+
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-ordinaryhasinstance
+ OrdinaryHasInstance: function OrdinaryHasInstance(C, O) {
+ if (this.IsCallable(C) === false) {
+ return false;
+ }
+ if (this.Type(O) !== 'Object') {
+ return false;
+ }
+ var P = this.Get(C, 'prototype');
+ if (this.Type(P) !== 'Object') {
+ throw new $TypeError$4('OrdinaryHasInstance called on an object with an invalid prototype property.');
+ }
+ return O instanceof C;
+ },
+
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-ordinaryhasproperty
+ OrdinaryHasProperty: function OrdinaryHasProperty(O, P) {
+ if (this.Type(O) !== 'Object') {
+ throw new $TypeError$4('Assertion failed: Type(O) is not Object');
+ }
+ if (!this.IsPropertyKey(P)) {
+ throw new $TypeError$4('Assertion failed: P must be a Property Key');
+ }
+ return P in O;
+ },
+
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-instanceofoperator
+ InstanceofOperator: function InstanceofOperator(O, C) {
+ if (this.Type(O) !== 'Object') {
+ throw new $TypeError$4('Assertion failed: Type(O) is not Object');
+ }
+ var instOfHandler = hasSymbols$5 && $Symbol.hasInstance ? this.GetMethod(C, $Symbol.hasInstance) : void 0;
+ if (typeof instOfHandler !== 'undefined') {
+ return this.ToBoolean(this.Call(instOfHandler, C, [O]));
+ }
+ if (!this.IsCallable(C)) {
+ throw new $TypeError$4('`C` is not Callable');
+ }
+ return this.OrdinaryHasInstance(C, O);
+ },
+
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-ispromise
+ IsPromise: function IsPromise(x) {
+ if (this.Type(x) !== 'Object') {
+ return false;
+ }
+ if (!$PromiseThen) { // Promises are not supported
+ return false;
+ }
+ try {
+ $PromiseThen(x); // throws if not a promise
+ } catch (e) {
+ return false;
+ }
+ return true;
+ },
+
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-abstract-equality-comparison
+ 'Abstract Equality Comparison': function AbstractEqualityComparison(x, y) {
+ var xType = this.Type(x);
+ var yType = this.Type(y);
+ if (xType === yType) {
+ return x === y; // ES6+ specified this shortcut anyways.
+ }
+ if (x == null && y == null) {
+ return true;
+ }
+ if (xType === 'Number' && yType === 'String') {
+ return this['Abstract Equality Comparison'](x, this.ToNumber(y));
+ }
+ if (xType === 'String' && yType === 'Number') {
+ return this['Abstract Equality Comparison'](this.ToNumber(x), y);
+ }
+ if (xType === 'Boolean') {
+ return this['Abstract Equality Comparison'](this.ToNumber(x), y);
+ }
+ if (yType === 'Boolean') {
+ return this['Abstract Equality Comparison'](x, this.ToNumber(y));
+ }
+ if ((xType === 'String' || xType === 'Number' || xType === 'Symbol') && yType === 'Object') {
+ return this['Abstract Equality Comparison'](x, this.ToPrimitive(y));
+ }
+ if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'Symbol')) {
+ return this['Abstract Equality Comparison'](this.ToPrimitive(x), y);
+ }
+ return false;
+ },
+
+ // eslint-disable-next-line max-lines-per-function, max-statements, id-length, max-params
+ ValidateAndApplyPropertyDescriptor: function ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current) {
+ // this uses the ES2017+ logic, since it fixes a number of bugs in the ES2015 logic.
+ var oType = this.Type(O);
+ if (oType !== 'Undefined' && oType !== 'Object') {
+ throw new $TypeError$4('Assertion failed: O must be undefined or an Object');
+ }
+ if (this.Type(extensible) !== 'Boolean') {
+ throw new $TypeError$4('Assertion failed: extensible must be a Boolean');
+ }
+ if (!isPropertyDescriptor(this, Desc)) {
+ throw new $TypeError$4('Assertion failed: Desc must be a Property Descriptor');
+ }
+ if (this.Type(current) !== 'Undefined' && !isPropertyDescriptor(this, current)) {
+ throw new $TypeError$4('Assertion failed: current must be a Property Descriptor, or undefined');
+ }
+ if (oType !== 'Undefined' && !this.IsPropertyKey(P)) {
+ throw new $TypeError$4('Assertion failed: if O is not undefined, P must be a Property Key');
+ }
+ if (this.Type(current) === 'Undefined') {
+ if (!extensible) {
+ return false;
+ }
+ if (this.IsGenericDescriptor(Desc) || this.IsDataDescriptor(Desc)) {
+ if (oType !== 'Undefined') {
+ DefineOwnProperty(this, O, P, {
+ '[[Configurable]]': Desc['[[Configurable]]'],
+ '[[Enumerable]]': Desc['[[Enumerable]]'],
+ '[[Value]]': Desc['[[Value]]'],
+ '[[Writable]]': Desc['[[Writable]]']
+ });
+ }
+ } else {
+ if (!this.IsAccessorDescriptor(Desc)) {
+ throw new $TypeError$4('Assertion failed: Desc is not an accessor descriptor');
+ }
+ if (oType !== 'Undefined') {
+ return DefineOwnProperty(this, O, P, Desc);
+ }
+ }
+ return true;
+ }
+ if (this.IsGenericDescriptor(Desc) && !('[[Configurable]]' in Desc) && !('[[Enumerable]]' in Desc)) {
+ return true;
+ }
+ if (isSamePropertyDescriptor(this, Desc, current)) {
+ return true; // removed by ES2017, but should still be correct
+ }
+ // "if every field in Desc is absent, return true" can't really match the assertion that it's a Property Descriptor
+ if (!current['[[Configurable]]']) {
+ if (Desc['[[Configurable]]']) {
+ return false;
+ }
+ if ('[[Enumerable]]' in Desc && !Desc['[[Enumerable]]'] === !!current['[[Enumerable]]']) {
+ return false;
+ }
+ }
+ if (this.IsGenericDescriptor(Desc)) ; else if (this.IsDataDescriptor(current) !== this.IsDataDescriptor(Desc)) {
+ if (!current['[[Configurable]]']) {
+ return false;
+ }
+ if (this.IsDataDescriptor(current)) {
+ if (oType !== 'Undefined') {
+ DefineOwnProperty(this, O, P, {
+ '[[Configurable]]': current['[[Configurable]]'],
+ '[[Enumerable]]': current['[[Enumerable]]'],
+ '[[Get]]': undefined
+ });
+ }
+ } else if (oType !== 'Undefined') {
+ DefineOwnProperty(this, O, P, {
+ '[[Configurable]]': current['[[Configurable]]'],
+ '[[Enumerable]]': current['[[Enumerable]]'],
+ '[[Value]]': undefined
+ });
+ }
+ } else if (this.IsDataDescriptor(current) && this.IsDataDescriptor(Desc)) {
+ if (!current['[[Configurable]]'] && !current['[[Writable]]']) {
+ if ('[[Writable]]' in Desc && Desc['[[Writable]]']) {
+ return false;
+ }
+ if ('[[Value]]' in Desc && !this.SameValue(Desc['[[Value]]'], current['[[Value]]'])) {
+ return false;
+ }
+ return true;
+ }
+ } else if (this.IsAccessorDescriptor(current) && this.IsAccessorDescriptor(Desc)) {
+ if (!current['[[Configurable]]']) {
+ if ('[[Set]]' in Desc && !this.SameValue(Desc['[[Set]]'], current['[[Set]]'])) {
+ return false;
+ }
+ if ('[[Get]]' in Desc && !this.SameValue(Desc['[[Get]]'], current['[[Get]]'])) {
+ return false;
+ }
+ return true;
+ }
+ } else {
+ throw new $TypeError$4('Assertion failed: current and Desc are not both data, both accessors, or one accessor and one data.');
+ }
+ if (oType !== 'Undefined') {
+ return DefineOwnProperty(this, O, P, Desc);
+ }
+ return true;
+ },
+
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-ordinarydefineownproperty
+ OrdinaryDefineOwnProperty: function OrdinaryDefineOwnProperty(O, P, Desc) {
+ if (this.Type(O) !== 'Object') {
+ throw new $TypeError$4('Assertion failed: O must be an Object');
+ }
+ if (!this.IsPropertyKey(P)) {
+ throw new $TypeError$4('Assertion failed: P must be a Property Key');
+ }
+ if (!isPropertyDescriptor(this, Desc)) {
+ throw new $TypeError$4('Assertion failed: Desc must be a Property Descriptor');
+ }
+ var desc = $gOPD(O, P);
+ var current = desc && this.ToPropertyDescriptor(desc);
+ var extensible = this.IsExtensible(O);
+ return this.ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current);
+ },
+
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-ordinarygetownproperty
+ OrdinaryGetOwnProperty: function OrdinaryGetOwnProperty(O, P) {
+ if (this.Type(O) !== 'Object') {
+ throw new $TypeError$4('Assertion failed: O must be an Object');
+ }
+ if (!this.IsPropertyKey(P)) {
+ throw new $TypeError$4('Assertion failed: P must be a Property Key');
+ }
+ if (!src(O, P)) {
+ return void 0;
+ }
+ if (!$gOPD) {
+ // ES3 fallback
+ var arrayLength = this.IsArray(O) && P === 'length';
+ var regexLastIndex = this.IsRegExp(O) && P === 'lastIndex';
+ return {
+ '[[Configurable]]': !(arrayLength || regexLastIndex),
+ '[[Enumerable]]': $isEnumerable(O, P),
+ '[[Value]]': O[P],
+ '[[Writable]]': true
+ };
+ }
+ return this.ToPropertyDescriptor($gOPD(O, P));
+ },
+
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-arraycreate
+ ArrayCreate: function ArrayCreate(length) {
+ if (!this.IsInteger(length) || length < 0) {
+ throw new $TypeError$4('Assertion failed: `length` must be an integer Number >= 0');
+ }
+ if (length > MAX_ARRAY_LENGTH) {
+ throw new $RangeError('length is greater than (2**32 - 1)');
+ }
+ var proto = arguments.length > 1 ? arguments[1] : $ArrayPrototype;
+ var A = []; // steps 5 - 7, and 9
+ if (proto !== $ArrayPrototype) { // step 8
+ if (!setProto) {
+ throw new $SyntaxError$2('ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]');
+ }
+ setProto(A, proto);
+ }
+ if (length !== 0) { // bypasses the need for step 2
+ A.length = length;
+ }
+ /* step 10, the above as a shortcut for the below
+ this.OrdinaryDefineOwnProperty(A, 'length', {
+ '[[Configurable]]': false,
+ '[[Enumerable]]': false,
+ '[[Value]]': length,
+ '[[Writable]]': true
+ });
+ */
+ return A;
+ },
+
+ // eslint-disable-next-line max-statements, max-lines-per-function
+ ArraySetLength: function ArraySetLength(A, Desc) {
+ if (!this.IsArray(A)) {
+ throw new $TypeError$4('Assertion failed: A must be an Array');
+ }
+ if (!isPropertyDescriptor(this, Desc)) {
+ throw new $TypeError$4('Assertion failed: Desc must be a Property Descriptor');
+ }
+ if (!('[[Value]]' in Desc)) {
+ return this.OrdinaryDefineOwnProperty(A, 'length', Desc);
+ }
+ var newLenDesc = assign$1({}, Desc);
+ var newLen = this.ToUint32(Desc['[[Value]]']);
+ var numberLen = this.ToNumber(Desc['[[Value]]']);
+ if (newLen !== numberLen) {
+ throw new $RangeError('Invalid array length');
+ }
+ newLenDesc['[[Value]]'] = newLen;
+ var oldLenDesc = this.OrdinaryGetOwnProperty(A, 'length');
+ if (!this.IsDataDescriptor(oldLenDesc)) {
+ throw new $TypeError$4('Assertion failed: an array had a non-data descriptor on `length`');
+ }
+ var oldLen = oldLenDesc['[[Value]]'];
+ if (newLen >= oldLen) {
+ return this.OrdinaryDefineOwnProperty(A, 'length', newLenDesc);
+ }
+ if (!oldLenDesc['[[Writable]]']) {
+ return false;
+ }
+ var newWritable;
+ if (!('[[Writable]]' in newLenDesc) || newLenDesc['[[Writable]]']) {
+ newWritable = true;
+ } else {
+ newWritable = false;
+ newLenDesc['[[Writable]]'] = true;
+ }
+ var succeeded = this.OrdinaryDefineOwnProperty(A, 'length', newLenDesc);
+ if (!succeeded) {
+ return false;
+ }
+ while (newLen < oldLen) {
+ oldLen -= 1;
+ var deleteSucceeded = delete A[this.ToString(oldLen)];
+ if (!deleteSucceeded) {
+ newLenDesc['[[Value]]'] = oldLen + 1;
+ if (!newWritable) {
+ newLenDesc['[[Writable]]'] = false;
+ this.OrdinaryDefineOwnProperty(A, 'length', newLenDesc);
+ return false;
+ }
+ }
+ }
+ if (!newWritable) {
+ return this.OrdinaryDefineOwnProperty(A, 'length', { '[[Writable]]': false });
+ }
+ return true;
+ },
+
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-createhtml
+ CreateHTML: function CreateHTML(string, tag, attribute, value) {
+ if (this.Type(tag) !== 'String' || this.Type(attribute) !== 'String') {
+ throw new $TypeError$4('Assertion failed: `tag` and `attribute` must be strings');
+ }
+ var str = this.RequireObjectCoercible(string);
+ var S = this.ToString(str);
+ var p1 = '<' + tag;
+ if (attribute !== '') {
+ var V = this.ToString(value);
+ var escapedV = $replace$1(V, /\x22/g, '"');
+ p1 += '\x20' + attribute + '\x3D\x22' + escapedV + '\x22';
+ }
+ return p1 + '>' + S + '</' + tag + '>';
+ },
+
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-getownpropertykeys
+ GetOwnPropertyKeys: function GetOwnPropertyKeys(O, Type) {
+ if (this.Type(O) !== 'Object') {
+ throw new $TypeError$4('Assertion failed: Type(O) is not Object');
+ }
+ if (Type === 'Symbol') {
+ return hasSymbols$5 && $gOPS ? $gOPS(O) : [];
+ }
+ if (Type === 'String') {
+ if (!$gOPN) {
+ return objectKeys(O);
+ }
+ return $gOPN(O);
+ }
+ throw new $TypeError$4('Assertion failed: `Type` must be `"String"` or `"Symbol"`');
+ },
+
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-symboldescriptivestring
+ SymbolDescriptiveString: function SymbolDescriptiveString(sym) {
+ if (this.Type(sym) !== 'Symbol') {
+ throw new $TypeError$4('Assertion failed: `sym` must be a Symbol');
+ }
+ return $SymbolToString(sym);
+ },
+
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-getsubstitution
+ // eslint-disable-next-line max-statements, max-params, max-lines-per-function
+ GetSubstitution: function GetSubstitution(matched, str, position, captures, replacement) {
+ if (this.Type(matched) !== 'String') {
+ throw new $TypeError$4('Assertion failed: `matched` must be a String');
+ }
+ var matchLength = matched.length;
+
+ if (this.Type(str) !== 'String') {
+ throw new $TypeError$4('Assertion failed: `str` must be a String');
+ }
+ var stringLength = str.length;
+
+ if (!this.IsInteger(position) || position < 0 || position > stringLength) {
+ throw new $TypeError$4('Assertion failed: `position` must be a nonnegative integer, and less than or equal to the length of `string`, got ' + objectInspect(position));
+ }
+
+ var ES = this;
+ var isStringOrHole = function (capture, index, arr) { return ES.Type(capture) === 'String' || !(index in arr); };
+ if (!this.IsArray(captures) || !every(captures, isStringOrHole)) {
+ throw new $TypeError$4('Assertion failed: `captures` must be a List of Strings, got ' + objectInspect(captures));
+ }
+
+ if (this.Type(replacement) !== 'String') {
+ throw new $TypeError$4('Assertion failed: `replacement` must be a String');
+ }
+
+ var tailPos = position + matchLength;
+ var m = captures.length;
+
+ var result = '';
+ for (var i = 0; i < replacement.length; i += 1) {
+ // if this is a $, and it's not the end of the replacement
+ var current = replacement[i];
+ var isLast = (i + 1) >= replacement.length;
+ var nextIsLast = (i + 2) >= replacement.length;
+ if (current === '$' && !isLast) {
+ var next = replacement[i + 1];
+ if (next === '$') {
+ result += '$';
+ i += 1;
+ } else if (next === '&') {
+ result += matched;
+ i += 1;
+ } else if (next === '`') {
+ result += position === 0 ? '' : strSlice(str, 0, position - 1);
+ i += 1;
+ } else if (next === "'") {
+ result += tailPos >= stringLength ? '' : strSlice(str, tailPos);
+ i += 1;
+ } else {
+ var nextNext = nextIsLast ? null : replacement[i + 2];
+ if (isDigit(next) && next !== '0' && (nextIsLast || !isDigit(nextNext))) {
+ // $1 through $9, and not followed by a digit
+ var n = parseInteger(next, 10);
+ // if (n > m, impl-defined)
+ result += (n <= m && this.Type(captures[n - 1]) === 'Undefined') ? '' : captures[n - 1];
+ i += 1;
+ } else if (isDigit(next) && (nextIsLast || isDigit(nextNext))) {
+ // $00 through $99
+ var nn = next + nextNext;
+ var nnI = parseInteger(nn, 10) - 1;
+ // if nn === '00' or nn > m, impl-defined
+ result += (nn <= m && this.Type(captures[nnI]) === 'Undefined') ? '' : captures[nnI];
+ i += 2;
+ } else {
+ result += '$';
+ }
+ }
+ } else {
+ // the final $, or else not a $
+ result += replacement[i];
+ }
+ }
+ return result;
+ },
+
+ // https://ecma-international.org/ecma-262/6.0/#sec-todatestring
+ ToDateString: function ToDateString(tv) {
+ if (this.Type(tv) !== 'Number') {
+ throw new $TypeError$4('Assertion failed: `tv` must be a Number');
+ }
+ if (_isNaN(tv)) {
+ return 'Invalid Date';
+ }
+ return $Date$1(tv);
+ },
+
+ // https://ecma-international.org/ecma-262/6.0/#sec-createlistfromarraylike
+ CreateListFromArrayLike: function CreateListFromArrayLike(obj) {
+ var elementTypes = arguments.length > 1
+ ? arguments[1]
+ : ['Undefined', 'Null', 'Boolean', 'String', 'Symbol', 'Number', 'Object'];
+
+ if (this.Type(obj) !== 'Object') {
+ throw new $TypeError$4('Assertion failed: `obj` must be an Object');
+ }
+ if (!this.IsArray(elementTypes)) {
+ throw new $TypeError$4('Assertion failed: `elementTypes`, if provided, must be an array');
+ }
+ var len = this.ToLength(this.Get(obj, 'length'));
+ var list = [];
+ var index = 0;
+ while (index < len) {
+ var indexName = this.ToString(index);
+ var next = this.Get(obj, indexName);
+ var nextType = this.Type(next);
+ if ($indexOf$1(elementTypes, nextType) < 0) {
+ throw new $TypeError$4('item type ' + nextType + ' is not a valid elementType');
+ }
+ $push(list, next);
+ index += 1;
+ }
+ return list;
+ },
+
+ // https://ecma-international.org/ecma-262/6.0/#sec-getprototypefromconstructor
+ GetPrototypeFromConstructor: function GetPrototypeFromConstructor(constructor, intrinsicDefaultProto) {
+ var intrinsic = GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic
+ if (!this.IsConstructor(constructor)) {
+ throw new $TypeError$4('Assertion failed: `constructor` must be a constructor');
+ }
+ var proto = this.Get(constructor, 'prototype');
+ if (this.Type(proto) !== 'Object') {
+ if (!(constructor instanceof $Function$1)) {
+ // ignore other realms, for now
+ throw new $TypeError$4('cross-realm constructors not currently supported');
+ }
+ proto = intrinsic;
+ }
+ return proto;
+ },
+
+ // https://ecma-international.org/ecma-262/6.0/#sec-setfunctionname
+ SetFunctionName: function SetFunctionName(F, name) {
+ if (typeof F !== 'function') {
+ throw new $TypeError$4('Assertion failed: `F` must be a function');
+ }
+ if (!this.IsExtensible(F) || src(F, 'name')) {
+ throw new $TypeError$4('Assertion failed: `F` must be extensible, and must not have a `name` own property');
+ }
+ var nameType = this.Type(name);
+ if (nameType !== 'Symbol' && nameType !== 'String') {
+ throw new $TypeError$4('Assertion failed: `name` must be a Symbol or a String');
+ }
+ if (nameType === 'Symbol') {
+ var description = getSymbolDescription(name);
+ // eslint-disable-next-line no-param-reassign
+ name = typeof description === 'undefined' ? '' : '[' + description + ']';
+ }
+ if (arguments.length > 2) {
+ var prefix = arguments[2];
+ // eslint-disable-next-line no-param-reassign
+ name = prefix + ' ' + name;
+ }
+ return this.DefinePropertyOrThrow(F, 'name', {
+ '[[Value]]': name,
+ '[[Writable]]': false,
+ '[[Enumerable]]': false,
+ '[[Configurable]]': true
+ });
}
});
var es6$1 = es2015$1;
- var implementation$2 = function find(predicate) {
+ var implementation$3 = function find(predicate) {
var list = es6$1.ToObject(this);
- var length = es6$1.ToInteger(es6$1.ToLength(list.length));
+ var length = es6$1.ToLength(list.length);
if (!es6$1.IsCallable(predicate)) {
throw new TypeError('Array#find: predicate must be a function');
}
if (length === 0) {
- return undefined;
+ return void 0;
}
- var thisArg = arguments[1];
+ var thisArg;
+ if (arguments.length > 0) {
+ thisArg = arguments[1];
+ }
+
for (var i = 0, value; i < length; i++) {
value = list[i];
- if (es6$1.Call(predicate, thisArg, [value, i, list])) {
+ // inlined for performance: if (ES.Call(predicate, thisArg, [value, i, list])) {
+ if (predicate.apply(thisArg, [value, i, list])) {
return value;
}
}
- return undefined;
+ return void 0;
};
- var polyfill$3 = function getPolyfill() {
+ var polyfill$4 = function getPolyfill() {
// Detect if an implementation exists
// Detect early implementations which skipped holes in sparse arrays
- // eslint-disable-next-line no-sparse-arrays
+ // eslint-disable-next-line no-sparse-arrays
var implemented = Array.prototype.find && [, 1].find(function () {
return true;
}) !== 1;
- // eslint-disable-next-line global-require
- return implemented ? Array.prototype.find : implementation$2;
+ // eslint-disable-next-line global-require
+ return implemented ? Array.prototype.find : implementation$3;
};
var shim$8 = function shimArrayPrototypeFind() {
- var polyfill = polyfill$3();
+ var polyfill = polyfill$4();
defineProperties_1(Array.prototype, { find: polyfill }, {
find: function () {
var slice$2 = Array.prototype.slice;
- var polyfill$4 = polyfill$3();
+ var polyfill$5 = polyfill$4();
var boundFindShim = function find(array, predicate) { // eslint-disable-line no-unused-vars
es6$1.RequireObjectCoercible(array);
var args = slice$2.call(arguments, 1);
- return polyfill$4.apply(array, args);
+ return polyfill$5.apply(array, args);
};
defineProperties_1(boundFindShim, {
- getPolyfill: polyfill$3,
- implementation: implementation$2,
+ getPolyfill: polyfill$4,
+ implementation: implementation$3,
shim: shim$8
});
var array_prototype_find = boundFindShim;
- var implementation$3 = function findIndex(predicate) {
+ var implementation$4 = function findIndex(predicate) {
var list = es6$1.ToObject(this);
var length = es6$1.ToLength(list.length);
if (!es6$1.IsCallable(predicate)) {
throw new TypeError('Array#findIndex: predicate must be a function');
}
- if (length === 0) return -1;
+ if (length === 0) { return -1; }
var thisArg = arguments[1];
for (var i = 0, value; i < length; i++) {
value = list[i];
- if (es6$1.Call(predicate, thisArg, [value, i, list])) return i;
+ if (es6$1.Call(predicate, thisArg, [value, i, list])) { return i; }
}
return -1;
};
- var polyfill$5 = function getPolyfill() {
+ var polyfill$6 = function getPolyfill() {
// Detect if an implementation exists
// Detect early implementations which skipped holes in sparse arrays
var implemented = Array.prototype.findIndex && ([, 1].findIndex(function (item, idx) {
}) === 0);
- return implemented ? Array.prototype.findIndex : implementation$3;
+ return implemented ? Array.prototype.findIndex : implementation$4;
};
var shim$9 = function shimArrayPrototypeFindIndex() {
- var polyfill = polyfill$5();
+ var polyfill = polyfill$6();
defineProperties_1(Array.prototype, { findIndex: polyfill }, {
findIndex: function () {
var slice$3 = Array.prototype.slice;
- var polyfill$6 = polyfill$5();
+ var polyfill$7 = polyfill$6();
var boundShim = function findIndex(array, predicate) {
es6$1.RequireObjectCoercible(array);
var args = slice$3.call(arguments, 1);
- return polyfill$6.apply(array, args);
+ return polyfill$7.apply(array, args);
};
defineProperties_1(boundShim, {
- implementation: implementation$3,
- getPolyfill: polyfill$5,
+ implementation: implementation$4,
+ getPolyfill: polyfill$6,
shim: shim$9
});
var supportsDescriptors$1 = defineProperties_1.supportsDescriptors;
/*! https://mths.be/array-from v0.2.0 by @mathias */
- var implementation$4 = function from(arrayLike) {
+ var implementation$5 = function from(arrayLike) {
var defineProperty = supportsDescriptors$1 ? Object.defineProperty : function put(object, key, descriptor) {
object[key] = descriptor.value;
};
}
};
- var polyfill$7 = function getPolyfill() {
+ var polyfill$8 = function getPolyfill() {
var implemented = es6$1.IsCallable(Array.from)
&& tryCall(function () { Array.from({ 'length': -Infinity }); })
&& !tryCall(function () { Array.from([], undefined); });
- return implemented ? Array.from : implementation$4;
+ return implemented ? Array.from : implementation$5;
};
var shim$a = function shimArrayFrom() {
- var polyfill = polyfill$7();
+ var polyfill = polyfill$8();
defineProperties_1(Array, { 'from': polyfill }, {
'from': function () {
// eslint-disable-next-line no-unused-vars
var boundFromShim = function from(array) {
// eslint-disable-next-line no-invalid-this
- return implementation$4.apply(this || Array, arguments);
+ return implementation$5.apply(this || Array, arguments);
};
defineProperties_1(boundFromShim, {
- 'getPolyfill': polyfill$7,
- 'implementation': implementation$4,
+ 'getPolyfill': polyfill$8,
+ 'implementation': implementation$5,
'shim': shim$a
});
var array_from = boundFromShim;
+ var originalGetProto = GetIntrinsic('%Object.getPrototypeOf%', true);
+ var $ArrayProto$1 = GetIntrinsic('%Array.prototype%');
+
+ var getProto$1 = originalGetProto || (
+ // eslint-disable-next-line no-proto
+ [].__proto__ === $ArrayProto$1
+ ? function (O) {
+ return O.__proto__; // eslint-disable-line no-proto
+ }
+ : null
+ );
+
+ var $TypeError$5 = GetIntrinsic('%TypeError%');
+ var $arrayPush = callBound('Array.prototype.push');
+
+
var ES2016 = assign$1(assign$1({}, es2015$1), {
- // https://github.com/tc39/ecma262/pull/60
+ // https://www.ecma-international.org/ecma-262/7.0/#sec-samevaluenonnumber
SameValueNonNumber: function SameValueNonNumber(x, y) {
if (typeof x === 'number' || typeof x !== typeof y) {
throw new TypeError('SameValueNonNumber requires two non-number values of the same type.');
}
return this.SameValue(x, y);
+ },
+
+ // https://www.ecma-international.org/ecma-262/7.0/#sec-iterabletoarraylike
+ IterableToArrayLike: function IterableToArrayLike(items) {
+ var usingIterator = getIteratorMethod(this, items);
+ if (typeof usingIterator !== 'undefined') {
+ var iterator = this.GetIterator(items, usingIterator);
+ var values = [];
+ var next = true;
+ while (next) {
+ next = this.IteratorStep(iterator);
+ if (next) {
+ var nextValue = this.IteratorValue(next);
+ $arrayPush(values, nextValue);
+ }
+ }
+ return values;
+ }
+
+ return this.ToObject(items);
+ },
+
+ // https://ecma-international.org/ecma-262/7.0/#sec-ordinarygetprototypeof
+ OrdinaryGetPrototypeOf: function (O) {
+ if (this.Type(O) !== 'Object') {
+ throw new $TypeError$5('Assertion failed: O must be an Object');
+ }
+ if (!getProto$1) {
+ throw new $TypeError$5('This environment does not support fetching prototypes.');
+ }
+ return getProto$1(O);
+ },
+
+ // https://ecma-international.org/ecma-262/7.0/#sec-ordinarysetprototypeof
+ OrdinarySetPrototypeOf: function (O, V) {
+ if (this.Type(V) !== 'Object' && this.Type(V) !== 'Null') {
+ throw new $TypeError$5('Assertion failed: V must be Object or Null');
+ }
+ /*
+ var extensible = this.IsExtensible(O);
+ var current = this.OrdinaryGetPrototypeOf(O);
+ if (this.SameValue(V, current)) {
+ return true;
+ }
+ if (!extensible) {
+ return false;
+ }
+ */
+ try {
+ setProto(O, V);
+ } catch (e) {
+ return false;
+ }
+ return this.OrdinaryGetPrototypeOf(O) === V;
+ /*
+ var p = V;
+ var done = false;
+ while (!done) {
+ if (p === null) {
+ done = true;
+ } else if (this.SameValue(p, O)) {
+ return false;
+ } else {
+ if (wat) {
+ done = true;
+ } else {
+ p = p.[[Prototype]];
+ }
+ }
+ }
+ O.[[Prototype]] = V;
+ return true;
+ */
}
});
var isEnumerable$1 = functionBind.call(Function.call, Object.prototype.propertyIsEnumerable);
- var implementation$5 = function values(O) {
+ var implementation$6 = function values(O) {
var obj = es7.RequireObjectCoercible(O);
var vals = [];
for (var key in obj) {
return vals;
};
- var polyfill$8 = function getPolyfill() {
- return typeof Object.values === 'function' ? Object.values : implementation$5;
+ var polyfill$9 = function getPolyfill() {
+ return typeof Object.values === 'function' ? Object.values : implementation$6;
};
var shim$b = function shimValues() {
- var polyfill = polyfill$8();
+ var polyfill = polyfill$9();
defineProperties_1(Object, { values: polyfill }, {
values: function testValues() {
return Object.values !== polyfill;
return polyfill;
};
- var polyfill$9 = polyfill$8();
+ var polyfill$a = polyfill$9();
- defineProperties_1(polyfill$9, {
- getPolyfill: polyfill$8,
- implementation: implementation$5,
+ defineProperties_1(polyfill$a, {
+ getPolyfill: polyfill$9,
+ implementation: implementation$6,
shim: shim$b
});
- var object_values = polyfill$9;
+ var object_values = polyfill$a;
// modified from https://github.com/es-shims/es6-shim
var canBeObject = function (obj) {
return typeof obj !== 'undefined' && obj !== null;
};
- var hasSymbols$5 = shams();
+ var hasSymbols$6 = shams();
var toObject = Object;
var push = functionBind.call(Function.call, Array.prototype.push);
var propIsEnumerable = functionBind.call(Function.call, Object.prototype.propertyIsEnumerable);
- var originalGetSymbols = hasSymbols$5 ? Object.getOwnPropertySymbols : null;
+ var originalGetSymbols = hasSymbols$6 ? Object.getOwnPropertySymbols : null;
+
+ var implementation$7 = function assign(target, source1) {
+ var arguments$1 = arguments;
- var implementation$6 = function assign(target, source1) {
if (!canBeObject(target)) { throw new TypeError('target must be an object'); }
var objTarget = toObject(target);
var s, source, i, props, syms, value, key;
for (s = 1; s < arguments.length; ++s) {
- source = toObject(arguments[s]);
+ source = toObject(arguments$1[s]);
props = objectKeys(source);
- var getSymbols = hasSymbols$5 && (Object.getOwnPropertySymbols || originalGetSymbols);
+ var getSymbols = hasSymbols$6 && (Object.getOwnPropertySymbols || originalGetSymbols);
if (getSymbols) {
syms = getSymbols(source);
for (i = 0; i < syms.length; ++i) {
return false;
};
- var polyfill$a = function getPolyfill() {
+ var polyfill$b = function getPolyfill() {
if (!Object.assign) {
- return implementation$6;
+ return implementation$7;
}
if (lacksProperEnumerationOrder()) {
- return implementation$6;
+ return implementation$7;
}
if (assignHasPendingExceptions()) {
- return implementation$6;
+ return implementation$7;
}
return Object.assign;
};
var shim$c = function shimAssign() {
- var polyfill = polyfill$a();
+ var polyfill = polyfill$b();
defineProperties_1(
Object,
{ assign: polyfill },
return polyfill;
};
- var polyfill$b = polyfill$a();
+ var polyfill$c = polyfill$b();
- defineProperties_1(polyfill$b, {
- getPolyfill: polyfill$a,
- implementation: implementation$6,
+ defineProperties_1(polyfill$c, {
+ getPolyfill: polyfill$b,
+ implementation: implementation$7,
shim: shim$c
});
- var object_assign = polyfill$b;
+ var object_assign = polyfill$c;
/**
&nb