Comparing version 3.18.3 to 3.19.0
require('../../modules/es.date.to-primitive'); | ||
var uncurryThis = require('../../internals/function-uncurry-this'); | ||
var toPrimitive = require('../../internals/date-to-primitive'); | ||
module.exports = function (it, hint) { | ||
return toPrimitive.call(it, hint); | ||
}; | ||
module.exports = uncurryThis(toPrimitive); |
require('../../modules/es.date.to-string'); | ||
var dateToString = Date.prototype.toString; | ||
var uncurryThis = require('../../internals/function-uncurry-this'); | ||
module.exports = function toString(it) { | ||
return dateToString.call(it); | ||
}; | ||
module.exports = uncurryThis(Date.prototype.toString); |
@@ -1,3 +0,4 @@ | ||
var arrayAt = require('../array/virtual/at'); | ||
var stringAt = require('../string/virtual/at'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var arrayMethod = require('../array/virtual/at'); | ||
var stringMethod = require('../string/virtual/at'); | ||
@@ -9,6 +10,6 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.at; | ||
if (it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.at)) return arrayAt; | ||
if (typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.at)) { | ||
return stringAt; | ||
if (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.at)) return arrayMethod; | ||
if (typeof it == 'string' || it === StringPrototype || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.at)) { | ||
return stringMethod; | ||
} return own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var bind = require('../function/virtual/bind'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../function/virtual/bind'); | ||
@@ -7,3 +8,3 @@ var FunctionPrototype = Function.prototype; | ||
var own = it.bind; | ||
return it === FunctionPrototype || (it instanceof Function && own === FunctionPrototype.bind) ? bind : own; | ||
return it === FunctionPrototype || (isPrototypeOf(FunctionPrototype, it) && own === FunctionPrototype.bind) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var codePointAt = require('../string/virtual/code-point-at'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../string/virtual/code-point-at'); | ||
@@ -7,4 +8,4 @@ var StringPrototype = String.prototype; | ||
var own = it.codePointAt; | ||
return typeof it === 'string' || it === StringPrototype | ||
|| (it instanceof String && own === StringPrototype.codePointAt) ? codePointAt : own; | ||
return typeof it == 'string' || it === StringPrototype | ||
|| (isPrototypeOf(StringPrototype, it) && own === StringPrototype.codePointAt) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var concat = require('../array/virtual/concat'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/concat'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.concat; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.concat) ? concat : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.concat) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var copyWithin = require('../array/virtual/copy-within'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/copy-within'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.copyWithin; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.copyWithin) ? copyWithin : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.copyWithin) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var endsWith = require('../string/virtual/ends-with'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../string/virtual/ends-with'); | ||
@@ -7,4 +8,4 @@ var StringPrototype = String.prototype; | ||
var own = it.endsWith; | ||
return typeof it === 'string' || it === StringPrototype | ||
|| (it instanceof String && own === StringPrototype.endsWith) ? endsWith : own; | ||
return typeof it == 'string' || it === StringPrototype | ||
|| (isPrototypeOf(StringPrototype, it) && own === StringPrototype.endsWith) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var entries = require('../array/virtual/entries'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/entries'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.entries; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.entries) ? entries : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.entries) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var every = require('../array/virtual/every'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/every'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.every; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.every) ? every : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.every) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var fill = require('../array/virtual/fill'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/fill'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.fill; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.fill) ? fill : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.fill) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var filter = require('../array/virtual/filter'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/filter'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.filter; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.filter) ? filter : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.filter) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var findIndex = require('../array/virtual/find-index'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/find-index'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.findIndex; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.findIndex) ? findIndex : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.findIndex) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var find = require('../array/virtual/find'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/find'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.find; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.find) ? find : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.find) ? method : own; | ||
}; |
@@ -0,1 +1,2 @@ | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var flags = require('../regexp/flags'); | ||
@@ -6,3 +7,3 @@ | ||
module.exports = function (it) { | ||
return (it === RegExpPrototype || it instanceof RegExp) && !('flags' in it) ? flags(it) : it.flags; | ||
return (it === RegExpPrototype || isPrototypeOf(RegExpPrototype, it)) ? flags(it) : it.flags; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var flatMap = require('../array/virtual/flat-map'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/flat-map'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.flatMap; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.flatMap) ? flatMap : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.flatMap) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var flat = require('../array/virtual/flat'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/flat'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.flat; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.flat) ? flat : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.flat) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var forEach = require('../array/virtual/for-each'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/for-each'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.forEach; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.forEach) ? forEach : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.forEach) ? method : own; | ||
}; |
@@ -1,3 +0,4 @@ | ||
var arrayIncludes = require('../array/virtual/includes'); | ||
var stringIncludes = require('../string/virtual/includes'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var arrayMethod = require('../array/virtual/includes'); | ||
var stringMethod = require('../string/virtual/includes'); | ||
@@ -9,6 +10,6 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.includes; | ||
if (it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.includes)) return arrayIncludes; | ||
if (typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.includes)) { | ||
return stringIncludes; | ||
if (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.includes)) return arrayMethod; | ||
if (typeof it == 'string' || it === StringPrototype || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.includes)) { | ||
return stringMethod; | ||
} return own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var indexOf = require('../array/virtual/index-of'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/index-of'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.indexOf; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.indexOf) ? indexOf : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.indexOf) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var keys = require('../array/virtual/keys'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/keys'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.keys; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.keys) ? keys : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.keys) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var lastIndexOf = require('../array/virtual/last-index-of'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/last-index-of'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.lastIndexOf; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.lastIndexOf) ? lastIndexOf : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.lastIndexOf) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var map = require('../array/virtual/map'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/map'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.map; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.map) ? map : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.map) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var matchAll = require('../string/virtual/match-all'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../string/virtual/match-all'); | ||
@@ -7,4 +8,4 @@ var StringPrototype = String.prototype; | ||
var own = it.matchAll; | ||
return typeof it === 'string' || it === StringPrototype | ||
|| (it instanceof String && own === StringPrototype.matchAll) ? matchAll : own; | ||
return typeof it == 'string' || it === StringPrototype | ||
|| (isPrototypeOf(StringPrototype, it) && own === StringPrototype.matchAll) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var padEnd = require('../string/virtual/pad-end'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../string/virtual/pad-end'); | ||
@@ -7,4 +8,4 @@ var StringPrototype = String.prototype; | ||
var own = it.padEnd; | ||
return typeof it === 'string' || it === StringPrototype | ||
|| (it instanceof String && own === StringPrototype.padEnd) ? padEnd : own; | ||
return typeof it == 'string' || it === StringPrototype | ||
|| (isPrototypeOf(StringPrototype, it) && own === StringPrototype.padEnd) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var padStart = require('../string/virtual/pad-start'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../string/virtual/pad-start'); | ||
@@ -7,4 +8,4 @@ var StringPrototype = String.prototype; | ||
var own = it.padStart; | ||
return typeof it === 'string' || it === StringPrototype | ||
|| (it instanceof String && own === StringPrototype.padStart) ? padStart : own; | ||
return typeof it == 'string' || it === StringPrototype | ||
|| (isPrototypeOf(StringPrototype, it) && own === StringPrototype.padStart) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var reduceRight = require('../array/virtual/reduce-right'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/reduce-right'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.reduceRight; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.reduceRight) ? reduceRight : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reduceRight) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var reduce = require('../array/virtual/reduce'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/reduce'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.reduce; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.reduce) ? reduce : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reduce) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var repeat = require('../string/virtual/repeat'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../string/virtual/repeat'); | ||
@@ -7,4 +8,4 @@ var StringPrototype = String.prototype; | ||
var own = it.repeat; | ||
return typeof it === 'string' || it === StringPrototype | ||
|| (it instanceof String && own === StringPrototype.repeat) ? repeat : own; | ||
return typeof it == 'string' || it === StringPrototype | ||
|| (isPrototypeOf(StringPrototype, it) && own === StringPrototype.repeat) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var replaceAll = require('../string/virtual/replace-all'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../string/virtual/replace-all'); | ||
@@ -7,4 +8,4 @@ var StringPrototype = String.prototype; | ||
var own = it.replaceAll; | ||
return typeof it === 'string' || it === StringPrototype | ||
|| (it instanceof String && own === StringPrototype.replaceAll) ? replaceAll : own; | ||
return typeof it == 'string' || it === StringPrototype | ||
|| (isPrototypeOf(StringPrototype, it) && own === StringPrototype.replaceAll) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var reverse = require('../array/virtual/reverse'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/reverse'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.reverse; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.reverse) ? reverse : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reverse) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var slice = require('../array/virtual/slice'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/slice'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.slice; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.slice) ? slice : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.slice) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var some = require('../array/virtual/some'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/some'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.some; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.some) ? some : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.some) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var sort = require('../array/virtual/sort'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/sort'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.sort; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.sort) ? sort : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.sort) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var splice = require('../array/virtual/splice'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/splice'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.splice; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.splice) ? splice : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.splice) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var startsWith = require('../string/virtual/starts-with'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../string/virtual/starts-with'); | ||
@@ -7,4 +8,4 @@ var StringPrototype = String.prototype; | ||
var own = it.startsWith; | ||
return typeof it === 'string' || it === StringPrototype | ||
|| (it instanceof String && own === StringPrototype.startsWith) ? startsWith : own; | ||
return typeof it == 'string' || it === StringPrototype | ||
|| (isPrototypeOf(StringPrototype, it) && own === StringPrototype.startsWith) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var trimEnd = require('../string/virtual/trim-end'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../string/virtual/trim-end'); | ||
@@ -7,4 +8,4 @@ var StringPrototype = String.prototype; | ||
var own = it.trimEnd; | ||
return typeof it === 'string' || it === StringPrototype | ||
|| (it instanceof String && own === StringPrototype.trimEnd) ? trimEnd : own; | ||
return typeof it == 'string' || it === StringPrototype | ||
|| (isPrototypeOf(StringPrototype, it) && own === StringPrototype.trimEnd) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var trimLeft = require('../string/virtual/trim-left'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../string/virtual/trim-left'); | ||
@@ -7,4 +8,4 @@ var StringPrototype = String.prototype; | ||
var own = it.trimLeft; | ||
return typeof it === 'string' || it === StringPrototype | ||
|| (it instanceof String && own === StringPrototype.trimLeft) ? trimLeft : own; | ||
return typeof it == 'string' || it === StringPrototype | ||
|| (isPrototypeOf(StringPrototype, it) && own === StringPrototype.trimLeft) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var trimRight = require('../string/virtual/trim-right'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../string/virtual/trim-right'); | ||
@@ -7,4 +8,4 @@ var StringPrototype = String.prototype; | ||
var own = it.trimRight; | ||
return typeof it === 'string' || it === StringPrototype | ||
|| (it instanceof String && own === StringPrototype.trimRight) ? trimRight : own; | ||
return typeof it == 'string' || it === StringPrototype | ||
|| (isPrototypeOf(StringPrototype, it) && own === StringPrototype.trimRight) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var trimStart = require('../string/virtual/trim-start'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../string/virtual/trim-start'); | ||
@@ -7,4 +8,4 @@ var StringPrototype = String.prototype; | ||
var own = it.trimStart; | ||
return typeof it === 'string' || it === StringPrototype | ||
|| (it instanceof String && own === StringPrototype.trimStart) ? trimStart : own; | ||
return typeof it == 'string' || it === StringPrototype | ||
|| (isPrototypeOf(StringPrototype, it) && own === StringPrototype.trimStart) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var trim = require('../string/virtual/trim'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../string/virtual/trim'); | ||
@@ -7,4 +8,4 @@ var StringPrototype = String.prototype; | ||
var own = it.trim; | ||
return typeof it === 'string' || it === StringPrototype | ||
|| (it instanceof String && own === StringPrototype.trim) ? trim : own; | ||
return typeof it == 'string' || it === StringPrototype | ||
|| (isPrototypeOf(StringPrototype, it) && own === StringPrototype.trim) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var values = require('../array/virtual/values'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/values'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.values; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.values) ? values : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.values) ? method : own; | ||
}; |
require('../../modules/es.json.stringify'); | ||
var core = require('../../internals/path'); | ||
var path = require('../../internals/path'); | ||
var apply = require('../../internals/function-apply'); | ||
// eslint-disable-next-line es/no-json -- safe | ||
if (!core.JSON) core.JSON = { stringify: JSON.stringify }; | ||
if (!path.JSON) path.JSON = { stringify: JSON.stringify }; | ||
// eslint-disable-next-line no-unused-vars -- required for `.length` | ||
module.exports = function stringify(it, replacer, space) { | ||
return core.JSON.stringify.apply(null, arguments); | ||
return apply(path.JSON.stringify, null, arguments); | ||
}; |
@@ -7,2 +7,3 @@ 'use strict'; | ||
require('../../modules/es.string.iterator'); | ||
var call = require('../../internals/function-call'); | ||
var isCallable = require('../../internals/is-callable'); | ||
@@ -15,3 +16,3 @@ var path = require('../../internals/path'); | ||
module.exports = function allSettled(iterable) { | ||
return $allSettled.call(isCallable(this) ? this : Promise, iterable); | ||
return call($allSettled, isCallable(this) ? this : Promise, iterable); | ||
}; |
@@ -8,2 +8,3 @@ 'use strict'; | ||
require('../../modules/es.string.iterator'); | ||
var call = require('../../internals/function-call'); | ||
var isCallable = require('../../internals/is-callable'); | ||
@@ -16,3 +17,3 @@ var path = require('../../internals/path'); | ||
module.exports = function any(iterable) { | ||
return $any.call(isCallable(this) ? this : Promise, iterable); | ||
return call($any, isCallable(this) ? this : Promise, iterable); | ||
}; |
require('../../modules/es.regexp.flags'); | ||
var flags = require('../../internals/regexp-flags'); | ||
var uncurryThis = require('../../internals/function-uncurry-this'); | ||
var regExpFlags = require('../../internals/regexp-flags'); | ||
module.exports = function (it) { | ||
return flags.call(it); | ||
}; | ||
module.exports = uncurryThis(regExpFlags); |
require('../../modules/es.regexp.exec'); | ||
require('../../modules/es.string.match'); | ||
var call = require('../../internals/function-call'); | ||
var wellKnownSymbol = require('../../internals/well-known-symbol'); | ||
@@ -8,3 +9,3 @@ | ||
module.exports = function (it, str) { | ||
return RegExp.prototype[MATCH].call(it, str); | ||
return call(RegExp.prototype[MATCH], it, str); | ||
}; |
require('../../modules/es.regexp.exec'); | ||
require('../../modules/es.string.replace'); | ||
var call = require('../../internals/function-call'); | ||
var wellKnownSymbol = require('../../internals/well-known-symbol'); | ||
@@ -8,3 +9,3 @@ | ||
module.exports = function (it, str, replacer) { | ||
return RegExp.prototype[REPLACE].call(it, str, replacer); | ||
return call(RegExp.prototype[REPLACE], it, str, replacer); | ||
}; |
require('../../modules/es.regexp.exec'); | ||
require('../../modules/es.string.search'); | ||
var call = require('../../internals/function-call'); | ||
var wellKnownSymbol = require('../../internals/well-known-symbol'); | ||
@@ -8,3 +9,3 @@ | ||
module.exports = function (it, str) { | ||
return RegExp.prototype[SEARCH].call(it, str); | ||
return call(RegExp.prototype[SEARCH], it, str); | ||
}; |
require('../../modules/es.regexp.exec'); | ||
require('../../modules/es.string.split'); | ||
var call = require('../../internals/function-call'); | ||
var wellKnownSymbol = require('../../internals/well-known-symbol'); | ||
@@ -8,3 +9,3 @@ | ||
module.exports = function (it, str, limit) { | ||
return RegExp.prototype[SPLIT].call(it, str, limit); | ||
return call(RegExp.prototype[SPLIT], it, str, limit); | ||
}; |
require('../../modules/es.regexp.exec'); | ||
require('../../modules/es.regexp.test'); | ||
var uncurryThis = require('../../internals/function-uncurry-this'); | ||
module.exports = function (re, string) { | ||
return RegExp.prototype.test.call(re, string); | ||
}; | ||
module.exports = uncurryThis(/./.test); |
require('../../modules/es.regexp.to-string'); | ||
var uncurryThis = require('../../internals/function-uncurry-this'); | ||
module.exports = function toString(it) { | ||
return RegExp.prototype.toString.call(it); | ||
}; | ||
module.exports = uncurryThis(/./.toString); |
require('../../modules/es.object.to-string'); | ||
require('../../modules/es.string.iterator'); | ||
var uncurryThis = require('../../internals/function-uncurry-this'); | ||
var Iterators = require('../../internals/iterators'); | ||
var getStringIterator = Iterators.String; | ||
module.exports = function (it) { | ||
return getStringIterator.call(it); | ||
}; | ||
module.exports = uncurryThis(Iterators.String); |
@@ -1,3 +0,4 @@ | ||
var arrayAt = require('../array/virtual/at'); | ||
var stringAt = require('../string/virtual/at'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var arrayMethod = require('../array/virtual/at'); | ||
var stringMethod = require('../string/virtual/at'); | ||
@@ -9,6 +10,6 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.at; | ||
if (it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.at)) return arrayAt; | ||
if (typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.at)) { | ||
return stringAt; | ||
if (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.at)) return arrayMethod; | ||
if (typeof it == 'string' || it === StringPrototype || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.at)) { | ||
return stringMethod; | ||
} return own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var codePoints = require('../string/virtual/code-points'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../string/virtual/code-points'); | ||
@@ -7,4 +8,4 @@ var StringPrototype = String.prototype; | ||
var own = it.codePoints; | ||
return typeof it === 'string' || it === StringPrototype | ||
|| (it instanceof String && own === StringPrototype.codePoints) ? codePoints : own; | ||
return typeof it == 'string' || it === StringPrototype | ||
|| (isPrototypeOf(StringPrototype, it) && own === StringPrototype.codePoints) ? method : own; | ||
}; |
// TODO: Remove from `core-js@4` | ||
var filterOut = require('../array/virtual/filter-out'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/filter-out'); | ||
@@ -8,3 +9,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.filterOut; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.filterOut) ? filterOut : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.filterOut) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var filterReject = require('../array/virtual/filter-reject'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/filter-reject'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.filterReject; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.filterReject) ? filterReject : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.filterReject) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var findLastIndex = require('../array/virtual/find-last-index'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/find-last-index'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.findLastIndex; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.findLastIndex) ? findLastIndex : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.findLastIndex) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var findLast = require('../array/virtual/find-last'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/find-last'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.findLast; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.findLast) ? findLast : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.findLast) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var groupBy = require('../array/virtual/group-by'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/group-by'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.groupBy; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.groupBy) ? groupBy : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.groupBy) ? method : own; | ||
}; |
@@ -1,2 +0,3 @@ | ||
var uniqueBy = require('../array/virtual/unique-by'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/unique-by'); | ||
@@ -7,3 +8,3 @@ var ArrayPrototype = Array.prototype; | ||
var own = it.uniqueBy; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.uniqueBy) ? uniqueBy : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.uniqueBy) ? method : own; | ||
}; |
@@ -7,2 +7,3 @@ 'use strict'; | ||
require('../../modules/web.dom-collections.iterator'); | ||
var call = require('../../internals/function-call'); | ||
var isCallable = require('../../internals/is-callable'); | ||
@@ -12,6 +13,6 @@ var path = require('../../internals/path'); | ||
var Map = path.Map; | ||
var mapFrom = Map.from; | ||
var $from = Map.from; | ||
module.exports = function from(source, mapFn, thisArg) { | ||
return mapFrom.call(isCallable(this) ? this : Map, source, mapFn, thisArg); | ||
return call($from, isCallable(this) ? this : Map, source, mapFn, thisArg); | ||
}; |
'use strict'; | ||
require('../../modules/es.map'); | ||
require('../../modules/esnext.map.group-by'); | ||
var call = require('../../internals/function-call'); | ||
var isCallable = require('../../internals/is-callable'); | ||
@@ -11,3 +12,3 @@ var path = require('../../internals/path'); | ||
module.exports = function groupBy(source, iterable, keyDerivative) { | ||
return mapGroupBy.call(isCallable(this) ? this : Map, source, iterable, keyDerivative); | ||
return call(mapGroupBy, isCallable(this) ? this : Map, source, iterable, keyDerivative); | ||
}; |
'use strict'; | ||
require('../../modules/es.map'); | ||
require('../../modules/esnext.map.key-by'); | ||
var call = require('../../internals/function-call'); | ||
var isCallable = require('../../internals/is-callable'); | ||
@@ -11,3 +12,3 @@ var path = require('../../internals/path'); | ||
module.exports = function keyBy(source, iterable, keyDerivative) { | ||
return mapKeyBy.call(isCallable(this) ? this : Map, source, iterable, keyDerivative); | ||
return call(mapKeyBy, isCallable(this) ? this : Map, source, iterable, keyDerivative); | ||
}; |
@@ -5,4 +5,5 @@ 'use strict'; | ||
require('../../modules/esnext.map.of'); | ||
var path = require('../../internals/path'); | ||
var apply = require('../../internals/function-apply'); | ||
var isCallable = require('../../internals/is-callable'); | ||
var path = require('../../internals/path'); | ||
@@ -13,3 +14,3 @@ var Map = path.Map; | ||
module.exports = function of() { | ||
return mapOf.apply(isCallable(this) ? this : Map, arguments); | ||
return apply(mapOf, isCallable(this) ? this : Map, arguments); | ||
}; |
'use strict'; | ||
require('../../modules/es.promise'); | ||
require('../../modules/esnext.promise.try'); | ||
var call = require('../../internals/function-call'); | ||
var isCallable = require('../../internals/is-callable'); | ||
@@ -11,3 +12,3 @@ var path = require('../../internals/path'); | ||
module.exports = { 'try': function (callbackfn) { | ||
return promiseTry.call(isCallable(this) ? this : Promise, callbackfn); | ||
return call(promiseTry, isCallable(this) ? this : Promise, callbackfn); | ||
} }['try']; |
@@ -7,2 +7,3 @@ 'use strict'; | ||
require('../../modules/web.dom-collections.iterator'); | ||
var call = require('../../internals/function-call'); | ||
var isCallable = require('../../internals/is-callable'); | ||
@@ -12,6 +13,6 @@ var path = require('../../internals/path'); | ||
var Set = path.Set; | ||
var setFrom = Set.from; | ||
var $from = Set.from; | ||
module.exports = function from(source, mapFn, thisArg) { | ||
return setFrom.call(isCallable(this) ? this : Set, source, mapFn, thisArg); | ||
return call($from, isCallable(this) ? this : Set, source, mapFn, thisArg); | ||
}; |
@@ -5,4 +5,5 @@ 'use strict'; | ||
require('../../modules/esnext.set.of'); | ||
var path = require('../../internals/path'); | ||
var apply = require('../../internals/function-apply'); | ||
var isCallable = require('../../internals/is-callable'); | ||
var path = require('../../internals/path'); | ||
@@ -13,3 +14,3 @@ var Set = path.Set; | ||
module.exports = function of() { | ||
return setOf.apply(isCallable(this) ? this : Set, arguments); | ||
return apply(setOf, isCallable(this) ? this : Set, arguments); | ||
}; |
@@ -7,2 +7,3 @@ 'use strict'; | ||
require('../../modules/web.dom-collections.iterator'); | ||
var call = require('../../internals/function-call'); | ||
var isCallable = require('../../internals/is-callable'); | ||
@@ -12,6 +13,6 @@ var path = require('../../internals/path'); | ||
var WeakMap = path.WeakMap; | ||
var weakMapFrom = WeakMap.from; | ||
var $from = WeakMap.from; | ||
module.exports = function from(source, mapFn, thisArg) { | ||
return weakMapFrom.call(isCallable(this) ? this : WeakMap, source, mapFn, thisArg); | ||
return call($from, isCallable(this) ? this : WeakMap, source, mapFn, thisArg); | ||
}; |
@@ -5,4 +5,5 @@ 'use strict'; | ||
require('../../modules/esnext.weak-map.of'); | ||
var path = require('../../internals/path'); | ||
var apply = require('../../internals/function-apply'); | ||
var isCallable = require('../../internals/is-callable'); | ||
var path = require('../../internals/path'); | ||
@@ -13,3 +14,3 @@ var WeakMap = path.WeakMap; | ||
module.exports = function of() { | ||
return weakMapOf.apply(isCallable(this) ? this : WeakMap, arguments); | ||
return apply(weakMapOf, isCallable(this) ? this : WeakMap, arguments); | ||
}; |
@@ -7,2 +7,3 @@ 'use strict'; | ||
require('../../modules/web.dom-collections.iterator'); | ||
var call = require('../../internals/function-call'); | ||
var isCallable = require('../../internals/is-callable'); | ||
@@ -12,6 +13,6 @@ var path = require('../../internals/path'); | ||
var WeakSet = path.WeakSet; | ||
var weakSetfrom = WeakSet.from; | ||
var $from = WeakSet.from; | ||
module.exports = function from(source, mapFn, thisArg) { | ||
return weakSetfrom.call(isCallable(this) ? this : WeakSet, source, mapFn, thisArg); | ||
return call($from, isCallable(this) ? this : WeakSet, source, mapFn, thisArg); | ||
}; |
@@ -5,4 +5,5 @@ 'use strict'; | ||
require('../../modules/esnext.weak-set.of'); | ||
var path = require('../../internals/path'); | ||
var apply = require('../../internals/function-apply'); | ||
var isCallable = require('../../internals/is-callable'); | ||
var path = require('../../internals/path'); | ||
@@ -13,3 +14,3 @@ var WeakSet = path.WeakSet; | ||
module.exports = function of() { | ||
return weakSetOf.apply(isCallable(this) ? this : WeakSet, arguments); | ||
return apply(weakSetOf, isCallable(this) ? this : WeakSet, arguments); | ||
}; |
@@ -0,4 +1,7 @@ | ||
var global = require('../internals/global'); | ||
var isCallable = require('../internals/is-callable'); | ||
var tryToString = require('../internals/try-to-string'); | ||
var TypeError = global.TypeError; | ||
// `Assert: IsCallable(argument) is true` | ||
@@ -5,0 +8,0 @@ module.exports = function (argument) { |
@@ -0,4 +1,7 @@ | ||
var global = require('../internals/global'); | ||
var isConstructor = require('../internals/is-constructor'); | ||
var tryToString = require('../internals/try-to-string'); | ||
var TypeError = global.TypeError; | ||
// `Assert: IsConstructor(argument) is true` | ||
@@ -5,0 +8,0 @@ module.exports = function (argument) { |
@@ -0,6 +1,10 @@ | ||
var global = require('../internals/global'); | ||
var isCallable = require('../internals/is-callable'); | ||
var String = global.String; | ||
var TypeError = global.TypeError; | ||
module.exports = function (argument) { | ||
if (typeof argument === 'object' || isCallable(argument)) return argument; | ||
if (typeof argument == 'object' || isCallable(argument)) return argument; | ||
throw TypeError("Can't set " + String(argument) + ' as a prototype'); | ||
}; |
@@ -1,4 +0,9 @@ | ||
module.exports = function (it, Constructor, name) { | ||
if (it instanceof Constructor) return it; | ||
throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation'); | ||
var global = require('../internals/global'); | ||
var isPrototypeOf = require('../internals/object-is-prototype-of'); | ||
var TypeError = global.TypeError; | ||
module.exports = function (it, Prototype) { | ||
if (isPrototypeOf(Prototype, it)) return it; | ||
throw TypeError('Incorrect invocation'); | ||
}; |
@@ -0,3 +1,7 @@ | ||
var global = require('../internals/global'); | ||
var isObject = require('../internals/is-object'); | ||
var String = global.String; | ||
var TypeError = global.TypeError; | ||
// `Assert: Type(argument) is Object` | ||
@@ -4,0 +8,0 @@ module.exports = function (argument) { |
// eslint-disable-next-line es/no-typed-arrays -- safe | ||
module.exports = typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined'; | ||
module.exports = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined'; |
@@ -13,2 +13,3 @@ 'use strict'; | ||
var defineProperty = require('../internals/object-define-property').f; | ||
var isPrototypeOf = require('../internals/object-is-prototype-of'); | ||
var getPrototypeOf = require('../internals/object-get-prototype-of'); | ||
@@ -26,3 +27,3 @@ var setPrototypeOf = require('../internals/object-set-prototype-of'); | ||
var ObjectPrototype = Object.prototype; | ||
var isPrototypeOf = ObjectPrototype.isPrototypeOf; | ||
var TypeError = global.TypeError; | ||
@@ -75,3 +76,3 @@ var TO_STRING_TAG = wellKnownSymbol('toStringTag'); | ||
var aTypedArrayConstructor = function (C) { | ||
if (isCallable(C) && (!setPrototypeOf || isPrototypeOf.call(TypedArray, C))) return C; | ||
if (isCallable(C) && (!setPrototypeOf || isPrototypeOf(TypedArray, C))) return C; | ||
throw TypeError(tryToString(C) + ' is not a typed array constructor'); | ||
@@ -78,0 +79,0 @@ }; |
'use strict'; | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var DESCRIPTORS = require('../internals/descriptors'); | ||
@@ -19,2 +20,3 @@ var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-native'); | ||
var arrayFill = require('../internals/array-fill'); | ||
var arraySlice = require('../internals/array-slice'); | ||
var setToStringTag = require('../internals/set-to-string-tag'); | ||
@@ -34,6 +36,10 @@ var InternalStateModule = require('../internals/internal-state'); | ||
var $ArrayBuffer = NativeArrayBuffer; | ||
var ArrayBufferPrototype = $ArrayBuffer && $ArrayBuffer[PROTOTYPE]; | ||
var $DataView = global[DATA_VIEW]; | ||
var $DataViewPrototype = $DataView && $DataView[PROTOTYPE]; | ||
var DataViewPrototype = $DataView && $DataView[PROTOTYPE]; | ||
var ObjectPrototype = Object.prototype; | ||
var Array = global.Array; | ||
var RangeError = global.RangeError; | ||
var fill = uncurryThis(arrayFill); | ||
var reverse = uncurryThis([].reverse); | ||
@@ -77,4 +83,4 @@ var packIEEE754 = IEEE754.pack; | ||
var start = intIndex + store.byteOffset; | ||
var pack = bytes.slice(start, start + count); | ||
return isLittleEndian ? pack : pack.reverse(); | ||
var pack = arraySlice(bytes, start, start + count); | ||
return isLittleEndian ? pack : reverse(pack); | ||
}; | ||
@@ -94,6 +100,6 @@ | ||
$ArrayBuffer = function ArrayBuffer(length) { | ||
anInstance(this, $ArrayBuffer, ARRAY_BUFFER); | ||
anInstance(this, ArrayBufferPrototype); | ||
var byteLength = toIndex(length); | ||
setInternalState(this, { | ||
bytes: arrayFill.call(new Array(byteLength), 0), | ||
bytes: fill(Array(byteLength), 0), | ||
byteLength: byteLength | ||
@@ -104,5 +110,7 @@ }); | ||
ArrayBufferPrototype = $ArrayBuffer[PROTOTYPE]; | ||
$DataView = function DataView(buffer, byteOffset, byteLength) { | ||
anInstance(this, $DataView, DATA_VIEW); | ||
anInstance(buffer, $ArrayBuffer, DATA_VIEW); | ||
anInstance(this, DataViewPrototype); | ||
anInstance(buffer, ArrayBufferPrototype); | ||
var bufferLength = getInternalState(buffer).byteLength; | ||
@@ -125,2 +133,4 @@ var offset = toIntegerOrInfinity(byteOffset); | ||
DataViewPrototype = $DataView[PROTOTYPE]; | ||
if (DESCRIPTORS) { | ||
@@ -133,3 +143,3 @@ addGetter($ArrayBuffer, 'byteLength'); | ||
redefineAll($DataView[PROTOTYPE], { | ||
redefineAll(DataViewPrototype, { | ||
getInt8: function getInt8(byteOffset) { | ||
@@ -201,6 +211,8 @@ return get(this, 1, byteOffset)[0] << 24 >> 24; | ||
$ArrayBuffer = function ArrayBuffer(length) { | ||
anInstance(this, $ArrayBuffer); | ||
anInstance(this, ArrayBufferPrototype); | ||
return new NativeArrayBuffer(toIndex(length)); | ||
}; | ||
var ArrayBufferPrototype = $ArrayBuffer[PROTOTYPE] = NativeArrayBuffer[PROTOTYPE]; | ||
$ArrayBuffer[PROTOTYPE] = ArrayBufferPrototype; | ||
for (var keys = getOwnPropertyNames(NativeArrayBuffer), j = 0, key; keys.length > j;) { | ||
@@ -211,2 +223,3 @@ if (!((key = keys[j++]) in $ArrayBuffer)) { | ||
} | ||
ArrayBufferPrototype.constructor = $ArrayBuffer; | ||
@@ -218,4 +231,4 @@ } else if (INCORRECT_ARRAY_BUFFER_NAME && CONFIGURABLE_FUNCTION_NAME) { | ||
// WebKit bug - the same parent prototype for typed arrays and data view | ||
if (setPrototypeOf && getPrototypeOf($DataViewPrototype) !== ObjectPrototype) { | ||
setPrototypeOf($DataViewPrototype, ObjectPrototype); | ||
if (setPrototypeOf && getPrototypeOf(DataViewPrototype) !== ObjectPrototype) { | ||
setPrototypeOf(DataViewPrototype, ObjectPrototype); | ||
} | ||
@@ -225,11 +238,11 @@ | ||
var testView = new $DataView(new $ArrayBuffer(2)); | ||
var $setInt8 = $DataViewPrototype.setInt8; | ||
var $setInt8 = uncurryThis(DataViewPrototype.setInt8); | ||
testView.setInt8(0, 2147483648); | ||
testView.setInt8(1, 2147483649); | ||
if (testView.getInt8(0) || !testView.getInt8(1)) redefineAll($DataViewPrototype, { | ||
if (testView.getInt8(0) || !testView.getInt8(1)) redefineAll(DataViewPrototype, { | ||
setInt8: function setInt8(byteOffset, value) { | ||
$setInt8.call(this, byteOffset, value << 24 >> 24); | ||
$setInt8(this, byteOffset, value << 24 >> 24); | ||
}, | ||
setUint8: function setUint8(byteOffset, value) { | ||
$setInt8.call(this, byteOffset, value << 24 >> 24); | ||
$setInt8(this, byteOffset, value << 24 >> 24); | ||
} | ||
@@ -236,0 +249,0 @@ }, { unsafe: true }); |
@@ -27,3 +27,3 @@ 'use strict'; | ||
var O = toObject(asyncItems); | ||
if (mapfn !== undefined) mapfn = bind(mapfn, thisArg, 2); | ||
if (mapfn !== undefined) mapfn = bind(mapfn, thisArg); | ||
var usingAsyncIterator = getMethod(O, ASYNC_ITERATOR); | ||
@@ -30,0 +30,0 @@ var usingSyncIterator = usingAsyncIterator ? undefined : getIteratorMethod(O) || arrayIterator; |
'use strict'; | ||
var global = require('../internals/global'); | ||
var bind = require('../internals/function-bind-context'); | ||
var call = require('../internals/function-call'); | ||
var toObject = require('../internals/to-object'); | ||
@@ -12,2 +14,4 @@ var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing'); | ||
var Array = global.Array; | ||
// `Array.from` method implementation | ||
@@ -21,3 +25,3 @@ // https://tc39.es/ecma262/#sec-array.from | ||
var mapping = mapfn !== undefined; | ||
if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2); | ||
if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined); | ||
var iteratorMethod = getIteratorMethod(O); | ||
@@ -31,3 +35,3 @@ var index = 0; | ||
result = IS_CONSTRUCTOR ? new this() : []; | ||
for (;!(step = next.call(iterator)).done; index++) { | ||
for (;!(step = call(next, iterator)).done; index++) { | ||
value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value; | ||
@@ -34,0 +38,0 @@ createProperty(result, index, value); |
@@ -0,2 +1,4 @@ | ||
var global = require('../internals/global'); | ||
var bind = require('../internals/function-bind-context'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var IndexedObject = require('../internals/indexed-object'); | ||
@@ -9,3 +11,4 @@ var toObject = require('../internals/to-object'); | ||
var push = [].push; | ||
var Array = global.Array; | ||
var push = uncurryThis([].push); | ||
@@ -15,3 +18,3 @@ module.exports = function ($this, callbackfn, that, specificConstructor) { | ||
var self = IndexedObject(O); | ||
var boundFunction = bind(callbackfn, that, 3); | ||
var boundFunction = bind(callbackfn, that); | ||
var target = objectCreate(null); | ||
@@ -26,3 +29,3 @@ var length = lengthOfArrayLike(self); | ||
// but since it's a `null` prototype object, we can safely use `in` | ||
if (key in target) push.call(target[key], value); | ||
if (key in target) push(target[key], value); | ||
else target[key] = [value]; | ||
@@ -29,0 +32,0 @@ } |
@@ -12,3 +12,3 @@ var bind = require('../internals/function-bind-context'); | ||
var self = IndexedObject(O); | ||
var boundFunction = bind(callbackfn, that, 3); | ||
var boundFunction = bind(callbackfn, that); | ||
var index = lengthOfArrayLike(self); | ||
@@ -15,0 +15,0 @@ var value, result; |
var bind = require('../internals/function-bind-context'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var IndexedObject = require('../internals/indexed-object'); | ||
@@ -7,3 +8,3 @@ var toObject = require('../internals/to-object'); | ||
var push = [].push; | ||
var push = uncurryThis([].push); | ||
@@ -22,3 +23,3 @@ // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation | ||
var self = IndexedObject(O); | ||
var boundFunction = bind(callbackfn, that, 3); | ||
var boundFunction = bind(callbackfn, that); | ||
var length = lengthOfArrayLike(self); | ||
@@ -38,6 +39,6 @@ var index = 0; | ||
case 6: return index; // findIndex | ||
case 2: push.call(target, value); // filter | ||
case 2: push(target, value); // filter | ||
} else switch (TYPE) { | ||
case 4: return false; // every | ||
case 7: push.call(target, value); // filterReject | ||
case 7: push(target, value); // filterReject | ||
} | ||
@@ -44,0 +45,0 @@ } |
'use strict'; | ||
/* eslint-disable es/no-array-prototype-lastindexof -- safe */ | ||
var apply = require('../internals/function-apply'); | ||
var toIndexedObject = require('../internals/to-indexed-object'); | ||
@@ -18,3 +19,3 @@ var toIntegerOrInfinity = require('../internals/to-integer-or-infinity'); | ||
// convert -0 to +0 | ||
if (NEGATIVE_ZERO) return $lastIndexOf.apply(this, arguments) || 0; | ||
if (NEGATIVE_ZERO) return apply($lastIndexOf, this, arguments) || 0; | ||
var O = toIndexedObject(this); | ||
@@ -21,0 +22,0 @@ var length = lengthOfArrayLike(O); |
@@ -0,1 +1,2 @@ | ||
var global = require('../internals/global'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -6,2 +7,4 @@ var toObject = require('../internals/to-object'); | ||
var TypeError = global.TypeError; | ||
// `Array.prototype.{ reduce, reduceRight }` methods implementation | ||
@@ -8,0 +11,0 @@ var createMethod = function (IS_RIGHT) { |
@@ -1,2 +0,3 @@ | ||
// TODO: use something more complex like timsort? | ||
var arraySlice = require('../internals/array-slice'); | ||
var floor = Math.floor; | ||
@@ -8,4 +9,5 @@ | ||
return length < 8 ? insertionSort(array, comparefn) : merge( | ||
mergeSort(array.slice(0, middle), comparefn), | ||
mergeSort(array.slice(middle), comparefn), | ||
array, | ||
mergeSort(arraySlice(array, 0, middle), comparefn), | ||
mergeSort(arraySlice(array, middle), comparefn), | ||
comparefn | ||
@@ -30,3 +32,3 @@ ); | ||
var merge = function (left, right, comparefn) { | ||
var merge = function (array, left, right, comparefn) { | ||
var llength = left.length; | ||
@@ -36,13 +38,10 @@ var rlength = right.length; | ||
var rindex = 0; | ||
var result = []; | ||
while (lindex < llength || rindex < rlength) { | ||
if (lindex < llength && rindex < rlength) { | ||
result.push(comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]); | ||
} else { | ||
result.push(lindex < llength ? left[lindex++] : right[rindex++]); | ||
} | ||
} return result; | ||
array[lindex + rindex] = (lindex < llength && rindex < rlength) | ||
? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++] | ||
: lindex < llength ? left[lindex++] : right[rindex++]; | ||
} return array; | ||
}; | ||
module.exports = mergeSort; |
@@ -0,1 +1,2 @@ | ||
var global = require('../internals/global'); | ||
var isArray = require('../internals/is-array'); | ||
@@ -7,2 +8,3 @@ var isConstructor = require('../internals/is-constructor'); | ||
var SPECIES = wellKnownSymbol('species'); | ||
var Array = global.Array; | ||
@@ -9,0 +11,0 @@ // a part of `ArraySpeciesCreate` abstract operation |
'use strict'; | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var aCallable = require('../internals/a-callable'); | ||
var lengthOfArrayLike = require('../internals/length-of-array-like'); | ||
var toObject = require('../internals/to-object'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var arraySpeciesCreate = require('../internals/array-species-create'); | ||
var push = [].push; | ||
var Map = getBuiltIn('Map'); | ||
var MapPrototype = Map.prototype; | ||
var mapForEach = uncurryThis(MapPrototype.forEach); | ||
var mapHas = uncurryThis(MapPrototype.has); | ||
var mapSet = uncurryThis(MapPrototype.set); | ||
var push = uncurryThis([].push); | ||
@@ -16,18 +22,16 @@ // `Array.prototype.uniqueBy` method | ||
var result = arraySpeciesCreate(that, 0); | ||
var Map = getBuiltIn('Map'); | ||
var map = new Map(); | ||
var resolverFunction, index, item, key; | ||
if (resolver != null) resolverFunction = aCallable(resolver); | ||
else resolverFunction = function (value) { | ||
var resolverFunction = resolver != null ? aCallable(resolver) : function (value) { | ||
return value; | ||
}; | ||
var index, item, key; | ||
for (index = 0; index < length; index++) { | ||
item = that[index]; | ||
key = resolverFunction(item); | ||
if (!map.has(key)) map.set(key, item); | ||
if (!mapHas(map, key)) mapSet(map, key, item); | ||
} | ||
map.forEach(function (value) { | ||
push.call(result, value); | ||
mapForEach(map, function (value) { | ||
push(result, value); | ||
}); | ||
return result; | ||
}; |
'use strict'; | ||
var apply = require('../internals/function-apply'); | ||
var anObject = require('../internals/an-object'); | ||
@@ -34,3 +35,3 @@ var create = require('../internals/object-create'); | ||
return new Promise(function (resolve, reject) { | ||
var result = anObject(state.next.apply(state.iterator, hasArg ? [arg] : [])); | ||
var result = anObject(apply(state.next, state.iterator, hasArg ? [arg] : [])); | ||
asyncFromSyncIteratorContinuation(result, resolve, reject); | ||
@@ -45,3 +46,3 @@ }); | ||
if ($return === undefined) return resolve({ done: true, value: arg }); | ||
var result = anObject($return.apply(iterator, hasArg ? [arg] : [])); | ||
var result = anObject(apply($return, iterator, hasArg ? [arg] : [])); | ||
asyncFromSyncIteratorContinuation(result, resolve, reject); | ||
@@ -56,3 +57,3 @@ }); | ||
if ($throw === undefined) return reject(arg); | ||
var result = anObject($throw.apply(iterator, hasArg ? [arg] : [])); | ||
var result = anObject(apply($throw, iterator, hasArg ? [arg] : [])); | ||
asyncFromSyncIteratorContinuation(result, resolve, reject); | ||
@@ -59,0 +60,0 @@ }); |
'use strict'; | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -36,3 +37,3 @@ var anObject = require('../internals/an-object'); | ||
state.ignoreArgument = false; | ||
resolve(state.done ? { done: true, value: undefined } : anObject(nextHandler.call(state, Promise, args))); | ||
resolve(state.done ? { done: true, value: undefined } : anObject(call(nextHandler, state, Promise, args))); | ||
}); | ||
@@ -48,3 +49,3 @@ }, | ||
if ($$return === undefined) return resolve({ done: true, value: value }); | ||
Promise.resolve($$return.call(iterator, value)).then(function (result) { | ||
Promise.resolve(call($$return, iterator, value)).then(function (result) { | ||
anObject(result); | ||
@@ -63,3 +64,3 @@ resolve({ done: true, value: value }); | ||
if ($$throw === undefined) return reject(value); | ||
resolve($$throw.call(iterator, value)); | ||
resolve(call($$throw, iterator, value)); | ||
}); | ||
@@ -66,0 +67,0 @@ } |
'use strict'; | ||
// https://github.com/tc39/proposal-iterator-helpers | ||
// https://github.com/tc39/proposal-array-from-async | ||
var global = require('../internals/global'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -10,2 +12,3 @@ var anObject = require('../internals/an-object'); | ||
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; | ||
var TypeError = global.TypeError; | ||
@@ -30,3 +33,3 @@ var createMethod = function (TYPE) { | ||
if (returnMethod) { | ||
return Promise.resolve(returnMethod.call(iterator)).then(function () { | ||
return Promise.resolve(call(returnMethod, iterator)).then(function () { | ||
method(argument); | ||
@@ -51,3 +54,3 @@ }, function (error) { | ||
} | ||
Promise.resolve(anObject(next.call(iterator))).then(function (step) { | ||
Promise.resolve(anObject(call(next, iterator))).then(function (step) { | ||
try { | ||
@@ -54,0 +57,0 @@ if (anObject(step).done) { |
@@ -1,5 +0,8 @@ | ||
var toString = {}.toString; | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var toString = uncurryThis({}.toString); | ||
var stringSlice = uncurryThis(''.slice); | ||
module.exports = function (it) { | ||
return toString.call(it).slice(8, -1); | ||
return stringSlice(toString(it), 8, -1); | ||
}; |
@@ -0,1 +1,2 @@ | ||
var global = require('../internals/global'); | ||
var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support'); | ||
@@ -7,2 +8,4 @@ var isCallable = require('../internals/is-callable'); | ||
var TO_STRING_TAG = wellKnownSymbol('toStringTag'); | ||
var Object = global.Object; | ||
// ES3 wrong here | ||
@@ -9,0 +12,0 @@ var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments'; |
'use strict'; | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -6,9 +7,9 @@ var anObject = require('../internals/an-object'); | ||
// https://github.com/tc39/collection-methods | ||
module.exports = function (/* ...elements */) { | ||
module.exports = function addAll(/* ...elements */) { | ||
var set = anObject(this); | ||
var adder = aCallable(set.add); | ||
for (var k = 0, len = arguments.length; k < len; k++) { | ||
adder.call(set, arguments[k]); | ||
call(adder, set, arguments[k]); | ||
} | ||
return set; | ||
}; |
'use strict'; | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -6,3 +7,3 @@ var anObject = require('../internals/an-object'); | ||
// https://github.com/tc39/collection-methods | ||
module.exports = function (/* ...elements */) { | ||
module.exports = function deleteAll(/* ...elements */) { | ||
var collection = anObject(this); | ||
@@ -13,3 +14,3 @@ var remover = aCallable(collection['delete']); | ||
for (var k = 0, len = arguments.length; k < len; k++) { | ||
wasDeleted = remover.call(collection, arguments[k]); | ||
wasDeleted = call(remover, collection, arguments[k]); | ||
allDeleted = allDeleted && wasDeleted; | ||
@@ -16,0 +17,0 @@ } |
'use strict'; | ||
// https://tc39.github.io/proposal-setmap-offrom/ | ||
var bind = require('../internals/function-bind-context'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
var aConstructor = require('../internals/a-constructor'); | ||
var bind = require('../internals/function-bind-context'); | ||
var iterate = require('../internals/iterate'); | ||
var push = [].push; | ||
module.exports = function from(source /* , mapFn, thisArg */) { | ||
@@ -19,10 +22,10 @@ var length = arguments.length; | ||
n = 0; | ||
boundFunction = bind(mapFn, length > 2 ? arguments[2] : undefined, 2); | ||
boundFunction = bind(mapFn, length > 2 ? arguments[2] : undefined); | ||
iterate(source, function (nextItem) { | ||
array.push(boundFunction(nextItem, n++)); | ||
call(push, array, boundFunction(nextItem, n++)); | ||
}); | ||
} else { | ||
iterate(source, array.push, { that: array }); | ||
iterate(source, push, { that: array }); | ||
} | ||
return new this(array); | ||
}; |
'use strict'; | ||
var arraySlice = require('../internals/array-slice'); | ||
// https://tc39.github.io/proposal-setmap-offrom/ | ||
module.exports = function of() { | ||
var length = arguments.length; | ||
var A = new Array(length); | ||
while (length--) A[length] = arguments[length]; | ||
return new this(A); | ||
return new this(arraySlice(arguments)); | ||
}; |
@@ -19,4 +19,4 @@ 'use strict'; | ||
getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { | ||
var C = wrapper(function (that, iterable) { | ||
anInstance(that, C, CONSTRUCTOR_NAME); | ||
var Constructor = wrapper(function (that, iterable) { | ||
anInstance(that, Prototype); | ||
setInternalState(that, { | ||
@@ -33,2 +33,4 @@ type: CONSTRUCTOR_NAME, | ||
var Prototype = Constructor.prototype; | ||
var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); | ||
@@ -74,3 +76,3 @@ | ||
redefineAll(C.prototype, { | ||
redefineAll(Prototype, { | ||
// `{ Map, Set }.prototype.clear()` methods | ||
@@ -119,3 +121,3 @@ // https://tc39.es/ecma262/#sec-map.prototype.clear | ||
var state = getInternalState(this); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); | ||
var entry; | ||
@@ -136,3 +138,3 @@ while (entry = entry ? entry.next : state.first) { | ||
redefineAll(C.prototype, IS_MAP ? { | ||
redefineAll(Prototype, IS_MAP ? { | ||
// `Map.prototype.get(key)` method | ||
@@ -156,3 +158,3 @@ // https://tc39.es/ecma262/#sec-map.prototype.get | ||
}); | ||
if (DESCRIPTORS) defineProperty(C.prototype, 'size', { | ||
if (DESCRIPTORS) defineProperty(Prototype, 'size', { | ||
get: function () { | ||
@@ -162,5 +164,5 @@ return getInternalState(this).size; | ||
}); | ||
return C; | ||
return Constructor; | ||
}, | ||
setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) { | ||
setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) { | ||
var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator'; | ||
@@ -178,3 +180,3 @@ var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME); | ||
// https://tc39.es/ecma262/#sec-set.prototype-@@iterator | ||
defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) { | ||
defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) { | ||
setInternalState(this, { | ||
@@ -181,0 +183,0 @@ type: ITERATOR_NAME, |
'use strict'; | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var redefineAll = require('../internals/redefine-all'); | ||
@@ -16,2 +17,3 @@ var getWeakData = require('../internals/internal-metadata').getWeakData; | ||
var findIndex = ArrayIterationModule.findIndex; | ||
var splice = uncurryThis([].splice); | ||
var id = 0; | ||
@@ -51,3 +53,3 @@ | ||
}); | ||
if (~index) this.entries.splice(index, 1); | ||
if (~index) splice(this.entries, index, 1); | ||
return !!~index; | ||
@@ -59,4 +61,4 @@ } | ||
getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { | ||
var C = wrapper(function (that, iterable) { | ||
anInstance(that, C, CONSTRUCTOR_NAME); | ||
var Constructor = wrapper(function (that, iterable) { | ||
anInstance(that, Prototype); | ||
setInternalState(that, { | ||
@@ -70,2 +72,4 @@ type: CONSTRUCTOR_NAME, | ||
var Prototype = Constructor.prototype; | ||
var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); | ||
@@ -81,3 +85,3 @@ | ||
redefineAll(C.prototype, { | ||
redefineAll(Prototype, { | ||
// `{ WeakMap, WeakSet }.prototype.delete(key)` methods | ||
@@ -105,3 +109,3 @@ // https://tc39.es/ecma262/#sec-weakmap.prototype.delete | ||
redefineAll(C.prototype, IS_MAP ? { | ||
redefineAll(Prototype, IS_MAP ? { | ||
// `WeakMap.prototype.get(key)` method | ||
@@ -130,4 +134,4 @@ // https://tc39.es/ecma262/#sec-weakmap.prototype.get | ||
return C; | ||
return Constructor; | ||
} | ||
}; |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var isForced = require('../internals/is-forced'); | ||
@@ -26,15 +27,15 @@ var redefine = require('../internals/redefine'); | ||
var fixMethod = function (KEY) { | ||
var nativeMethod = NativePrototype[KEY]; | ||
var uncurriedNativeMethod = uncurryThis(NativePrototype[KEY]); | ||
redefine(NativePrototype, KEY, | ||
KEY == 'add' ? function add(value) { | ||
nativeMethod.call(this, value === 0 ? 0 : value); | ||
uncurriedNativeMethod(this, value === 0 ? 0 : value); | ||
return this; | ||
} : KEY == 'delete' ? function (key) { | ||
return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key); | ||
return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key); | ||
} : KEY == 'get' ? function get(key) { | ||
return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key); | ||
return IS_WEAK && !isObject(key) ? undefined : uncurriedNativeMethod(this, key === 0 ? 0 : key); | ||
} : KEY == 'has' ? function has(key) { | ||
return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key); | ||
return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key); | ||
} : function set(key, value) { | ||
nativeMethod.call(this, key === 0 ? 0 : key, value); | ||
uncurriedNativeMethod(this, key === 0 ? 0 : key, value); | ||
return this; | ||
@@ -76,3 +77,3 @@ } | ||
Constructor = wrapper(function (dummy, iterable) { | ||
anInstance(dummy, Constructor, CONSTRUCTOR_NAME); | ||
anInstance(dummy, NativePrototype); | ||
var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor); | ||
@@ -79,0 +80,0 @@ if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); |
// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` | ||
var Map = require('../modules/es.map'); | ||
var WeakMap = require('../modules/es.weak-map'); | ||
require('../modules/es.map'); | ||
require('../modules/es.weak-map'); | ||
var global = require('../internals/global'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var create = require('../internals/object-create'); | ||
var isObject = require('../internals/is-object'); | ||
var Object = global.Object; | ||
var TypeError = global.TypeError; | ||
var Map = getBuiltIn('Map'); | ||
var WeakMap = getBuiltIn('WeakMap'); | ||
var Node = function () { | ||
@@ -8,0 +15,0 @@ // keys |
@@ -0,1 +1,2 @@ | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var requireObjectCoercible = require('../internals/require-object-coercible'); | ||
@@ -5,2 +6,3 @@ var toString = require('../internals/to-string'); | ||
var quot = /"/g; | ||
var replace = uncurryThis(''.replace); | ||
@@ -12,4 +14,4 @@ // `CreateHTML` abstract operation | ||
var p1 = '<' + tag; | ||
if (attribute !== '') p1 += ' ' + attribute + '="' + toString(value).replace(quot, '"') + '"'; | ||
if (attribute !== '') p1 += ' ' + attribute + '="' + replace(toString(value), quot, '"') + '"'; | ||
return p1 + '>' + S + '</' + tag + '>'; | ||
}; |
'use strict'; | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var fails = require('../internals/fails'); | ||
var padStart = require('../internals/string-pad').start; | ||
var RangeError = global.RangeError; | ||
var abs = Math.abs; | ||
var DatePrototype = Date.prototype; | ||
var getTime = DatePrototype.getTime; | ||
var nativeDateToISOString = DatePrototype.toISOString; | ||
var n$DateToISOString = DatePrototype.toISOString; | ||
var getTime = uncurryThis(DatePrototype.getTime); | ||
var getUTCDate = uncurryThis(DatePrototype.getUTCDate); | ||
var getUTCFullYear = uncurryThis(DatePrototype.getUTCFullYear); | ||
var getUTCHours = uncurryThis(DatePrototype.getUTCHours); | ||
var getUTCMilliseconds = uncurryThis(DatePrototype.getUTCMilliseconds); | ||
var getUTCMinutes = uncurryThis(DatePrototype.getUTCMinutes); | ||
var getUTCMonth = uncurryThis(DatePrototype.getUTCMonth); | ||
var getUTCSeconds = uncurryThis(DatePrototype.getUTCSeconds); | ||
@@ -14,19 +24,19 @@ // `Date.prototype.toISOString` method implementation | ||
module.exports = (fails(function () { | ||
return nativeDateToISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; | ||
return n$DateToISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; | ||
}) || !fails(function () { | ||
nativeDateToISOString.call(new Date(NaN)); | ||
n$DateToISOString.call(new Date(NaN)); | ||
})) ? function toISOString() { | ||
if (!isFinite(getTime.call(this))) throw RangeError('Invalid time value'); | ||
if (!isFinite(getTime(this))) throw RangeError('Invalid time value'); | ||
var date = this; | ||
var year = date.getUTCFullYear(); | ||
var milliseconds = date.getUTCMilliseconds(); | ||
var year = getUTCFullYear(date); | ||
var milliseconds = getUTCMilliseconds(date); | ||
var sign = year < 0 ? '-' : year > 9999 ? '+' : ''; | ||
return sign + padStart(abs(year), sign ? 6 : 4, 0) + | ||
'-' + padStart(date.getUTCMonth() + 1, 2, 0) + | ||
'-' + padStart(date.getUTCDate(), 2, 0) + | ||
'T' + padStart(date.getUTCHours(), 2, 0) + | ||
':' + padStart(date.getUTCMinutes(), 2, 0) + | ||
':' + padStart(date.getUTCSeconds(), 2, 0) + | ||
'-' + padStart(getUTCMonth(date) + 1, 2, 0) + | ||
'-' + padStart(getUTCDate(date), 2, 0) + | ||
'T' + padStart(getUTCHours(date), 2, 0) + | ||
':' + padStart(getUTCMinutes(date), 2, 0) + | ||
':' + padStart(getUTCSeconds(date), 2, 0) + | ||
'.' + padStart(milliseconds, 3, 0) + | ||
'Z'; | ||
} : nativeDateToISOString; | ||
} : n$DateToISOString; |
'use strict'; | ||
var global = require('../internals/global'); | ||
var anObject = require('../internals/an-object'); | ||
var ordinaryToPrimitive = require('../internals/ordinary-to-primitive'); | ||
var TypeError = global.TypeError; | ||
// `Date.prototype[@@toPrimitive](hint)` method implementation | ||
@@ -6,0 +9,0 @@ // https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var call = require('../internals/function-call'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
@@ -73,3 +74,3 @@ var FunctionName = require('../internals/function-name'); | ||
INCORRECT_VALUES_NAME = true; | ||
defaultIterator = function values() { return nativeIterator.call(this); }; | ||
defaultIterator = function values() { return call(nativeIterator, this); }; | ||
} | ||
@@ -76,0 +77,0 @@ } |
@@ -12,11 +12,17 @@ var global = require('../internals/global'); | ||
match = v8.split('.'); | ||
version = match[0] < 4 ? 1 : match[0] + match[1]; | ||
} else if (userAgent) { | ||
// in old Chrome, versions of V8 isn't V8 = Chrome / 10 | ||
// but their correct versions are not interesting for us | ||
version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); | ||
} | ||
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0` | ||
// so check `userAgent` even if `.v8` exists, but 0 | ||
if (!version && userAgent) { | ||
match = userAgent.match(/Edge\/(\d+)/); | ||
if (!match || match[1] >= 74) { | ||
match = userAgent.match(/Chrome\/(\d+)/); | ||
if (match) version = match[1]; | ||
if (match) version = +match[1]; | ||
} | ||
} | ||
module.exports = version && +version; | ||
module.exports = version; |
var global = require('../internals/global'); | ||
var bind = require('../internals/function-bind-context'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var call = Function.call; | ||
module.exports = function (CONSTRUCTOR, METHOD, length) { | ||
return bind(call, global[CONSTRUCTOR].prototype[METHOD], length); | ||
module.exports = function (CONSTRUCTOR, METHOD) { | ||
return uncurryThis(global[CONSTRUCTOR].prototype[METHOD]); | ||
}; |
@@ -45,3 +45,3 @@ var global = require('../internals/global'); | ||
if (!FORCED && targetProperty !== undefined) { | ||
if (typeof sourceProperty === typeof targetProperty) continue; | ||
if (typeof sourceProperty == typeof targetProperty) continue; | ||
copyConstructorProperties(sourceProperty, targetProperty); | ||
@@ -48,0 +48,0 @@ } |
'use strict'; | ||
// TODO: Remove from `core-js@4` since it's moved to entry points | ||
require('../modules/es.regexp.exec'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var redefine = require('../internals/redefine'); | ||
@@ -52,4 +53,5 @@ var regexpExec = require('../internals/regexp-exec'); | ||
) { | ||
var nativeRegExpMethod = /./[SYMBOL]; | ||
var uncurriedNativeRegExpMethod = uncurryThis(/./[SYMBOL]); | ||
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { | ||
var uncurriedNativeMethod = uncurryThis(nativeMethod); | ||
var $exec = regexp.exec; | ||
@@ -61,5 +63,5 @@ if ($exec === regexpExec || $exec === RegExpPrototype.exec) { | ||
// We avoid it by directly calling the native @@method method. | ||
return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) }; | ||
return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) }; | ||
} | ||
return { done: true, value: nativeMethod.call(str, regexp, arg2) }; | ||
return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) }; | ||
} | ||
@@ -66,0 +68,0 @@ return { done: false }; |
'use strict'; | ||
var global = require('../internals/global'); | ||
var isArray = require('../internals/is-array'); | ||
@@ -6,2 +7,4 @@ var lengthOfArrayLike = require('../internals/length-of-array-like'); | ||
var TypeError = global.TypeError; | ||
// `FlattenIntoArray` abstract operation | ||
@@ -12,3 +15,3 @@ // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray | ||
var sourceIndex = 0; | ||
var mapFn = mapper ? bind(mapper, thisArg, 3) : false; | ||
var mapFn = mapper ? bind(mapper, thisArg) : false; | ||
var element, elementLen; | ||
@@ -15,0 +18,0 @@ |
@@ -0,24 +1,12 @@ | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var aCallable = require('../internals/a-callable'); | ||
var bind = uncurryThis(uncurryThis.bind); | ||
// optional / simple context binding | ||
module.exports = function (fn, that, length) { | ||
module.exports = function (fn, that) { | ||
aCallable(fn); | ||
if (that === undefined) return fn; | ||
switch (length) { | ||
case 0: return function () { | ||
return fn.call(that); | ||
}; | ||
case 1: return function (a) { | ||
return fn.call(that, a); | ||
}; | ||
case 2: return function (a, b) { | ||
return fn.call(that, a, b); | ||
}; | ||
case 3: return function (a, b, c) { | ||
return fn.call(that, a, b, c); | ||
}; | ||
} | ||
return function (/* ...args */) { | ||
return that === undefined ? fn : bind ? bind(fn, that) : function (/* ...args */) { | ||
return fn.apply(that, arguments); | ||
}; | ||
}; |
'use strict'; | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var aCallable = require('../internals/a-callable'); | ||
var isObject = require('../internals/is-object'); | ||
var hasOwn = require('../internals/has-own-property'); | ||
var arraySlice = require('../internals/array-slice'); | ||
var slice = [].slice; | ||
var Function = global.Function; | ||
var concat = uncurryThis([].concat); | ||
var join = uncurryThis([].join); | ||
var factories = {}; | ||
var construct = function (C, argsLength, args) { | ||
if (!(argsLength in factories)) { | ||
if (!hasOwn(factories, argsLength)) { | ||
for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']'; | ||
// eslint-disable-next-line no-new-func -- we have no proper alternatives, IE8- only | ||
factories[argsLength] = Function('C,a', 'return new C(' + list.join(',') + ')'); | ||
factories[argsLength] = Function('C,a', 'return new C(' + join(list, ',') + ')'); | ||
} return factories[argsLength](C, args); | ||
@@ -19,10 +24,11 @@ }; | ||
module.exports = Function.bind || function bind(that /* , ...args */) { | ||
var fn = aCallable(this); | ||
var partArgs = slice.call(arguments, 1); | ||
var F = aCallable(this); | ||
var Prototype = F.prototype; | ||
var partArgs = arraySlice(arguments, 1); | ||
var boundFunction = function bound(/* args... */) { | ||
var args = partArgs.concat(slice.call(arguments)); | ||
return this instanceof boundFunction ? construct(fn, args.length, args) : fn.apply(that, args); | ||
var args = concat(partArgs, arraySlice(arguments)); | ||
return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args); | ||
}; | ||
if (isObject(fn.prototype)) boundFunction.prototype = fn.prototype; | ||
if (isObject(Prototype)) boundFunction.prototype = Prototype; | ||
return boundFunction; | ||
}; |
@@ -0,1 +1,2 @@ | ||
var call = require('../internals/function-call'); | ||
var AsyncFromSyncIterator = require('../internals/async-from-sync-iterator'); | ||
@@ -11,3 +12,3 @@ var anObject = require('../internals/an-object'); | ||
var method = arguments.length < 2 ? getMethod(it, ASYNC_ITERATOR) : usingIterator; | ||
return method ? anObject(method.call(it)) : new AsyncFromSyncIterator(getIterator(it)); | ||
return method ? anObject(call(method, it)) : new AsyncFromSyncIterator(getIterator(it)); | ||
}; |
@@ -0,9 +1,14 @@ | ||
var global = require('../internals/global'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
var anObject = require('../internals/an-object'); | ||
var tryToString = require('../internals/try-to-string'); | ||
var getIteratorMethod = require('../internals/get-iterator-method'); | ||
var TypeError = global.TypeError; | ||
module.exports = function (argument, usingIterator) { | ||
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator; | ||
if (aCallable(iteratorMethod)) return anObject(iteratorMethod.call(argument)); | ||
throw TypeError(String(argument) + ' is not iterable'); | ||
if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument)); | ||
throw TypeError(tryToString(argument) + ' is not iterable'); | ||
}; |
@@ -0,4 +1,6 @@ | ||
var call = require('../internals/function-call'); | ||
module.exports = function (it) { | ||
// eslint-disable-next-line es/no-map -- safe | ||
return Map.prototype.entries.call(it); | ||
return call(Map.prototype.entries, it); | ||
}; |
@@ -0,4 +1,6 @@ | ||
var call = require('../internals/function-call'); | ||
module.exports = function (it) { | ||
// eslint-disable-next-line es/no-set -- safe | ||
return Set.prototype.values.call(it); | ||
return call(Set.prototype.values, it); | ||
}; |
@@ -0,5 +1,8 @@ | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var toObject = require('../internals/to-object'); | ||
var floor = Math.floor; | ||
var replace = ''.replace; | ||
var charAt = uncurryThis(''.charAt); | ||
var replace = uncurryThis(''.replace); | ||
var stringSlice = uncurryThis(''.slice); | ||
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g; | ||
@@ -18,11 +21,11 @@ var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g; | ||
} | ||
return replace.call(replacement, symbols, function (match, ch) { | ||
return replace(replacement, symbols, function (match, ch) { | ||
var capture; | ||
switch (ch.charAt(0)) { | ||
switch (charAt(ch, 0)) { | ||
case '$': return '$'; | ||
case '&': return matched; | ||
case '`': return str.slice(0, position); | ||
case "'": return str.slice(tailPos); | ||
case '`': return stringSlice(str, 0, position); | ||
case "'": return stringSlice(str, tailPos); | ||
case '<': | ||
capture = namedCaptures[ch.slice(1, -1)]; | ||
capture = namedCaptures[stringSlice(ch, 1, -1)]; | ||
break; | ||
@@ -35,3 +38,3 @@ default: // \d\d? | ||
if (f === 0) return match; | ||
if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1); | ||
if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1); | ||
return match; | ||
@@ -38,0 +41,0 @@ } |
@@ -0,4 +1,5 @@ | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var toObject = require('../internals/to-object'); | ||
var hasOwnProperty = {}.hasOwnProperty; | ||
var hasOwnProperty = uncurryThis({}.hasOwnProperty); | ||
@@ -8,3 +9,3 @@ // `HasOwnProperty` abstract operation | ||
module.exports = Object.hasOwn || function hasOwn(it, key) { | ||
return hasOwnProperty.call(toObject(it), key); | ||
return hasOwnProperty(toObject(it), key); | ||
}; |
@@ -6,4 +6,4 @@ var global = require('../internals/global'); | ||
if (console && console.error) { | ||
arguments.length === 1 ? console.error(a) : console.error(a, b); | ||
arguments.length == 1 ? console.error(a) : console.error(a, b); | ||
} | ||
}; |
// IEEE754 conversions based on https://github.com/feross/ieee754 | ||
var global = require('../internals/global'); | ||
var Array = global.Array; | ||
var abs = Math.abs; | ||
@@ -9,3 +12,3 @@ var pow = Math.pow; | ||
var pack = function (number, mantissaLength, bytes) { | ||
var buffer = new Array(bytes); | ||
var buffer = Array(bytes); | ||
var exponentLength = bytes * 8 - mantissaLength - 1; | ||
@@ -12,0 +15,0 @@ var eMax = (1 << exponentLength) - 1; |
@@ -0,5 +1,8 @@ | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var fails = require('../internals/fails'); | ||
var classof = require('../internals/classof-raw'); | ||
var split = ''.split; | ||
var Object = global.Object; | ||
var split = uncurryThis(''.split); | ||
@@ -12,3 +15,3 @@ // fallback for non-array-like ES3 and non-enumerable old V8 strings | ||
}) ? function (it) { | ||
return classof(it) == 'String' ? split.call(it, '') : Object(it); | ||
return classof(it) == 'String' ? split(it, '') : Object(it); | ||
} : Object; |
@@ -0,5 +1,6 @@ | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var isCallable = require('../internals/is-callable'); | ||
var store = require('../internals/shared-store'); | ||
var functionToString = Function.toString; | ||
var functionToString = uncurryThis(Function.toString); | ||
@@ -9,3 +10,3 @@ // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper | ||
store.inspectSource = function (it) { | ||
return functionToString.call(it); | ||
return functionToString(it); | ||
}; | ||
@@ -12,0 +13,0 @@ } |
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var hiddenKeys = require('../internals/hidden-keys'); | ||
@@ -63,3 +64,3 @@ var isObject = require('../internals/is-object'); | ||
var getOwnPropertyNames = getOwnPropertyNamesModule.f; | ||
var splice = [].splice; | ||
var splice = uncurryThis([].splice); | ||
var test = {}; | ||
@@ -74,3 +75,3 @@ test[METADATA] = 1; | ||
if (result[i] === METADATA) { | ||
splice.call(result, i, 1); | ||
splice(result, i, 1); | ||
break; | ||
@@ -77,0 +78,0 @@ } |
var NATIVE_WEAK_MAP = require('../internals/native-weak-map'); | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var isObject = require('../internals/is-object'); | ||
@@ -11,2 +12,3 @@ var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); | ||
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; | ||
var TypeError = global.TypeError; | ||
var WeakMap = global.WeakMap; | ||
@@ -30,16 +32,16 @@ var set, get, has; | ||
var store = shared.state || (shared.state = new WeakMap()); | ||
var wmget = store.get; | ||
var wmhas = store.has; | ||
var wmset = store.set; | ||
var wmget = uncurryThis(store.get); | ||
var wmhas = uncurryThis(store.has); | ||
var wmset = uncurryThis(store.set); | ||
set = function (it, metadata) { | ||
if (wmhas.call(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); | ||
if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); | ||
metadata.facade = it; | ||
wmset.call(store, it, metadata); | ||
wmset(store, it, metadata); | ||
return metadata; | ||
}; | ||
get = function (it) { | ||
return wmget.call(store, it) || {}; | ||
return wmget(store, it) || {}; | ||
}; | ||
has = function (it) { | ||
return wmhas.call(store, it); | ||
return wmhas(store, it); | ||
}; | ||
@@ -46,0 +48,0 @@ } else { |
// `IsCallable` abstract operation | ||
// https://tc39.es/ecma262/#sec-iscallable | ||
module.exports = function (argument) { | ||
return typeof argument === 'function'; | ||
return typeof argument == 'function'; | ||
}; |
@@ -0,1 +1,2 @@ | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var fails = require('../internals/fails'); | ||
@@ -7,7 +8,8 @@ var isCallable = require('../internals/is-callable'); | ||
var noop = function () { /* empty */ }; | ||
var empty = []; | ||
var construct = getBuiltIn('Reflect', 'construct'); | ||
var constructorRegExp = /^\s*(?:class|function)\b/; | ||
var exec = constructorRegExp.exec; | ||
var INCORRECT_TO_STRING = !constructorRegExp.exec(function () { /* empty */ }); | ||
var exec = uncurryThis(constructorRegExp.exec); | ||
var INCORRECT_TO_STRING = !constructorRegExp.exec(noop); | ||
@@ -17,3 +19,3 @@ var isConstructorModern = function (argument) { | ||
try { | ||
construct(Object, empty, argument); | ||
construct(noop, empty, argument); | ||
return true; | ||
@@ -32,3 +34,3 @@ } catch (error) { | ||
// we can't check .prototype since constructors produced by .bind haven't it | ||
} return INCORRECT_TO_STRING || !!exec.call(constructorRegExp, inspectSource(argument)); | ||
} return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument)); | ||
}; | ||
@@ -35,0 +37,0 @@ |
@@ -0,2 +1,4 @@ | ||
var global = require('../internals/global'); | ||
var classof = require('../internals/classof'); | ||
var hasOwn = require('../internals/has-own-property'); | ||
var wellKnownSymbol = require('../internals/well-known-symbol'); | ||
@@ -6,2 +8,3 @@ var Iterators = require('../internals/iterators'); | ||
var ITERATOR = wellKnownSymbol('iterator'); | ||
var Object = global.Object; | ||
@@ -12,4 +15,3 @@ module.exports = function (it) { | ||
|| '@@iterator' in O | ||
// eslint-disable-next-line no-prototype-builtins -- safe | ||
|| Iterators.hasOwnProperty(classof(O)); | ||
|| hasOwn(Iterators, classof(O)); | ||
}; |
var isCallable = require('../internals/is-callable'); | ||
module.exports = function (it) { | ||
return typeof it === 'object' ? it !== null : isCallable(it); | ||
return typeof it == 'object' ? it !== null : isCallable(it); | ||
}; |
@@ -0,5 +1,9 @@ | ||
var global = require('../internals/global'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var isCallable = require('../internals/is-callable'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var isPrototypeOf = require('../internals/object-is-prototype-of'); | ||
var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid'); | ||
var Object = global.Object; | ||
module.exports = USE_SYMBOL_AS_UID ? function (it) { | ||
@@ -9,3 +13,3 @@ return typeof it == 'symbol'; | ||
var $Symbol = getBuiltIn('Symbol'); | ||
return isCallable($Symbol) && Object(it) instanceof $Symbol; | ||
return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, Object(it)); | ||
}; |
@@ -0,5 +1,9 @@ | ||
var global = require('../internals/global'); | ||
var bind = require('../internals/function-bind-context'); | ||
var call = require('../internals/function-call'); | ||
var anObject = require('../internals/an-object'); | ||
var tryToString = require('../internals/try-to-string'); | ||
var isArrayIteratorMethod = require('../internals/is-array-iterator-method'); | ||
var lengthOfArrayLike = require('../internals/length-of-array-like'); | ||
var bind = require('../internals/function-bind-context'); | ||
var isPrototypeOf = require('../internals/object-is-prototype-of'); | ||
var getIterator = require('../internals/get-iterator'); | ||
@@ -9,2 +13,4 @@ var getIteratorMethod = require('../internals/get-iterator-method'); | ||
var TypeError = global.TypeError; | ||
var Result = function (stopped, result) { | ||
@@ -15,2 +21,4 @@ this.stopped = stopped; | ||
var ResultPrototype = Result.prototype; | ||
module.exports = function (iterable, unboundFunction, options) { | ||
@@ -21,3 +29,3 @@ var that = options && options.that; | ||
var INTERRUPTED = !!(options && options.INTERRUPTED); | ||
var fn = bind(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED); | ||
var fn = bind(unboundFunction, that); | ||
var iterator, iterFn, index, length, result, next, step; | ||
@@ -41,3 +49,3 @@ | ||
iterFn = getIteratorMethod(iterable); | ||
if (!iterFn) throw TypeError(String(iterable) + ' is not iterable'); | ||
if (!iterFn) throw TypeError(tryToString(iterable) + ' is not iterable'); | ||
// optimisation for array iterators | ||
@@ -47,3 +55,3 @@ if (isArrayIteratorMethod(iterFn)) { | ||
result = callFn(iterable[index]); | ||
if (result && result instanceof Result) return result; | ||
if (result && isPrototypeOf(ResultPrototype, result)) return result; | ||
} return new Result(false); | ||
@@ -55,3 +63,3 @@ } | ||
next = iterator.next; | ||
while (!(step = next.call(iterator)).done) { | ||
while (!(step = call(next, iterator)).done) { | ||
try { | ||
@@ -62,4 +70,4 @@ result = callFn(step.value); | ||
} | ||
if (typeof result == 'object' && result && result instanceof Result) return result; | ||
if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result; | ||
} return new Result(false); | ||
}; |
@@ -0,1 +1,2 @@ | ||
var call = require('../internals/function-call'); | ||
var anObject = require('../internals/an-object'); | ||
@@ -13,3 +14,3 @@ var getMethod = require('../internals/get-method'); | ||
} | ||
innerResult = innerResult.call(iterator); | ||
innerResult = call(innerResult, iterator); | ||
} catch (error) { | ||
@@ -16,0 +17,0 @@ innerError = true; |
'use strict'; | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -30,3 +31,3 @@ var anObject = require('../internals/an-object'); | ||
state.ignoreArg = false; | ||
var result = state.done ? undefined : nextHandler.call(state, args); | ||
var result = state.done ? undefined : call(nextHandler, state, args); | ||
return { done: state.done, value: result }; | ||
@@ -39,3 +40,3 @@ }, | ||
var $$return = getMethod(iterator, 'return'); | ||
return { done: true, value: $$return ? anObject($$return.call(iterator, value)).value : value }; | ||
return { done: true, value: $$return ? anObject(call($$return, iterator, value)).value : value }; | ||
}, | ||
@@ -47,3 +48,3 @@ 'throw': function (value) { | ||
var $$throw = getMethod(iterator, 'throw'); | ||
if ($$throw) return $$throw.call(iterator, value); | ||
if ($$throw) return call($$throw, iterator, value); | ||
throw value; | ||
@@ -50,0 +51,0 @@ } |
'use strict'; | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
var anObject = require('../internals/an-object'); | ||
@@ -8,7 +10,10 @@ | ||
var map = anObject(this); | ||
var value = (map.has(key) && 'update' in handler) | ||
? handler.update(map.get(key), key, map) | ||
var get = aCallable(map.get); | ||
var has = aCallable(map.has); | ||
var set = aCallable(map.set); | ||
var value = (call(has, map, key) && 'update' in handler) | ||
? handler.update(call(get, map, key), key, map) | ||
: handler.insert(key, map); | ||
map.set(key, value); | ||
call(set, map, key, value); | ||
return value; | ||
}; |
'use strict'; | ||
var global = require('../internals/global'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
var isCallable = require('../internals/is-callable'); | ||
var anObject = require('../internals/an-object'); | ||
var TypeError = global.TypeError; | ||
// `Map.prototype.upsert` method | ||
@@ -9,2 +14,5 @@ // https://github.com/thumbsupep/proposal-upsert | ||
var map = anObject(this); | ||
var get = aCallable(map.get); | ||
var has = aCallable(map.has); | ||
var set = aCallable(map.set); | ||
var insertFn = arguments.length > 2 ? arguments[2] : undefined; | ||
@@ -15,12 +23,12 @@ var value; | ||
} | ||
if (map.has(key)) { | ||
value = map.get(key); | ||
if (call(has, map, key)) { | ||
value = call(get, map, key); | ||
if (isCallable(updateFn)) { | ||
value = updateFn(value); | ||
map.set(key, value); | ||
call(set, map, key, value); | ||
} | ||
} else if (isCallable(insertFn)) { | ||
value = insertFn(); | ||
map.set(key, value); | ||
call(set, map, key, value); | ||
} return value; | ||
}; |
// `Math.scale` method implementation | ||
// https://rwaldron.github.io/proposal-math-extensions/ | ||
module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) { | ||
if ( | ||
arguments.length === 0 | ||
/* eslint-disable no-self-compare -- NaN check */ | ||
|| x != x | ||
|| inLow != inLow | ||
|| inHigh != inHigh | ||
|| outLow != outLow | ||
|| outHigh != outHigh | ||
/* eslint-enable no-self-compare -- NaN check */ | ||
) return NaN; | ||
if (x === Infinity || x === -Infinity) return x; | ||
return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow; | ||
var nx = +x; | ||
var nInLow = +inLow; | ||
var nInHigh = +inHigh; | ||
var nOutLow = +outLow; | ||
var nOutHigh = +outHigh; | ||
// eslint-disable-next-line no-self-compare -- NaN check | ||
if (nx != nx || nInLow != nInLow || nInHigh != nInHigh || nOutLow != nOutLow || nOutHigh != nOutHigh) return NaN; | ||
if (nx === Infinity || nx === -Infinity) return nx; | ||
return (nx - nInLow) * (nOutHigh - nOutLow) / (nInHigh - nInLow) + nOutLow; | ||
}; |
var global = require('../internals/global'); | ||
var bind = require('../internals/function-bind-context'); | ||
var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; | ||
@@ -53,5 +54,5 @@ var macrotask = require('../internals/task').set; | ||
promise.constructor = Promise; | ||
then = promise.then; | ||
then = bind(promise.then, promise); | ||
notify = function () { | ||
then.call(promise, flush); | ||
then(flush); | ||
}; | ||
@@ -70,5 +71,6 @@ // Node.js without promises | ||
} else { | ||
// strange IE + webpack dev server bug - use .bind(global) | ||
macrotask = bind(macrotask, global); | ||
notify = function () { | ||
// strange IE + webpack dev server bug - use .call(global) | ||
macrotask.call(global, flush); | ||
macrotask(flush); | ||
}; | ||
@@ -75,0 +77,0 @@ } |
@@ -0,3 +1,6 @@ | ||
var global = require('../internals/global'); | ||
var isRegExp = require('../internals/is-regexp'); | ||
var TypeError = global.TypeError; | ||
module.exports = function (it) { | ||
@@ -4,0 +7,0 @@ if (isRegExp(it)) { |
var global = require('../internals/global'); | ||
var fails = require('../internals/fails'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var toString = require('../internals/to-string'); | ||
@@ -7,8 +8,9 @@ var trim = require('../internals/string-trim').trim; | ||
var $parseFloat = global.parseFloat; | ||
var charAt = uncurryThis(''.charAt); | ||
var n$ParseFloat = global.parseFloat; | ||
var Symbol = global.Symbol; | ||
var ITERATOR = Symbol && Symbol.iterator; | ||
var FORCED = 1 / $parseFloat(whitespaces + '-0') !== -Infinity | ||
var FORCED = 1 / n$ParseFloat(whitespaces + '-0') !== -Infinity | ||
// MS Edge 18- broken with boxed symbols | ||
|| (ITERATOR && !fails(function () { $parseFloat(Object(ITERATOR)); })); | ||
|| (ITERATOR && !fails(function () { n$ParseFloat(Object(ITERATOR)); })); | ||
@@ -19,4 +21,4 @@ // `parseFloat` method | ||
var trimmedString = trim(toString(string)); | ||
var result = $parseFloat(trimmedString); | ||
return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result; | ||
} : $parseFloat; | ||
var result = n$ParseFloat(trimmedString); | ||
return result === 0 && charAt(trimmedString, 0) == '-' ? -0 : result; | ||
} : n$ParseFloat; |
var global = require('../internals/global'); | ||
var fails = require('../internals/fails'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var toString = require('../internals/to-string'); | ||
@@ -11,2 +12,3 @@ var trim = require('../internals/string-trim').trim; | ||
var hex = /^[+-]?0x/i; | ||
var exec = uncurryThis(hex.exec); | ||
var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22 | ||
@@ -20,3 +22,3 @@ // MS Edge 18- broken with boxed symbols | ||
var S = trim(toString(string)); | ||
return $parseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10)); | ||
return $parseInt(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10)); | ||
} : $parseInt; |
'use strict'; | ||
var global = require('../internals/global'); | ||
var InternalStateModule = require('../internals/internal-state'); | ||
@@ -14,2 +15,5 @@ var createIteratorConstructor = require('../internals/create-iterator-constructor'); | ||
var RangeError = global.RangeError; | ||
var TypeError = global.TypeError; | ||
var $RangeIterator = createIteratorConstructor(function NumericRangeIterator(start, end, option, type, zero, one) { | ||
@@ -16,0 +20,0 @@ if (typeof start != type || (end !== Infinity && end !== -Infinity && typeof end != type)) { |
'use strict'; | ||
var DESCRIPTORS = require('../internals/descriptors'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var call = require('../internals/function-call'); | ||
var fails = require('../internals/fails'); | ||
@@ -14,2 +16,3 @@ var objectKeys = require('../internals/object-keys'); | ||
var defineProperty = Object.defineProperty; | ||
var concat = uncurryThis([].concat); | ||
@@ -46,3 +49,3 @@ // `Object.assign` method | ||
var S = IndexedObject(arguments[index++]); | ||
var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S); | ||
var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S); | ||
var length = keys.length; | ||
@@ -53,5 +56,5 @@ var j = 0; | ||
key = keys[j++]; | ||
if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key]; | ||
if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key]; | ||
} | ||
} return T; | ||
} : $assign; |
var DESCRIPTORS = require('../internals/descriptors'); | ||
var definePropertyModule = require('../internals/object-define-property'); | ||
var anObject = require('../internals/an-object'); | ||
var toIndexedObject = require('../internals/to-indexed-object'); | ||
var objectKeys = require('../internals/object-keys'); | ||
@@ -11,2 +12,3 @@ | ||
anObject(O); | ||
var props = toIndexedObject(Properties); | ||
var keys = objectKeys(Properties); | ||
@@ -16,4 +18,4 @@ var length = keys.length; | ||
var key; | ||
while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]); | ||
while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]); | ||
return O; | ||
}; |
@@ -0,1 +1,2 @@ | ||
var global = require('../internals/global'); | ||
var DESCRIPTORS = require('../internals/descriptors'); | ||
@@ -6,2 +7,3 @@ var IE8_DOM_DEFINE = require('../internals/ie8-dom-define'); | ||
var TypeError = global.TypeError; | ||
// eslint-disable-next-line es/no-object-defineproperty -- safe | ||
@@ -8,0 +10,0 @@ var $defineProperty = Object.defineProperty; |
var DESCRIPTORS = require('../internals/descriptors'); | ||
var call = require('../internals/function-call'); | ||
var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable'); | ||
@@ -20,3 +21,3 @@ var createPropertyDescriptor = require('../internals/create-property-descriptor'); | ||
} catch (error) { /* empty */ } | ||
if (hasOwn(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]); | ||
if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]); | ||
}; |
/* eslint-disable es/no-object-getownpropertynames -- safe */ | ||
var classof = require('../internals/classof-raw'); | ||
var toIndexedObject = require('../internals/to-indexed-object'); | ||
var $getOwnPropertyNames = require('../internals/object-get-own-property-names').f; | ||
var arraySlice = require('../internals/array-slice'); | ||
var toString = {}.toString; | ||
var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames | ||
@@ -14,3 +14,3 @@ ? Object.getOwnPropertyNames(window) : []; | ||
} catch (error) { | ||
return windowNames.slice(); | ||
return arraySlice(windowNames); | ||
} | ||
@@ -21,5 +21,5 @@ }; | ||
module.exports.f = function getOwnPropertyNames(it) { | ||
return windowNames && toString.call(it) == '[object Window]' | ||
return windowNames && classof(it) == 'Window' | ||
? getWindowNames(it) | ||
: $getOwnPropertyNames(toIndexedObject(it)); | ||
}; |
@@ -0,1 +1,2 @@ | ||
var global = require('../internals/global'); | ||
var hasOwn = require('../internals/has-own-property'); | ||
@@ -8,2 +9,3 @@ var isCallable = require('../internals/is-callable'); | ||
var IE_PROTO = sharedKey('IE_PROTO'); | ||
var Object = global.Object; | ||
var ObjectPrototype = Object.prototype; | ||
@@ -13,3 +15,2 @@ | ||
// https://tc39.es/ecma262/#sec-object.getprototypeof | ||
// eslint-disable-next-line es/no-object-getprototypeof -- safe | ||
module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) { | ||
@@ -16,0 +17,0 @@ var object = toObject(O); |
@@ -0,1 +1,2 @@ | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var hasOwn = require('../internals/has-own-property'); | ||
@@ -6,2 +7,4 @@ var toIndexedObject = require('../internals/to-indexed-object'); | ||
var push = uncurryThis([].push); | ||
module.exports = function (object, names) { | ||
@@ -12,8 +15,8 @@ var O = toIndexedObject(object); | ||
var key; | ||
for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && result.push(key); | ||
for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key); | ||
// Don't enum bug & hidden keys | ||
while (names.length > i) if (hasOwn(O, key = names[i++])) { | ||
~indexOf(result, key) || result.push(key); | ||
~indexOf(result, key) || push(result, key); | ||
} | ||
return result; | ||
}; |
/* eslint-disable no-proto -- safe */ | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var anObject = require('../internals/an-object'); | ||
@@ -15,4 +16,4 @@ var aPossiblePrototype = require('../internals/a-possible-prototype'); | ||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe | ||
setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set; | ||
setter.call(test, []); | ||
setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set); | ||
setter(test, []); | ||
CORRECT_SETTER = test instanceof Array; | ||
@@ -23,3 +24,3 @@ } catch (error) { /* empty */ } | ||
aPossiblePrototype(proto); | ||
if (CORRECT_SETTER) setter.call(O, proto); | ||
if (CORRECT_SETTER) setter(O, proto); | ||
else O.__proto__ = proto; | ||
@@ -26,0 +27,0 @@ return O; |
var DESCRIPTORS = require('../internals/descriptors'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var objectKeys = require('../internals/object-keys'); | ||
var toIndexedObject = require('../internals/to-indexed-object'); | ||
var propertyIsEnumerable = require('../internals/object-property-is-enumerable').f; | ||
var $propertyIsEnumerable = require('../internals/object-property-is-enumerable').f; | ||
var propertyIsEnumerable = uncurryThis($propertyIsEnumerable); | ||
var push = uncurryThis([].push); | ||
// `Object.{ entries, values }` methods implementation | ||
@@ -17,4 +21,4 @@ var createMethod = function (TO_ENTRIES) { | ||
key = keys[i++]; | ||
if (!DESCRIPTORS || propertyIsEnumerable.call(O, key)) { | ||
result.push(TO_ENTRIES ? [key, O[key]] : O[key]); | ||
if (!DESCRIPTORS || propertyIsEnumerable(O, key)) { | ||
push(result, TO_ENTRIES ? [key, O[key]] : O[key]); | ||
} | ||
@@ -21,0 +25,0 @@ } |
@@ -0,4 +1,8 @@ | ||
var global = require('../internals/global'); | ||
var call = require('../internals/function-call'); | ||
var isCallable = require('../internals/is-callable'); | ||
var isObject = require('../internals/is-object'); | ||
var TypeError = global.TypeError; | ||
// `OrdinaryToPrimitive` abstract operation | ||
@@ -8,6 +12,6 @@ // https://tc39.es/ecma262/#sec-ordinarytoprimitive | ||
var fn, val; | ||
if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = fn.call(input))) return val; | ||
if (isCallable(fn = input.valueOf) && !isObject(val = fn.call(input))) return val; | ||
if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = fn.call(input))) return val; | ||
if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; | ||
if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val; | ||
if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; | ||
throw TypeError("Can't convert object to primitive value"); | ||
}; |
var getBuiltIn = require('../internals/get-built-in'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names'); | ||
@@ -6,2 +7,4 @@ var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols'); | ||
var concat = uncurryThis([].concat); | ||
// all object keys, includes non-enumerable and symbols | ||
@@ -11,3 +14,3 @@ module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { | ||
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; | ||
return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; | ||
return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys; | ||
}; |
// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` | ||
var Map = require('../modules/es.map'); | ||
var WeakMap = require('../modules/es.weak-map'); | ||
require('../modules/es.map'); | ||
require('../modules/es.weak-map'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var shared = require('../internals/shared'); | ||
var Map = getBuiltIn('Map'); | ||
var WeakMap = getBuiltIn('WeakMap'); | ||
var push = uncurryThis([].push); | ||
var metadata = shared('metadata'); | ||
@@ -39,3 +45,3 @@ var store = metadata.store || (metadata.store = new WeakMap()); | ||
var keys = []; | ||
if (metadataMap) metadataMap.forEach(function (_, key) { keys.push(key); }); | ||
if (metadataMap) metadataMap.forEach(function (_, key) { push(keys, key); }); | ||
return keys; | ||
@@ -42,0 +48,0 @@ }; |
@@ -0,1 +1,3 @@ | ||
var global = require('../internals/global'); | ||
var call = require('../internals/function-call'); | ||
var anObject = require('../internals/an-object'); | ||
@@ -6,2 +8,4 @@ var isCallable = require('../internals/is-callable'); | ||
var TypeError = global.TypeError; | ||
// `RegExpExec` abstract operation | ||
@@ -12,8 +16,8 @@ // https://tc39.es/ecma262/#sec-regexpexec | ||
if (isCallable(exec)) { | ||
var result = exec.call(R, S); | ||
var result = call(exec, R, S); | ||
if (result !== null) anObject(result); | ||
return result; | ||
} | ||
if (classof(R) === 'RegExp') return regexpExec.call(R, S); | ||
if (classof(R) === 'RegExp') return call(regexpExec, R, S); | ||
throw TypeError('RegExp#exec called on incompatible receiver'); | ||
}; |
'use strict'; | ||
/* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */ | ||
/* eslint-disable regexp/no-useless-quantifier -- testing */ | ||
var call = require('../internals/function-call'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var toString = require('../internals/to-string'); | ||
@@ -13,6 +15,9 @@ var regexpFlags = require('../internals/regexp-flags'); | ||
var nativeReplace = shared('native-string-replace', String.prototype.replace); | ||
var nativeExec = RegExp.prototype.exec; | ||
var nativeReplace = shared('native-string-replace', String.prototype.replace); | ||
var patchedExec = nativeExec; | ||
var charAt = uncurryThis(''.charAt); | ||
var indexOf = uncurryThis(''.indexOf); | ||
var replace = uncurryThis(''.replace); | ||
var stringSlice = uncurryThis(''.slice); | ||
@@ -22,4 +27,4 @@ var UPDATES_LAST_INDEX_WRONG = (function () { | ||
var re2 = /b*/g; | ||
nativeExec.call(re1, 'a'); | ||
nativeExec.call(re2, 'a'); | ||
call(nativeExec, re1, 'a'); | ||
call(nativeExec, re2, 'a'); | ||
return re1.lastIndex !== 0 || re2.lastIndex !== 0; | ||
@@ -46,3 +51,3 @@ })(); | ||
raw.lastIndex = re.lastIndex; | ||
result = patchedExec.call(raw, str); | ||
result = call(patchedExec, raw, str); | ||
re.lastIndex = raw.lastIndex; | ||
@@ -54,3 +59,3 @@ return result; | ||
var sticky = UNSUPPORTED_Y && re.sticky; | ||
var flags = regexpFlags.call(re); | ||
var flags = call(regexpFlags, re); | ||
var source = re.source; | ||
@@ -61,10 +66,10 @@ var charsAdded = 0; | ||
if (sticky) { | ||
flags = flags.replace('y', ''); | ||
if (flags.indexOf('g') === -1) { | ||
flags = replace(flags, 'y', ''); | ||
if (indexOf(flags, 'g') === -1) { | ||
flags += 'g'; | ||
} | ||
strCopy = str.slice(re.lastIndex); | ||
strCopy = stringSlice(str, re.lastIndex); | ||
// Support anchored sticky behavior. | ||
if (re.lastIndex > 0 && (!re.multiline || re.multiline && str.charAt(re.lastIndex - 1) !== '\n')) { | ||
if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt(str, re.lastIndex - 1) !== '\n')) { | ||
source = '(?: ' + source + ')'; | ||
@@ -84,8 +89,8 @@ strCopy = ' ' + strCopy; | ||
match = nativeExec.call(sticky ? reCopy : re, strCopy); | ||
match = call(nativeExec, sticky ? reCopy : re, strCopy); | ||
if (sticky) { | ||
if (match) { | ||
match.input = match.input.slice(charsAdded); | ||
match[0] = match[0].slice(charsAdded); | ||
match.input = stringSlice(match.input, charsAdded); | ||
match[0] = stringSlice(match[0], charsAdded); | ||
match.index = re.lastIndex; | ||
@@ -100,3 +105,3 @@ re.lastIndex += match[0].length; | ||
// for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ | ||
nativeReplace.call(match[0], reCopy, function () { | ||
call(nativeReplace, match[0], reCopy, function () { | ||
for (i = 1; i < arguments.length - 2; i++) { | ||
@@ -103,0 +108,0 @@ if (arguments[i] === undefined) match[i] = undefined; |
@@ -0,1 +1,5 @@ | ||
var global = require('../internals/global'); | ||
var TypeError = global.TypeError; | ||
// `RequireObjectCoercible` abstract operation | ||
@@ -2,0 +6,0 @@ // https://tc39.es/ecma262/#sec-requireobjectcoercible |
var global = require('../internals/global'); | ||
// eslint-disable-next-line es/no-object-defineproperty -- safe | ||
var defineProperty = Object.defineProperty; | ||
module.exports = function (key, value) { | ||
try { | ||
// eslint-disable-next-line es/no-object-defineproperty -- safe | ||
Object.defineProperty(global, key, { value: value, configurable: true, writable: true }); | ||
defineProperty(global, key, { value: value, configurable: true, writable: true }); | ||
} catch (error) { | ||
@@ -8,0 +10,0 @@ global[key] = value; |
@@ -7,5 +7,5 @@ var IS_PURE = require('../internals/is-pure'); | ||
})('versions', []).push({ | ||
version: '3.18.3', | ||
version: '3.19.0', | ||
mode: IS_PURE ? 'pure' : 'global', | ||
copyright: '© 2021 Denis Pushkarev (zloirock.ru)' | ||
}); |
@@ -0,1 +1,2 @@ | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity'); | ||
@@ -5,2 +6,6 @@ var toString = require('../internals/to-string'); | ||
var charAt = uncurryThis(''.charAt); | ||
var charCodeAt = uncurryThis(''.charCodeAt); | ||
var stringSlice = uncurryThis(''.slice); | ||
var createMethod = function (CONVERT_TO_STRING) { | ||
@@ -13,7 +18,11 @@ return function ($this, pos) { | ||
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; | ||
first = S.charCodeAt(position); | ||
first = charCodeAt(S, position); | ||
return first < 0xD800 || first > 0xDBFF || position + 1 === size | ||
|| (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF | ||
? CONVERT_TO_STRING ? S.charAt(position) : first | ||
: CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; | ||
|| (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF | ||
? CONVERT_TO_STRING | ||
? charAt(S, position) | ||
: first | ||
: CONVERT_TO_STRING | ||
? stringSlice(S, position, position + 2) | ||
: (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; | ||
}; | ||
@@ -20,0 +29,0 @@ }; |
// https://github.com/tc39/proposal-string-pad-start-end | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var toLength = require('../internals/to-length'); | ||
var toString = require('../internals/to-string'); | ||
var repeat = require('../internals/string-repeat'); | ||
var $repeat = require('../internals/string-repeat'); | ||
var requireObjectCoercible = require('../internals/require-object-coercible'); | ||
var repeat = uncurryThis($repeat); | ||
var stringSlice = uncurryThis(''.slice); | ||
var ceil = Math.ceil; | ||
@@ -19,4 +22,4 @@ | ||
fillLen = intMaxLength - stringLength; | ||
stringFiller = repeat.call(fillStr, ceil(fillLen / fillStr.length)); | ||
if (stringFiller.length > fillLen) stringFiller = stringFiller.slice(0, fillLen); | ||
stringFiller = repeat(fillStr, ceil(fillLen / fillStr.length)); | ||
if (stringFiller.length > fillLen) stringFiller = stringSlice(stringFiller, 0, fillLen); | ||
return IS_END ? S + stringFiller : stringFiller + S; | ||
@@ -23,0 +26,0 @@ }; |
'use strict'; | ||
// based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 | ||
@@ -16,4 +19,13 @@ var base = 36; | ||
var baseMinusTMin = base - tMin; | ||
var RangeError = global.RangeError; | ||
var exec = uncurryThis(regexSeparators.exec); | ||
var floor = Math.floor; | ||
var stringFromCharCode = String.fromCharCode; | ||
var fromCharCode = String.fromCharCode; | ||
var charCodeAt = uncurryThis(''.charCodeAt); | ||
var join = uncurryThis([].join); | ||
var push = uncurryThis([].push); | ||
var replace = uncurryThis(''.replace); | ||
var split = uncurryThis(''.split); | ||
var toLowerCase = uncurryThis(''.toLowerCase); | ||
@@ -32,16 +44,16 @@ /** | ||
while (counter < length) { | ||
var value = string.charCodeAt(counter++); | ||
var value = charCodeAt(string, counter++); | ||
if (value >= 0xD800 && value <= 0xDBFF && counter < length) { | ||
// It's a high surrogate, and there is a next character. | ||
var extra = string.charCodeAt(counter++); | ||
var extra = charCodeAt(string, counter++); | ||
if ((extra & 0xFC00) == 0xDC00) { // Low surrogate. | ||
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); | ||
push(output, ((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); | ||
} else { | ||
// It's an unmatched surrogate; only append this code unit, in case the | ||
// next code unit is the high surrogate of a surrogate pair. | ||
output.push(value); | ||
push(output, value); | ||
counter--; | ||
} | ||
} else { | ||
output.push(value); | ||
push(output, value); | ||
} | ||
@@ -99,3 +111,3 @@ } | ||
if (currentValue < 0x80) { | ||
output.push(stringFromCharCode(currentValue)); | ||
push(output, fromCharCode(currentValue)); | ||
} | ||
@@ -109,3 +121,3 @@ } | ||
if (basicLength) { | ||
output.push(delimiter); | ||
push(output, delimiter); | ||
} | ||
@@ -146,7 +158,7 @@ | ||
var baseMinusT = base - t; | ||
output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT))); | ||
push(output, fromCharCode(digitToBasic(t + qMinusT % baseMinusT))); | ||
q = floor(qMinusT / baseMinusT); | ||
} | ||
output.push(stringFromCharCode(digitToBasic(q))); | ||
push(output, fromCharCode(digitToBasic(q))); | ||
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); | ||
@@ -161,3 +173,3 @@ delta = 0; | ||
} | ||
return output.join(''); | ||
return join(output, ''); | ||
}; | ||
@@ -167,9 +179,9 @@ | ||
var encoded = []; | ||
var labels = input.toLowerCase().replace(regexSeparators, '\u002E').split('.'); | ||
var labels = split(replace(toLowerCase(input), regexSeparators, '\u002E'), '.'); | ||
var i, label; | ||
for (i = 0; i < labels.length; i++) { | ||
label = labels[i]; | ||
encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label); | ||
push(encoded, exec(regexNonASCII, label) ? 'xn--' + encode(label) : label); | ||
} | ||
return encoded.join('.'); | ||
return join(encoded, '.'); | ||
}; |
'use strict'; | ||
var global = require('../internals/global'); | ||
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity'); | ||
@@ -6,2 +7,4 @@ var toString = require('../internals/to-string'); | ||
var RangeError = global.RangeError; | ||
// `String.prototype.repeat` method implementation | ||
@@ -8,0 +11,0 @@ // https://tc39.es/ecma262/#sec-string.prototype.repeat |
@@ -0,1 +1,2 @@ | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var requireObjectCoercible = require('../internals/require-object-coercible'); | ||
@@ -5,2 +6,3 @@ var toString = require('../internals/to-string'); | ||
var replace = uncurryThis(''.replace); | ||
var whitespace = '[' + whitespaces + ']'; | ||
@@ -14,4 +16,4 @@ var ltrim = RegExp('^' + whitespace + whitespace + '*'); | ||
var string = toString(requireObjectCoercible($this)); | ||
if (TYPE & 1) string = string.replace(ltrim, ''); | ||
if (TYPE & 2) string = string.replace(rtrim, ''); | ||
if (TYPE & 1) string = replace(string, ltrim, ''); | ||
if (TYPE & 2) string = replace(string, rtrim, ''); | ||
return string; | ||
@@ -18,0 +20,0 @@ }; |
var global = require('../internals/global'); | ||
var apply = require('../internals/function-apply'); | ||
var bind = require('../internals/function-bind-context'); | ||
var isCallable = require('../internals/is-callable'); | ||
var hasOwn = require('../internals/has-own-property'); | ||
var fails = require('../internals/fails'); | ||
var bind = require('../internals/function-bind-context'); | ||
var html = require('../internals/html'); | ||
var arraySlice = require('../internals/array-slice'); | ||
var createElement = require('../internals/document-create-element'); | ||
@@ -13,4 +16,6 @@ var IS_IOS = require('../internals/engine-is-ios'); | ||
var process = global.process; | ||
var Dispatch = global.Dispatch; | ||
var Function = global.Function; | ||
var MessageChannel = global.MessageChannel; | ||
var Dispatch = global.Dispatch; | ||
var String = global.String; | ||
var counter = 0; | ||
@@ -27,4 +32,3 @@ var queue = {}; | ||
var run = function (id) { | ||
// eslint-disable-next-line no-prototype-builtins -- safe | ||
if (queue.hasOwnProperty(id)) { | ||
if (hasOwn(queue, id)) { | ||
var fn = queue[id]; | ||
@@ -54,9 +58,5 @@ delete queue[id]; | ||
set = function setImmediate(fn) { | ||
var args = []; | ||
var argumentsLength = arguments.length; | ||
var i = 1; | ||
while (argumentsLength > i) args.push(arguments[i++]); | ||
var args = arraySlice(arguments, 1); | ||
queue[++counter] = function () { | ||
// eslint-disable-next-line no-new-func -- spec requirement | ||
(isCallable(fn) ? fn : Function(fn)).apply(undefined, args); | ||
apply(isCallable(fn) ? fn : Function(fn), undefined, args); | ||
}; | ||
@@ -85,3 +85,3 @@ defer(counter); | ||
channel.port1.onmessage = listener; | ||
defer = bind(port.postMessage, port, 1); | ||
defer = bind(port.postMessage, port); | ||
// Browsers with postMessage, skip WebWorkers | ||
@@ -88,0 +88,0 @@ // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' |
@@ -1,7 +0,5 @@ | ||
var valueOf = 1.0.valueOf; | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
// `thisNumberValue` abstract operation | ||
// https://tc39.es/ecma262/#sec-thisnumbervalue | ||
module.exports = function (value) { | ||
return valueOf.call(value); | ||
}; | ||
module.exports = uncurryThis(1.0.valueOf); |
@@ -0,4 +1,7 @@ | ||
var global = require('../internals/global'); | ||
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity'); | ||
var toLength = require('../internals/to-length'); | ||
var RangeError = global.RangeError; | ||
// `ToIndex` abstract operation | ||
@@ -5,0 +8,0 @@ // https://tc39.es/ecma262/#sec-toindex |
@@ -0,3 +1,6 @@ | ||
var global = require('../internals/global'); | ||
var requireObjectCoercible = require('../internals/require-object-coercible'); | ||
var Object = global.Object; | ||
// `ToObject` abstract operation | ||
@@ -4,0 +7,0 @@ // https://tc39.es/ecma262/#sec-toobject |
@@ -0,3 +1,6 @@ | ||
var global = require('../internals/global'); | ||
var toPositiveInteger = require('../internals/to-positive-integer'); | ||
var RangeError = global.RangeError; | ||
module.exports = function (it, BYTES) { | ||
@@ -4,0 +7,0 @@ var offset = toPositiveInteger(it); |
@@ -0,3 +1,6 @@ | ||
var global = require('../internals/global'); | ||
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity'); | ||
var RangeError = global.RangeError; | ||
module.exports = function (it) { | ||
@@ -4,0 +7,0 @@ var result = toIntegerOrInfinity(it); |
@@ -0,1 +1,3 @@ | ||
var global = require('../internals/global'); | ||
var call = require('../internals/function-call'); | ||
var isObject = require('../internals/is-object'); | ||
@@ -7,2 +9,3 @@ var isSymbol = require('../internals/is-symbol'); | ||
var TypeError = global.TypeError; | ||
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); | ||
@@ -18,3 +21,3 @@ | ||
if (pref === undefined) pref = 'default'; | ||
result = exoticToPrim.call(input, pref); | ||
result = call(exoticToPrim, input, pref); | ||
if (!isObject(result) || isSymbol(result)) return result; | ||
@@ -21,0 +24,0 @@ throw TypeError("Can't convert object to primitive value"); |
@@ -8,3 +8,3 @@ var toPrimitive = require('../internals/to-primitive'); | ||
var key = toPrimitive(argument, 'string'); | ||
return isSymbol(key) ? key : String(key); | ||
return isSymbol(key) ? key : key + ''; | ||
}; |
@@ -0,3 +1,6 @@ | ||
var global = require('../internals/global'); | ||
var classof = require('../internals/classof'); | ||
var String = global.String; | ||
module.exports = function (argument) { | ||
@@ -4,0 +7,0 @@ if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string'); |
@@ -0,1 +1,5 @@ | ||
var global = require('../internals/global'); | ||
var String = global.String; | ||
module.exports = function (argument) { | ||
@@ -2,0 +6,0 @@ try { |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var call = require('../internals/function-call'); | ||
var DESCRIPTORS = require('../internals/descriptors'); | ||
@@ -21,2 +22,3 @@ var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-array-constructors-require-wrappers'); | ||
var create = require('../internals/object-create'); | ||
var isPrototypeOf = require('../internals/object-is-prototype-of'); | ||
var setPrototypeOf = require('../internals/object-set-prototype-of'); | ||
@@ -39,2 +41,3 @@ var getOwnPropertyNames = require('../internals/object-get-own-property-names').f; | ||
var ArrayBuffer = ArrayBufferModule.ArrayBuffer; | ||
var ArrayBufferPrototype = ArrayBuffer.prototype; | ||
var DataView = ArrayBufferModule.DataView; | ||
@@ -52,5 +55,6 @@ var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; | ||
var fromList = function (C, list) { | ||
aTypedArrayConstructor(C); | ||
var index = 0; | ||
var length = list.length; | ||
var result = new (aTypedArrayConstructor(C))(length); | ||
var result = new C(length); | ||
while (length > index) result[index] = list[index++]; | ||
@@ -68,3 +72,3 @@ return result; | ||
var klass; | ||
return it instanceof ArrayBuffer || (klass = classof(it)) == 'ArrayBuffer' || klass == 'SharedArrayBuffer'; | ||
return isPrototypeOf(ArrayBufferPrototype, it) || (klass = classof(it)) == 'ArrayBuffer' || klass == 'SharedArrayBuffer'; | ||
}; | ||
@@ -154,3 +158,3 @@ | ||
TypedArrayConstructor = wrapper(function (that, data, offset, $length) { | ||
anInstance(that, TypedArrayConstructor, CONSTRUCTOR_NAME); | ||
anInstance(that, TypedArrayConstructorPrototype); | ||
var index = 0; | ||
@@ -179,3 +183,3 @@ var byteOffset = 0; | ||
} else { | ||
return typedArrayFrom.call(TypedArrayConstructor, data); | ||
return call(typedArrayFrom, TypedArrayConstructor, data); | ||
} | ||
@@ -196,3 +200,3 @@ setInternalState(that, { | ||
TypedArrayConstructor = wrapper(function (dummy, data, typedArrayOffset, $length) { | ||
anInstance(dummy, TypedArrayConstructor, CONSTRUCTOR_NAME); | ||
anInstance(dummy, TypedArrayConstructorPrototype); | ||
return inheritIfRequired(function () { | ||
@@ -206,3 +210,3 @@ if (!isObject(data)) return new NativeTypedArrayConstructor(toIndex(data)); | ||
if (isTypedArray(data)) return fromList(TypedArrayConstructor, data); | ||
return typedArrayFrom.call(TypedArrayConstructor, data); | ||
return call(typedArrayFrom, TypedArrayConstructor, data); | ||
}(), dummy, TypedArrayConstructor); | ||
@@ -209,0 +213,0 @@ }); |
@@ -0,1 +1,3 @@ | ||
var bind = require('../internals/function-bind-context'); | ||
var call = require('../internals/function-call'); | ||
var aConstructor = require('../internals/a-constructor'); | ||
@@ -7,3 +9,2 @@ var toObject = require('../internals/to-object'); | ||
var isArrayIteratorMethod = require('../internals/is-array-iterator-method'); | ||
var bind = require('../internals/function-bind-context'); | ||
var aTypedArrayConstructor = require('../internals/array-buffer-view-core').aTypedArrayConstructor; | ||
@@ -23,3 +24,3 @@ | ||
O = []; | ||
while (!(step = next.call(iterator)).done) { | ||
while (!(step = call(next, iterator)).done) { | ||
O.push(step.value); | ||
@@ -29,3 +30,3 @@ } | ||
if (mapping && argumentsLength > 2) { | ||
mapfn = bind(mapfn, arguments[2], 2); | ||
mapfn = bind(mapfn, arguments[2]); | ||
} | ||
@@ -32,0 +33,0 @@ length = lengthOfArrayLike(O); |
@@ -0,6 +1,9 @@ | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var id = 0; | ||
var postfix = Math.random(); | ||
var toString = uncurryThis(1.0.toString); | ||
module.exports = function (key) { | ||
return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); | ||
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36); | ||
}; |
@@ -10,2 +10,3 @@ var global = require('../internals/global'); | ||
var Symbol = global.Symbol; | ||
var symbolFor = Symbol && Symbol['for']; | ||
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid; | ||
@@ -15,8 +16,11 @@ | ||
if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) { | ||
var description = 'Symbol.' + name; | ||
if (NATIVE_SYMBOL && hasOwn(Symbol, name)) { | ||
WellKnownSymbolsStore[name] = Symbol[name]; | ||
} else if (USE_SYMBOL_AS_UID && symbolFor) { | ||
WellKnownSymbolsStore[name] = symbolFor(description); | ||
} else { | ||
WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); | ||
WellKnownSymbolsStore[name] = createWellKnownSymbol(description); | ||
} | ||
} return WellKnownSymbolsStore[name]; | ||
}; |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var isPrototypeOf = require('../internals/object-is-prototype-of'); | ||
var getPrototypeOf = require('../internals/object-get-prototype-of'); | ||
@@ -9,18 +11,22 @@ var setPrototypeOf = require('../internals/object-set-prototype-of'); | ||
var createPropertyDescriptor = require('../internals/create-property-descriptor'); | ||
var clearErrorStack = require('../internals/clear-error-stack'); | ||
var installErrorCause = require('../internals/install-error-cause'); | ||
var iterate = require('../internals/iterate'); | ||
var toString = require('../internals/to-string'); | ||
var normalizeStringArgument = require('../internals/normalize-string-argument'); | ||
var ERROR_STACK_INSTALLABLE = require('../internals/error-stack-installable'); | ||
var Error = global.Error; | ||
var push = [].push; | ||
var $AggregateError = function AggregateError(errors, message /* , options */) { | ||
var that = this; | ||
var that = isPrototypeOf(AggregateErrorPrototype, this) ? this : create(AggregateErrorPrototype); | ||
var options = arguments.length > 2 ? arguments[2] : undefined; | ||
if (!(that instanceof $AggregateError)) return new $AggregateError(errors, message, options); | ||
if (setPrototypeOf) { | ||
// eslint-disable-next-line unicorn/error-message -- expected | ||
that = setPrototypeOf(new Error(undefined), getPrototypeOf(that)); | ||
} | ||
if (message !== undefined) createNonEnumerableProperty(that, 'message', toString(message)); | ||
createNonEnumerableProperty(that, 'message', normalizeStringArgument(message, '')); | ||
if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1)); | ||
installErrorCause(that, options); | ||
var errorsArray = []; | ||
iterate(errors, errorsArray.push, { that: errorsArray }); | ||
iterate(errors, push, { that: errorsArray }); | ||
createNonEnumerableProperty(that, 'errors', errorsArray); | ||
@@ -33,3 +39,3 @@ return that; | ||
$AggregateError.prototype = create(Error.prototype, { | ||
var AggregateErrorPrototype = $AggregateError.prototype = create(Error.prototype, { | ||
constructor: createPropertyDescriptor(1, $AggregateError), | ||
@@ -36,0 +42,0 @@ message: createPropertyDescriptor(1, ''), |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var fails = require('../internals/fails'); | ||
@@ -12,3 +13,6 @@ var ArrayBufferModule = require('../internals/array-buffer'); | ||
var DataView = ArrayBufferModule.DataView; | ||
var nativeArrayBufferSlice = ArrayBuffer.prototype.slice; | ||
var DataViewPrototype = DataView.prototype; | ||
var un$ArrayBufferSlice = uncurryThis(ArrayBuffer.prototype.slice); | ||
var getUint8 = uncurryThis(DataViewPrototype.getUint8); | ||
var setUint8 = uncurryThis(DataViewPrototype.setUint8); | ||
@@ -23,4 +27,4 @@ var INCORRECT_SLICE = fails(function () { | ||
slice: function slice(start, end) { | ||
if (nativeArrayBufferSlice !== undefined && end === undefined) { | ||
return nativeArrayBufferSlice.call(anObject(this), start); // FF fix | ||
if (un$ArrayBufferSlice && end === undefined) { | ||
return un$ArrayBufferSlice(anObject(this), start); // FF fix | ||
} | ||
@@ -35,5 +39,5 @@ var length = anObject(this).byteLength; | ||
while (first < fin) { | ||
viewTarget.setUint8(index++, viewSource.getUint8(first++)); | ||
setUint8(viewTarget, index++, getUint8(viewSource, first++)); | ||
} return result; | ||
} | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var fails = require('../internals/fails'); | ||
@@ -17,2 +18,3 @@ var isArray = require('../internals/is-array'); | ||
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; | ||
var TypeError = global.TypeError; | ||
@@ -19,0 +21,0 @@ // We can't use this feature detection in V8 since it causes |
'use strict'; | ||
/* eslint-disable es/no-array-prototype-indexof -- required for testing */ | ||
var $ = require('../internals/export'); | ||
var $indexOf = require('../internals/array-includes').indexOf; | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var $IndexOf = require('../internals/array-includes').indexOf; | ||
var arrayMethodIsStrict = require('../internals/array-method-is-strict'); | ||
var nativeIndexOf = [].indexOf; | ||
var un$IndexOf = uncurryThis([].indexOf); | ||
var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0; | ||
var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0; | ||
var STRICT_METHOD = arrayMethodIsStrict('indexOf'); | ||
@@ -16,7 +17,8 @@ | ||
indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { | ||
var fromIndex = arguments.length > 1 ? arguments[1] : undefined; | ||
return NEGATIVE_ZERO | ||
// convert -0 to +0 | ||
? nativeIndexOf.apply(this, arguments) || 0 | ||
: $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined); | ||
? un$IndexOf(this, searchElement, fromIndex) || 0 | ||
: $IndexOf(this, searchElement, fromIndex); | ||
} | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var IndexedObject = require('../internals/indexed-object'); | ||
@@ -7,3 +8,3 @@ var toIndexedObject = require('../internals/to-indexed-object'); | ||
var nativeJoin = [].join; | ||
var un$Join = uncurryThis([].join); | ||
@@ -17,4 +18,4 @@ var ES3_STRINGS = IndexedObject != Object; | ||
join: function join(separator) { | ||
return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator); | ||
return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator); | ||
} | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var fails = require('../internals/fails'); | ||
@@ -7,5 +8,6 @@ var isConstructor = require('../internals/is-constructor'); | ||
var Array = global.Array; | ||
var ISNT_GENERIC = fails(function () { | ||
function F() { /* empty */ } | ||
// eslint-disable-next-line es/no-array-of -- required for testing | ||
return !(Array.of.call(F) instanceof F); | ||
@@ -12,0 +14,0 @@ }); |
@@ -17,4 +17,5 @@ 'use strict'; | ||
reduce: function reduce(callbackfn /* , initialValue */) { | ||
return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); | ||
var length = arguments.length; | ||
return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined); | ||
} | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var isArray = require('../internals/is-array'); | ||
var nativeReverse = [].reverse; | ||
var un$Reverse = uncurryThis([].reverse); | ||
var test = [1, 2]; | ||
@@ -16,4 +17,4 @@ | ||
if (isArray(this)) this.length = this.length; | ||
return nativeReverse.call(this); | ||
return un$Reverse(this); | ||
} | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var isArray = require('../internals/is-array'); | ||
@@ -12,2 +13,3 @@ var isConstructor = require('../internals/is-constructor'); | ||
var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); | ||
var un$Slice = require('../internals/array-slice'); | ||
@@ -17,3 +19,3 @@ var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice'); | ||
var SPECIES = wellKnownSymbol('species'); | ||
var nativeSlice = [].slice; | ||
var Array = global.Array; | ||
var max = Math.max; | ||
@@ -42,3 +44,3 @@ | ||
if (Constructor === Array || Constructor === undefined) { | ||
return nativeSlice.call(O, k, fin); | ||
return un$Slice(O, k, fin); | ||
} | ||
@@ -45,0 +47,0 @@ } |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -16,3 +17,4 @@ var toObject = require('../internals/to-object'); | ||
var test = []; | ||
var nativeSort = test.sort; | ||
var un$Sort = uncurryThis(test.sort); | ||
var push = uncurryThis(test.push); | ||
@@ -84,3 +86,3 @@ // IE8- | ||
if (STABLE_SORT) return comparefn === undefined ? nativeSort.call(array) : nativeSort.call(array, comparefn); | ||
if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn); | ||
@@ -92,6 +94,7 @@ var items = []; | ||
for (index = 0; index < arrayLength; index++) { | ||
if (index in array) items.push(array[index]); | ||
if (index in array) push(items, array[index]); | ||
} | ||
items = internalSort(items, getSortCompare(comparefn)); | ||
internalSort(items, getSortCompare(comparefn)); | ||
itemsLength = items.length; | ||
@@ -98,0 +101,0 @@ index = 0; |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var toAbsoluteIndex = require('../internals/to-absolute-index'); | ||
@@ -13,2 +14,3 @@ var toIntegerOrInfinity = require('../internals/to-integer-or-infinity'); | ||
var TypeError = global.TypeError; | ||
var max = Math.max; | ||
@@ -15,0 +17,0 @@ var min = Math.min; |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var fails = require('../internals/fails'); | ||
@@ -9,3 +10,3 @@ | ||
var getFullYear = Date.prototype.getFullYear; | ||
var getFullYear = uncurryThis(Date.prototype.getFullYear); | ||
@@ -16,4 +17,4 @@ // `Date.prototype.getYear` method | ||
getYear: function getYear() { | ||
return getFullYear.call(this) - 1900; | ||
return getFullYear(this) - 1900; | ||
} | ||
}); |
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var Date = global.Date; | ||
var getTime = uncurryThis(Date.prototype.getTime); | ||
// `Date.now` method | ||
@@ -7,4 +12,4 @@ // https://tc39.es/ecma262/#sec-date.now | ||
now: function now() { | ||
return new Date().getTime(); | ||
return getTime(new Date()); | ||
} | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity'); | ||
var getTime = Date.prototype.getTime; | ||
var setFullYear = Date.prototype.setFullYear; | ||
var DatePrototype = Date.prototype; | ||
var getTime = uncurryThis(DatePrototype.getTime); | ||
var setFullYear = uncurryThis(DatePrototype.setFullYear); | ||
@@ -13,7 +15,7 @@ // `Date.prototype.setYear` method | ||
// validate | ||
getTime.call(this); | ||
getTime(this); | ||
var yi = toIntegerOrInfinity(year); | ||
var yyyy = 0 <= yi && yi <= 99 ? yi + 1900 : yi; | ||
return setFullYear.call(this, yyyy); | ||
return setFullYear(this, yyyy); | ||
} | ||
}); |
@@ -0,1 +1,2 @@ | ||
var hasOwn = require('../internals/has-own-property'); | ||
var redefine = require('../internals/redefine'); | ||
@@ -10,4 +11,4 @@ var dateToPrimitive = require('../internals/date-to-primitive'); | ||
// https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive | ||
if (!(TO_PRIMITIVE in DatePrototype)) { | ||
if (!hasOwn(DatePrototype, TO_PRIMITIVE)) { | ||
redefine(DatePrototype, TO_PRIMITIVE, dateToPrimitive); | ||
} |
@@ -0,1 +1,2 @@ | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var redefine = require('../internals/redefine'); | ||
@@ -6,4 +7,4 @@ | ||
var TO_STRING = 'toString'; | ||
var nativeDateToString = DatePrototype[TO_STRING]; | ||
var getTime = DatePrototype.getTime; | ||
var un$DateToString = uncurryThis(DatePrototype[TO_STRING]); | ||
var getTime = uncurryThis(DatePrototype.getTime); | ||
@@ -14,6 +15,6 @@ // `Date.prototype.toString` method | ||
redefine(DatePrototype, TO_STRING, function toString() { | ||
var value = getTime.call(this); | ||
var value = getTime(this); | ||
// eslint-disable-next-line no-self-compare -- NaN check | ||
return value === value ? nativeDateToString.call(this) : INVALID_DATE; | ||
return value === value ? un$DateToString(this) : INVALID_DATE; | ||
}); | ||
} |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var toString = require('../internals/to-string'); | ||
var charAt = uncurryThis(''.charAt); | ||
var charCodeAt = uncurryThis(''.charCodeAt); | ||
var exec = uncurryThis(/./.exec); | ||
var numberToString = uncurryThis(1.0.toString); | ||
var toUpperCase = uncurryThis(''.toUpperCase); | ||
var raw = /[\w*+\-./@]/; | ||
var hex = function (code, length) { | ||
var result = code.toString(16); | ||
var result = numberToString(code, 16); | ||
while (result.length < length) result = '0' + result; | ||
@@ -23,11 +30,11 @@ return result; | ||
while (index < length) { | ||
chr = str.charAt(index++); | ||
if (raw.test(chr)) { | ||
chr = charAt(str, index++); | ||
if (exec(raw, chr)) { | ||
result += chr; | ||
} else { | ||
code = chr.charCodeAt(0); | ||
code = charCodeAt(chr, 0); | ||
if (code < 256) { | ||
result += '%' + hex(code, 2); | ||
} else { | ||
result += '%u' + hex(code, 4).toUpperCase(); | ||
result += '%u' + toUpperCase(hex(code, 4)); | ||
} | ||
@@ -34,0 +41,0 @@ } |
@@ -16,7 +16,8 @@ 'use strict'; | ||
if (!isCallable(this) || !isObject(O)) return false; | ||
if (!isObject(this.prototype)) return O instanceof this; | ||
var P = this.prototype; | ||
if (!isObject(P)) return O instanceof this; | ||
// for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: | ||
while (O = getPrototypeOf(O)) if (this.prototype === O) return true; | ||
while (O = getPrototypeOf(O)) if (P === O) return true; | ||
return false; | ||
} }); | ||
} |
var DESCRIPTORS = require('../internals/descriptors'); | ||
var FUNCTION_NAME_EXISTS = require('../internals/function-name').EXISTS; | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var defineProperty = require('../internals/object-define-property').f; | ||
var FunctionPrototype = Function.prototype; | ||
var FunctionPrototypeToString = FunctionPrototype.toString; | ||
var functionToString = uncurryThis(FunctionPrototype.toString); | ||
var nameRE = /^\s*function ([^ (]*)/; | ||
var regExpExec = uncurryThis(nameRE.exec); | ||
var NAME = 'name'; | ||
@@ -17,3 +19,3 @@ | ||
try { | ||
return FunctionPrototypeToString.call(this).match(nameRE)[1]; | ||
return regExpExec(nameRE, functionToString(this))[1]; | ||
} catch (error) { | ||
@@ -20,0 +22,0 @@ return ''; |
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var apply = require('../internals/function-apply'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var fails = require('../internals/fails'); | ||
var Array = global.Array; | ||
var $stringify = getBuiltIn('JSON', 'stringify'); | ||
var re = /[\uD800-\uDFFF]/g; | ||
var exec = uncurryThis(/./.exec); | ||
var charAt = uncurryThis(''.charAt); | ||
var charCodeAt = uncurryThis(''.charCodeAt); | ||
var replace = uncurryThis(''.replace); | ||
var numberToString = uncurryThis(1.0.toString); | ||
var tester = /[\uD800-\uDFFF]/g; | ||
var low = /^[\uD800-\uDBFF]$/; | ||
@@ -11,6 +21,6 @@ var hi = /^[\uDC00-\uDFFF]$/; | ||
var fix = function (match, offset, string) { | ||
var prev = string.charAt(offset - 1); | ||
var next = string.charAt(offset + 1); | ||
if ((low.test(match) && !hi.test(next)) || (hi.test(match) && !low.test(prev))) { | ||
return '\\u' + match.charCodeAt(0).toString(16); | ||
var prev = charAt(string, offset - 1); | ||
var next = charAt(string, offset + 1); | ||
if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) { | ||
return '\\u' + numberToString(charCodeAt(match, 0), 16); | ||
} return match; | ||
@@ -31,6 +41,7 @@ }; | ||
stringify: function stringify(it, replacer, space) { | ||
var result = $stringify.apply(null, arguments); | ||
return typeof result == 'string' ? result.replace(re, fix) : result; | ||
for (var i = 0, l = arguments.length, args = Array(l); i < l; i++) args[i] = arguments[i]; | ||
var result = apply($stringify, null, args); | ||
return typeof result == 'string' ? replace(result, tester, fix) : result; | ||
} | ||
}); | ||
} |
@@ -7,4 +7,4 @@ 'use strict'; | ||
// https://tc39.es/ecma262/#sec-map-objects | ||
module.exports = collection('Map', function (init) { | ||
collection('Map', function (init) { | ||
return function Map() { return init(this, arguments.length ? arguments[0] : undefined); }; | ||
}, collectionStrong); |
'use strict'; | ||
var DESCRIPTORS = require('../internals/descriptors'); | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var isForced = require('../internals/is-forced'); | ||
@@ -8,2 +9,3 @@ var redefine = require('../internals/redefine'); | ||
var inheritIfRequired = require('../internals/inherit-if-required'); | ||
var isPrototypeOf = require('../internals/object-is-prototype-of'); | ||
var isSymbol = require('../internals/is-symbol'); | ||
@@ -21,2 +23,5 @@ var toPrimitive = require('../internals/to-primitive'); | ||
var NumberPrototype = NativeNumber.prototype; | ||
var TypeError = global.TypeError; | ||
var arraySlice = uncurryThis(''.slice); | ||
var charCodeAt = uncurryThis(''.charCodeAt); | ||
@@ -27,3 +32,3 @@ // `ToNumeric` abstract operation | ||
var primValue = toPrimitive(value, 'number'); | ||
return typeof primValue === 'bigint' ? primValue : toNumber(primValue); | ||
return typeof primValue == 'bigint' ? primValue : toNumber(primValue); | ||
}; | ||
@@ -39,8 +44,8 @@ | ||
it = trim(it); | ||
first = it.charCodeAt(0); | ||
first = charCodeAt(it, 0); | ||
if (first === 43 || first === 45) { | ||
third = it.charCodeAt(2); | ||
third = charCodeAt(it, 2); | ||
if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix | ||
} else if (first === 48) { | ||
switch (it.charCodeAt(1)) { | ||
switch (charCodeAt(it, 1)) { | ||
case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i | ||
@@ -50,6 +55,6 @@ case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i | ||
} | ||
digits = it.slice(2); | ||
digits = arraySlice(it, 2); | ||
length = digits.length; | ||
for (index = 0; index < length; index++) { | ||
code = digits.charCodeAt(index); | ||
code = charCodeAt(digits, index); | ||
// parseInt parses a string to a first unavailable symbol | ||
@@ -70,3 +75,3 @@ // but ToNumber should return NaN if a string contains unavailable symbols | ||
// check on 1..constructor(foo) case | ||
return dummy instanceof NumberWrapper && fails(function () { thisNumberValue(dummy); }) | ||
return isPrototypeOf(NumberPrototype, dummy) && fails(function () { thisNumberValue(dummy); }) | ||
? inheritIfRequired(Object(n), dummy, NumberWrapper) : n; | ||
@@ -73,0 +78,0 @@ }; |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity'); | ||
var thisNumberValue = require('../internals/this-number-value'); | ||
var repeat = require('../internals/string-repeat'); | ||
var $repeat = require('../internals/string-repeat'); | ||
var fails = require('../internals/fails'); | ||
var nativeToFixed = 1.0.toFixed; | ||
var RangeError = global.RangeError; | ||
var String = global.String; | ||
var floor = Math.floor; | ||
var repeat = uncurryThis($repeat); | ||
var stringSlice = uncurryThis(''.slice); | ||
var un$ToFixed = uncurryThis(1.0.toFixed); | ||
@@ -54,3 +60,3 @@ var pow = function (x, n, acc) { | ||
var t = String(data[index]); | ||
s = s === '' ? t : s + repeat.call('0', 7 - t.length) + t; | ||
s = s === '' ? t : s + repeat('0', 7 - t.length) + t; | ||
} | ||
@@ -60,10 +66,10 @@ } return s; | ||
var FORCED = nativeToFixed && ( | ||
0.00008.toFixed(3) !== '0.000' || | ||
0.9.toFixed(0) !== '1' || | ||
1.255.toFixed(2) !== '1.25' || | ||
1000000000000000128.0.toFixed(0) !== '1000000000000000128' | ||
) || !fails(function () { | ||
var FORCED = fails(function () { | ||
return un$ToFixed(0.00008, 3) !== '0.000' || | ||
un$ToFixed(0.9, 0) !== '1' || | ||
un$ToFixed(1.255, 2) !== '1.25' || | ||
un$ToFixed(1000000000000000128.0, 0) !== '1000000000000000128'; | ||
}) || !fails(function () { | ||
// V8 ~ Android 4.3- | ||
nativeToFixed.call({}); | ||
un$ToFixed({}); | ||
}); | ||
@@ -115,3 +121,3 @@ | ||
multiply(data, 1 << -e, 0); | ||
result = dataToString(data) + repeat.call('0', fractDigits); | ||
result = dataToString(data) + repeat('0', fractDigits); | ||
} | ||
@@ -122,4 +128,4 @@ } | ||
result = sign + (k <= fractDigits | ||
? '0.' + repeat.call('0', fractDigits - k) + result | ||
: result.slice(0, k - fractDigits) + '.' + result.slice(k - fractDigits)); | ||
? '0.' + repeat('0', fractDigits - k) + result | ||
: stringSlice(result, 0, k - fractDigits) + '.' + stringSlice(result, k - fractDigits)); | ||
} else { | ||
@@ -126,0 +132,0 @@ result = sign + result; |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var fails = require('../internals/fails'); | ||
var thisNumberValue = require('../internals/this-number-value'); | ||
var nativeToPrecision = 1.0.toPrecision; | ||
var un$ToPrecision = uncurryThis(1.0.toPrecision); | ||
var FORCED = fails(function () { | ||
// IE7- | ||
return nativeToPrecision.call(1, undefined) !== '1'; | ||
return un$ToPrecision(1, undefined) !== '1'; | ||
}) || !fails(function () { | ||
// V8 ~ Android 4.3- | ||
nativeToPrecision.call({}); | ||
un$ToPrecision({}); | ||
}); | ||
@@ -21,5 +22,5 @@ | ||
return precision === undefined | ||
? nativeToPrecision.call(thisNumberValue(this)) | ||
: nativeToPrecision.call(thisNumberValue(this), precision); | ||
? un$ToPrecision(thisNumberValue(this)) | ||
: un$ToPrecision(thisNumberValue(this), precision); | ||
} | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -24,5 +25,4 @@ var newPromiseCapabilityModule = require('../internals/new-promise-capability'); | ||
var alreadyCalled = false; | ||
values.push(undefined); | ||
remaining++; | ||
promiseResolve.call(C, promise).then(function (value) { | ||
call(promiseResolve, C, promise).then(function (value) { | ||
if (alreadyCalled) return; | ||
@@ -29,0 +29,0 @@ alreadyCalled = true; |
@@ -5,2 +5,3 @@ 'use strict'; | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var call = require('../internals/function-call'); | ||
var newPromiseCapabilityModule = require('../internals/new-promise-capability'); | ||
@@ -17,2 +18,3 @@ var perform = require('../internals/perform'); | ||
var C = this; | ||
var AggregateError = getBuiltIn('AggregateError'); | ||
var capability = newPromiseCapabilityModule.f(C); | ||
@@ -30,5 +32,4 @@ var resolve = capability.resolve; | ||
var alreadyRejected = false; | ||
errors.push(undefined); | ||
remaining++; | ||
promiseResolve.call(C, promise).then(function (value) { | ||
call(promiseResolve, C, promise).then(function (value) { | ||
if (alreadyRejected || alreadyResolved) return; | ||
@@ -41,6 +42,6 @@ alreadyResolved = true; | ||
errors[index] = error; | ||
--remaining || reject(new (getBuiltIn('AggregateError'))(errors, PROMISE_ANY_ERROR)); | ||
--remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR)); | ||
}); | ||
}); | ||
--remaining || reject(new (getBuiltIn('AggregateError'))(errors, PROMISE_ANY_ERROR)); | ||
--remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR)); | ||
}); | ||
@@ -47,0 +48,0 @@ if (result.error) reject(result.value); |
@@ -6,2 +6,3 @@ 'use strict'; | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var call = require('../internals/function-call'); | ||
var NativePromise = require('../internals/native-promise-constructor'); | ||
@@ -36,2 +37,3 @@ var redefine = require('../internals/redefine'); | ||
var PROMISE = 'Promise'; | ||
var getInternalState = InternalStateModule.get; | ||
@@ -42,3 +44,3 @@ var setInternalState = InternalStateModule.set; | ||
var PromiseConstructor = NativePromise; | ||
var PromiseConstructorPrototype = NativePromisePrototype; | ||
var PromisePrototype = NativePromisePrototype; | ||
var TypeError = global.TypeError; | ||
@@ -49,2 +51,3 @@ var document = global.document; | ||
var newGenericPromiseCapability = newPromiseCapability; | ||
var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent); | ||
@@ -60,2 +63,3 @@ var NATIVE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent); | ||
var SUBCLASSING = false; | ||
var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen; | ||
@@ -71,3 +75,3 @@ | ||
// We need Promise#finally in the pure version for preventing prototype pollution | ||
if (IS_PURE && !PromiseConstructorPrototype['finally']) return true; | ||
if (IS_PURE && !PromisePrototype['finally']) return true; | ||
// We can't use @@species feature detection in V8 since it causes | ||
@@ -134,3 +138,3 @@ // deoptimization and performance degradation | ||
} else if (then = isThenable(result)) { | ||
then.call(result, resolve, reject); | ||
call(then, result, resolve, reject); | ||
} else resolve(result); | ||
@@ -163,3 +167,3 @@ } else reject(value); | ||
var onUnhandled = function (state) { | ||
task.call(global, function () { | ||
call(task, global, function () { | ||
var promise = state.facade; | ||
@@ -187,3 +191,3 @@ var value = state.value; | ||
var onHandleUnhandled = function (state) { | ||
task.call(global, function () { | ||
call(task, global, function () { | ||
var promise = state.facade; | ||
@@ -222,3 +226,3 @@ if (IS_NODE) { | ||
try { | ||
then.call(value, | ||
call(then, value, | ||
bind(internalResolve, wrapper, state), | ||
@@ -245,5 +249,5 @@ bind(internalReject, wrapper, state) | ||
PromiseConstructor = function Promise(executor) { | ||
anInstance(this, PromiseConstructor, PROMISE); | ||
anInstance(this, PromisePrototype); | ||
aCallable(executor); | ||
Internal.call(this); | ||
call(Internal, this); | ||
var state = getInternalState(this); | ||
@@ -256,3 +260,3 @@ try { | ||
}; | ||
PromiseConstructorPrototype = PromiseConstructor.prototype; | ||
PromisePrototype = PromiseConstructor.prototype; | ||
// eslint-disable-next-line no-unused-vars -- required for `.length` | ||
@@ -271,3 +275,3 @@ Internal = function Promise(executor) { | ||
}; | ||
Internal.prototype = redefineAll(PromiseConstructorPrototype, { | ||
Internal.prototype = redefineAll(PromisePrototype, { | ||
// `Promise.prototype.then` method | ||
@@ -277,2 +281,3 @@ // https://tc39.es/ecma262/#sec-promise.prototype.then | ||
var state = getInternalPromiseState(this); | ||
var reactions = state.reactions; | ||
var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor)); | ||
@@ -283,3 +288,3 @@ reaction.ok = isCallable(onFulfilled) ? onFulfilled : true; | ||
state.parent = true; | ||
state.reactions.push(reaction); | ||
reactions[reactions.length] = reaction; | ||
if (state.state != PENDING) notify(state, false); | ||
@@ -315,3 +320,3 @@ return reaction.promise; | ||
return new PromiseConstructor(function (resolve, reject) { | ||
nativeThen.call(that, resolve, reject); | ||
call(nativeThen, that, resolve, reject); | ||
}).then(onFulfilled, onRejected); | ||
@@ -322,3 +327,3 @@ // https://github.com/zloirock/core-js/issues/640 | ||
// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then` | ||
redefine(NativePromisePrototype, 'catch', PromiseConstructorPrototype['catch'], { unsafe: true }); | ||
redefine(NativePromisePrototype, 'catch', PromisePrototype['catch'], { unsafe: true }); | ||
} | ||
@@ -333,3 +338,3 @@ | ||
if (setPrototypeOf) { | ||
setPrototypeOf(NativePromisePrototype, PromiseConstructorPrototype); | ||
setPrototypeOf(NativePromisePrototype, PromisePrototype); | ||
} | ||
@@ -354,3 +359,3 @@ } | ||
var capability = newPromiseCapability(this); | ||
capability.reject.call(undefined, r); | ||
call(capability.reject, undefined, r); | ||
return capability.promise; | ||
@@ -384,5 +389,4 @@ } | ||
var alreadyCalled = false; | ||
values.push(undefined); | ||
remaining++; | ||
$promiseResolve.call(C, promise).then(function (value) { | ||
call($promiseResolve, C, promise).then(function (value) { | ||
if (alreadyCalled) return; | ||
@@ -408,3 +412,3 @@ alreadyCalled = true; | ||
iterate(iterable, function (promise) { | ||
$promiseResolve.call(C, promise).then(capability.resolve, reject); | ||
call($promiseResolve, C, promise).then(capability.resolve, reject); | ||
}); | ||
@@ -411,0 +415,0 @@ }); |
var $ = require('../internals/export'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var functionApply = require('../internals/function-apply'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -7,8 +7,6 @@ var anObject = require('../internals/an-object'); | ||
var nativeApply = getBuiltIn('Reflect', 'apply'); | ||
var functionApply = Function.apply; | ||
// MS Edge argumentsList argument is optional | ||
var OPTIONAL_ARGUMENTS_LIST = !fails(function () { | ||
nativeApply(function () { /* empty */ }); | ||
// eslint-disable-next-line es/no-reflect -- required for testing | ||
Reflect.apply(function () { /* empty */ }); | ||
}); | ||
@@ -20,8 +18,4 @@ | ||
apply: function apply(target, thisArgument, argumentsList) { | ||
aCallable(target); | ||
anObject(argumentsList); | ||
return nativeApply | ||
? nativeApply(target, thisArgument, argumentsList) | ||
: functionApply.call(target, thisArgument, argumentsList); | ||
return functionApply(aCallable(target), thisArgument, anObject(argumentsList)); | ||
} | ||
}); |
var $ = require('../internals/export'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var apply = require('../internals/function-apply'); | ||
var bind = require('../internals/function-bind'); | ||
var aConstructor = require('../internals/a-constructor'); | ||
@@ -7,6 +9,7 @@ var anObject = require('../internals/an-object'); | ||
var create = require('../internals/object-create'); | ||
var bind = require('../internals/function-bind'); | ||
var fails = require('../internals/fails'); | ||
var nativeConstruct = getBuiltIn('Reflect', 'construct'); | ||
var ObjectPrototype = Object.prototype; | ||
var push = [].push; | ||
@@ -21,5 +24,7 @@ // `Reflect.construct` method | ||
}); | ||
var ARGS_BUG = !fails(function () { | ||
nativeConstruct(function () { /* empty */ }); | ||
}); | ||
var FORCED = NEW_TARGET_BUG || ARGS_BUG; | ||
@@ -44,11 +49,11 @@ | ||
var $args = [null]; | ||
$args.push.apply($args, args); | ||
return new (bind.apply(Target, $args))(); | ||
apply(push, $args, args); | ||
return new (apply(bind, Target, $args))(); | ||
} | ||
// with altered newTarget, not support built-in constructors | ||
var proto = newTarget.prototype; | ||
var instance = create(isObject(proto) ? proto : Object.prototype); | ||
var result = Function.apply.call(Target, instance, args); | ||
var instance = create(isObject(proto) ? proto : ObjectPrototype); | ||
var result = apply(Target, instance, args); | ||
return isObject(result) ? result : instance; | ||
} | ||
}); |
var $ = require('../internals/export'); | ||
var call = require('../internals/function-call'); | ||
var isObject = require('../internals/is-object'); | ||
@@ -17,3 +18,3 @@ var anObject = require('../internals/an-object'); | ||
? descriptor.value | ||
: descriptor.get === undefined ? undefined : descriptor.get.call(receiver); | ||
: descriptor.get === undefined ? undefined : call(descriptor.get, receiver); | ||
if (isObject(prototype = getPrototypeOf(target))) return get(prototype, propertyKey, receiver); | ||
@@ -20,0 +21,0 @@ } |
var $ = require('../internals/export'); | ||
var call = require('../internals/function-call'); | ||
var anObject = require('../internals/an-object'); | ||
@@ -33,3 +34,3 @@ var isObject = require('../internals/is-object'); | ||
if (setter === undefined) return false; | ||
setter.call(receiver, V); | ||
call(setter, receiver, V); | ||
} return true; | ||
@@ -36,0 +37,0 @@ } |
var DESCRIPTORS = require('../internals/descriptors'); | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var isForced = require('../internals/is-forced'); | ||
@@ -8,5 +9,6 @@ var inheritIfRequired = require('../internals/inherit-if-required'); | ||
var getOwnPropertyNames = require('../internals/object-get-own-property-names').f; | ||
var isPrototypeOf = require('../internals/object-is-prototype-of'); | ||
var isRegExp = require('../internals/is-regexp'); | ||
var toString = require('../internals/to-string'); | ||
var getFlags = require('../internals/regexp-flags'); | ||
var regExpFlags = require('../internals/regexp-flags'); | ||
var stickyHelpers = require('../internals/regexp-sticky-helpers'); | ||
@@ -25,2 +27,9 @@ var redefine = require('../internals/redefine'); | ||
var RegExpPrototype = NativeRegExp.prototype; | ||
var SyntaxError = global.SyntaxError; | ||
var getFlags = uncurryThis(regExpFlags); | ||
var exec = uncurryThis(RegExpPrototype.exec); | ||
var charAt = uncurryThis(''.charAt); | ||
var replace = uncurryThis(''.replace); | ||
var stringIndexOf = uncurryThis(''.indexOf); | ||
var stringSlice = uncurryThis(''.slice); | ||
// TODO: Use only propper RegExpIdentifierName | ||
@@ -50,5 +59,5 @@ var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/; | ||
for (; index <= length; index++) { | ||
chr = string.charAt(index); | ||
chr = charAt(string, index); | ||
if (chr === '\\') { | ||
result += chr + string.charAt(++index); | ||
result += chr + charAt(string, ++index); | ||
continue; | ||
@@ -80,5 +89,5 @@ } | ||
for (; index <= length; index++) { | ||
chr = string.charAt(index); | ||
chr = charAt(string, index); | ||
if (chr === '\\') { | ||
chr = chr + string.charAt(++index); | ||
chr = chr + charAt(string, ++index); | ||
} else if (chr === ']') { | ||
@@ -91,3 +100,3 @@ brackets = false; | ||
case chr === '(': | ||
if (IS_NCG.test(string.slice(index + 1))) { | ||
if (exec(IS_NCG, stringSlice(string, index + 1))) { | ||
index += 2; | ||
@@ -104,3 +113,3 @@ ncg = true; | ||
names[groupname] = true; | ||
named.push([groupname, groupid]); | ||
named[named.length] = [groupname, groupid]; | ||
ncg = false; | ||
@@ -119,3 +128,3 @@ groupname = ''; | ||
var RegExpWrapper = function RegExp(pattern, flags) { | ||
var thisIsRegExp = this instanceof RegExpWrapper; | ||
var thisIsRegExp = isPrototypeOf(RegExpPrototype, this); | ||
var patternIsRegExp = isRegExp(pattern); | ||
@@ -131,5 +140,5 @@ var flagsAreUndefined = flags === undefined; | ||
if (patternIsRegExp || pattern instanceof RegExpWrapper) { | ||
if (patternIsRegExp || isPrototypeOf(RegExpPrototype, pattern)) { | ||
pattern = pattern.source; | ||
if (flagsAreUndefined) flags = 'flags' in rawPattern ? rawPattern.flags : getFlags.call(rawPattern); | ||
if (flagsAreUndefined) flags = 'flags' in rawPattern ? rawPattern.flags : getFlags(rawPattern); | ||
} | ||
@@ -142,4 +151,4 @@ | ||
if (UNSUPPORTED_DOT_ALL && 'dotAll' in re1) { | ||
dotAll = !!flags && flags.indexOf('s') > -1; | ||
if (dotAll) flags = flags.replace(/s/g, ''); | ||
dotAll = !!flags && stringIndexOf(flags, 's') > -1; | ||
if (dotAll) flags = replace(flags, /s/g, ''); | ||
} | ||
@@ -150,4 +159,4 @@ | ||
if (UNSUPPORTED_Y && 'sticky' in re1) { | ||
sticky = !!flags && flags.indexOf('y') > -1; | ||
if (sticky) flags = flags.replace(/y/g, ''); | ||
sticky = !!flags && stringIndexOf(flags, 'y') > -1; | ||
if (sticky) flags = replace(flags, /y/g, ''); | ||
} | ||
@@ -154,0 +163,0 @@ |
@@ -0,6 +1,10 @@ | ||
var global = require('../internals/global'); | ||
var DESCRIPTORS = require('../internals/descriptors'); | ||
var UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all'); | ||
var classof = require('../internals/classof-raw'); | ||
var defineProperty = require('../internals/object-define-property').f; | ||
var getInternalState = require('../internals/internal-state').get; | ||
var RegExpPrototype = RegExp.prototype; | ||
var TypeError = global.TypeError; | ||
@@ -16,3 +20,3 @@ // `RegExp.prototype.dotAll` getter | ||
// we don't add metadata for regexps created by a literal. | ||
if (this instanceof RegExp) { | ||
if (classof(this) === 'RegExp') { | ||
return !!getInternalState(this).dotAll; | ||
@@ -19,0 +23,0 @@ } |
@@ -6,5 +6,7 @@ var DESCRIPTORS = require('../internals/descriptors'); | ||
var RegExpPrototype = RegExp.prototype; | ||
var FORCED = DESCRIPTORS && fails(function () { | ||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe | ||
return Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get.call({ dotAll: true, sticky: true }) !== 'sy'; | ||
return Object.getOwnPropertyDescriptor(RegExpPrototype, 'flags').get.call({ dotAll: true, sticky: true }) !== 'sy'; | ||
}); | ||
@@ -14,5 +16,5 @@ | ||
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags | ||
if (FORCED) objectDefinePropertyModule.f(RegExp.prototype, 'flags', { | ||
if (FORCED) objectDefinePropertyModule.f(RegExpPrototype, 'flags', { | ||
configurable: true, | ||
get: regExpFlags | ||
}); |
@@ -0,6 +1,10 @@ | ||
var global = require('../internals/global'); | ||
var DESCRIPTORS = require('../internals/descriptors'); | ||
var UNSUPPORTED_Y = require('../internals/regexp-sticky-helpers').UNSUPPORTED_Y; | ||
var classof = require('../internals/classof-raw'); | ||
var defineProperty = require('../internals/object-define-property').f; | ||
var getInternalState = require('../internals/internal-state').get; | ||
var RegExpPrototype = RegExp.prototype; | ||
var TypeError = global.TypeError; | ||
@@ -16,3 +20,3 @@ // `RegExp.prototype.sticky` getter | ||
// we don't add metadata for regexps created by a literal. | ||
if (this instanceof RegExp) { | ||
if (classof(this) === 'RegExp') { | ||
return !!getInternalState(this).sticky; | ||
@@ -19,0 +23,0 @@ } |
@@ -5,2 +5,5 @@ 'use strict'; | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var call = require('../internals/function-call'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var isCallable = require('../internals/is-callable'); | ||
@@ -19,3 +22,4 @@ var isObject = require('../internals/is-object'); | ||
var nativeTest = /./.test; | ||
var Error = global.Error; | ||
var un$Test = uncurryThis(/./.test); | ||
@@ -27,4 +31,4 @@ // `RegExp.prototype.test` method | ||
var exec = this.exec; | ||
if (!isCallable(exec)) return nativeTest.call(this, str); | ||
var result = exec.call(this, str); | ||
if (!isCallable(exec)) return un$Test(this, str); | ||
var result = call(exec, this, str); | ||
if (result !== null && !isObject(result)) { | ||
@@ -31,0 +35,0 @@ throw new Error('RegExp exec method returned something other than an Object or null'); |
'use strict'; | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var PROPER_FUNCTION_NAME = require('../internals/function-name').PROPER; | ||
var redefine = require('../internals/redefine'); | ||
var anObject = require('../internals/an-object'); | ||
var isPrototypeOf = require('../internals/object-is-prototype-of'); | ||
var $toString = require('../internals/to-string'); | ||
var fails = require('../internals/fails'); | ||
var flags = require('../internals/regexp-flags'); | ||
var regExpFlags = require('../internals/regexp-flags'); | ||
var TO_STRING = 'toString'; | ||
var RegExpPrototype = RegExp.prototype; | ||
var nativeToString = RegExpPrototype[TO_STRING]; | ||
var n$ToString = RegExpPrototype[TO_STRING]; | ||
var getFlags = uncurryThis(regExpFlags); | ||
var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; }); | ||
var NOT_GENERIC = fails(function () { return n$ToString.call({ source: 'a', flags: 'b' }) != '/a/b'; }); | ||
// FF44- RegExp#toString has a wrong name | ||
var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name != TO_STRING; | ||
var INCORRECT_NAME = PROPER_FUNCTION_NAME && n$ToString.name != TO_STRING; | ||
@@ -24,5 +27,5 @@ // `RegExp.prototype.toString` method | ||
var rf = R.flags; | ||
var f = $toString(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf); | ||
var f = $toString(rf === undefined && isPrototypeOf(RegExpPrototype, R) && !('flags' in RegExpPrototype) ? getFlags(R) : rf); | ||
return '/' + p + '/' + f; | ||
}, { unsafe: true }); | ||
} |
@@ -7,4 +7,4 @@ 'use strict'; | ||
// https://tc39.es/ecma262/#sec-set-objects | ||
module.exports = collection('Set', function (init) { | ||
collection('Set', function (init) { | ||
return function Set() { return init(this, arguments.length ? arguments[0] : undefined); }; | ||
}, collectionStrong); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var requireObjectCoercible = require('../internals/require-object-coercible'); | ||
@@ -8,2 +9,4 @@ var toIntegerOrInfinity = require('../internals/to-integer-or-infinity'); | ||
var charAt = uncurryThis(''.charAt); | ||
var FORCED = fails(function () { | ||
@@ -21,4 +24,4 @@ return '𠮷'.at(0) !== '\uD842'; | ||
var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; | ||
return (k < 0 || k >= len) ? undefined : S.charAt(k); | ||
return (k < 0 || k >= len) ? undefined : charAt(S, k); | ||
} | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; | ||
@@ -12,3 +13,4 @@ var toLength = require('../internals/to-length'); | ||
// eslint-disable-next-line es/no-string-prototype-endswith -- safe | ||
var $endsWith = ''.endsWith; | ||
var un$EndsWith = uncurryThis(''.endsWith); | ||
var slice = uncurryThis(''.slice); | ||
var min = Math.min; | ||
@@ -33,6 +35,6 @@ | ||
var search = toString(searchString); | ||
return $endsWith | ||
? $endsWith.call(that, search, end) | ||
: that.slice(end - search.length, end) === search; | ||
return un$EndsWith | ||
? un$EndsWith(that, search, end) | ||
: slice(that, end - search.length, end) === search; | ||
} | ||
}); |
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var toAbsoluteIndex = require('../internals/to-absolute-index'); | ||
var RangeError = global.RangeError; | ||
var fromCharCode = String.fromCharCode; | ||
// eslint-disable-next-line es/no-string-fromcodepoint -- required for testing | ||
var $fromCodePoint = String.fromCodePoint; | ||
var join = uncurryThis([].join); | ||
@@ -23,8 +27,7 @@ // length should be 1, old FF problem | ||
if (toAbsoluteIndex(code, 0x10FFFF) !== code) throw RangeError(code + ' is not a valid code point'); | ||
elements.push(code < 0x10000 | ||
elements[i] = code < 0x10000 | ||
? fromCharCode(code) | ||
: fromCharCode(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00) | ||
); | ||
} return elements.join(''); | ||
: fromCharCode(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00); | ||
} return join(elements, ''); | ||
} | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var notARegExp = require('../internals/not-a-regexp'); | ||
@@ -8,2 +9,4 @@ var requireObjectCoercible = require('../internals/require-object-coercible'); | ||
var stringIndexOf = uncurryThis(''.indexOf); | ||
// `String.prototype.includes` method | ||
@@ -13,5 +16,8 @@ // https://tc39.es/ecma262/#sec-string.prototype.includes | ||
includes: function includes(searchString /* , position = 0 */) { | ||
return !!~toString(requireObjectCoercible(this)) | ||
.indexOf(toString(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : undefined); | ||
return !!~stringIndexOf( | ||
toString(requireObjectCoercible(this)), | ||
toString(notARegExp(searchString)), | ||
arguments.length > 1 ? arguments[1] : undefined | ||
); | ||
} | ||
}); |
'use strict'; | ||
/* eslint-disable es/no-string-prototype-matchall -- safe */ | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var call = require('../internals/function-call'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var createIteratorConstructor = require('../internals/create-iterator-constructor'); | ||
@@ -10,4 +13,5 @@ var requireObjectCoercible = require('../internals/require-object-coercible'); | ||
var classof = require('../internals/classof-raw'); | ||
var isPrototypeOf = require('../internals/object-is-prototype-of'); | ||
var isRegExp = require('../internals/is-regexp'); | ||
var getRegExpFlags = require('../internals/regexp-flags'); | ||
var regExpFlags = require('../internals/regexp-flags'); | ||
var getMethod = require('../internals/get-method'); | ||
@@ -29,10 +33,12 @@ var redefine = require('../internals/redefine'); | ||
var RegExpPrototype = RegExp.prototype; | ||
var nativeMatchAll = ''.matchAll; | ||
var TypeError = global.TypeError; | ||
var getFlags = uncurryThis(regExpFlags); | ||
var stringIndexOf = uncurryThis(''.indexOf); | ||
var un$MatchAll = uncurryThis(''.matchAll); | ||
var WORKS_WITH_NON_GLOBAL_REGEX = !!nativeMatchAll && !fails(function () { | ||
'a'.matchAll(/./); | ||
var WORKS_WITH_NON_GLOBAL_REGEX = !!un$MatchAll && !fails(function () { | ||
un$MatchAll('a', /./); | ||
}); | ||
// eslint-disable-next-line max-len -- ignore | ||
var $RegExpStringIterator = createIteratorConstructor(function RegExpStringIterator(regexp, string, global, fullUnicode) { | ||
var $RegExpStringIterator = createIteratorConstructor(function RegExpStringIterator(regexp, string, $global, fullUnicode) { | ||
setInternalState(this, { | ||
@@ -42,3 +48,3 @@ type: REGEXP_STRING_ITERATOR, | ||
string: string, | ||
global: global, | ||
global: $global, | ||
unicode: fullUnicode, | ||
@@ -65,14 +71,14 @@ done: false | ||
var S = toString(string); | ||
var C, flagsValue, flags, matcher, global, fullUnicode; | ||
var C, flagsValue, flags, matcher, $global, fullUnicode; | ||
C = speciesConstructor(R, RegExp); | ||
flagsValue = R.flags; | ||
if (flagsValue === undefined && R instanceof RegExp && !('flags' in RegExpPrototype)) { | ||
flagsValue = getRegExpFlags.call(R); | ||
if (flagsValue === undefined && isPrototypeOf(RegExpPrototype, R) && !('flags' in RegExpPrototype)) { | ||
flagsValue = getFlags(R); | ||
} | ||
flags = flagsValue === undefined ? '' : toString(flagsValue); | ||
matcher = new C(C === RegExp ? R.source : R, flags); | ||
global = !!~flags.indexOf('g'); | ||
fullUnicode = !!~flags.indexOf('u'); | ||
$global = !!~stringIndexOf(flags, 'g'); | ||
fullUnicode = !!~stringIndexOf(flags, 'u'); | ||
matcher.lastIndex = toLength(R.lastIndex); | ||
return new $RegExpStringIterator(matcher, S, global, fullUnicode); | ||
return new $RegExpStringIterator(matcher, S, $global, fullUnicode); | ||
}; | ||
@@ -90,14 +96,14 @@ | ||
? regexp.flags | ||
: getRegExpFlags.call(regexp) | ||
: getFlags(regexp) | ||
)); | ||
if (!~flags.indexOf('g')) throw TypeError('`.matchAll` does not allow non-global regexes'); | ||
if (!~stringIndexOf(flags, 'g')) throw TypeError('`.matchAll` does not allow non-global regexes'); | ||
} | ||
if (WORKS_WITH_NON_GLOBAL_REGEX) return nativeMatchAll.apply(O, arguments); | ||
if (WORKS_WITH_NON_GLOBAL_REGEX) return un$MatchAll(O, regexp); | ||
matcher = getMethod(regexp, MATCH_ALL); | ||
if (matcher === undefined && IS_PURE && classof(regexp) == 'RegExp') matcher = $matchAll; | ||
if (matcher) return matcher.call(regexp, O); | ||
} else if (WORKS_WITH_NON_GLOBAL_REGEX) return nativeMatchAll.apply(O, arguments); | ||
if (matcher) return call(matcher, regexp, O); | ||
} else if (WORKS_WITH_NON_GLOBAL_REGEX) return un$MatchAll(O, regexp); | ||
S = toString(O); | ||
rx = new RegExp(regexp, 'g'); | ||
return IS_PURE ? $matchAll.call(rx, S) : rx[MATCH_ALL](S); | ||
return IS_PURE ? call($matchAll, rx, S) : rx[MATCH_ALL](S); | ||
} | ||
@@ -104,0 +110,0 @@ }); |
'use strict'; | ||
var call = require('../internals/function-call'); | ||
var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); | ||
@@ -19,3 +20,3 @@ var anObject = require('../internals/an-object'); | ||
var matcher = regexp == undefined ? undefined : getMethod(regexp, MATCH); | ||
return matcher ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](toString(O)); | ||
return matcher ? call(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString(O)); | ||
}, | ||
@@ -22,0 +23,0 @@ // `RegExp.prototype[@@match]` method |
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var toIndexedObject = require('../internals/to-indexed-object'); | ||
@@ -7,5 +8,4 @@ var toObject = require('../internals/to-object'); | ||
var ArrayPrototype = Array.prototype; | ||
var push = ArrayPrototype.push; | ||
var join = ArrayPrototype.join; | ||
var push = uncurryThis([].push); | ||
var join = uncurryThis([].join); | ||
@@ -22,7 +22,7 @@ // `String.raw` method | ||
while (literalSegments > i) { | ||
push.call(elements, toString(rawTemplate[i++])); | ||
if (i === literalSegments) return join.call(elements, ''); | ||
if (i < argumentsLength) push.call(elements, toString(arguments[i])); | ||
push(elements, toString(rawTemplate[i++])); | ||
if (i === literalSegments) return join(elements, ''); | ||
if (i < argumentsLength) push(elements, toString(arguments[i])); | ||
} | ||
} | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var call = require('../internals/function-call'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var requireObjectCoercible = require('../internals/require-object-coercible'); | ||
@@ -8,3 +11,3 @@ var isCallable = require('../internals/is-callable'); | ||
var getMethod = require('../internals/get-method'); | ||
var getRegExpFlags = require('../internals/regexp-flags'); | ||
var regExpFlags = require('../internals/regexp-flags'); | ||
var getSubstitution = require('../internals/get-substitution'); | ||
@@ -16,2 +19,7 @@ var wellKnownSymbol = require('../internals/well-known-symbol'); | ||
var RegExpPrototype = RegExp.prototype; | ||
var TypeError = global.TypeError; | ||
var getFlags = uncurryThis(regExpFlags); | ||
var indexOf = uncurryThis(''.indexOf); | ||
var replace = uncurryThis(''.replace); | ||
var stringSlice = uncurryThis(''.slice); | ||
var max = Math.max; | ||
@@ -22,3 +30,3 @@ | ||
if (searchValue === '') return fromIndex; | ||
return string.indexOf(searchValue, fromIndex); | ||
return indexOf(string, searchValue, fromIndex); | ||
}; | ||
@@ -40,11 +48,11 @@ | ||
? searchValue.flags | ||
: getRegExpFlags.call(searchValue) | ||
: getFlags(searchValue) | ||
)); | ||
if (!~flags.indexOf('g')) throw TypeError('`.replaceAll` does not allow non-global regexes'); | ||
if (!~indexOf(flags, 'g')) throw TypeError('`.replaceAll` does not allow non-global regexes'); | ||
} | ||
replacer = getMethod(searchValue, REPLACE); | ||
if (replacer) { | ||
return replacer.call(searchValue, O, replaceValue); | ||
return call(replacer, searchValue, O, replaceValue); | ||
} else if (IS_PURE && IS_REG_EXP) { | ||
return toString(O).replace(searchValue, replaceValue); | ||
return replace(toString(O), searchValue, replaceValue); | ||
} | ||
@@ -60,8 +68,6 @@ } | ||
while (position !== -1) { | ||
if (functionalReplace) { | ||
replacement = toString(replaceValue(searchString, position, string)); | ||
} else { | ||
replacement = getSubstitution(searchString, string, position, [], undefined, replaceValue); | ||
} | ||
result += string.slice(endOfLastMatch, position) + replacement; | ||
replacement = functionalReplace | ||
? toString(replaceValue(searchString, position, string)) | ||
: getSubstitution(searchString, string, position, [], undefined, replaceValue); | ||
result += stringSlice(string, endOfLastMatch, position) + replacement; | ||
endOfLastMatch = position + searchLength; | ||
@@ -71,3 +77,3 @@ position = stringIndexOf(string, searchString, position + advanceBy); | ||
if (endOfLastMatch < string.length) { | ||
result += string.slice(endOfLastMatch); | ||
result += stringSlice(string, endOfLastMatch); | ||
} | ||
@@ -74,0 +80,0 @@ return result; |
'use strict'; | ||
var apply = require('../internals/function-apply'); | ||
var call = require('../internals/function-call'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); | ||
@@ -19,2 +22,6 @@ var fails = require('../internals/fails'); | ||
var min = Math.min; | ||
var concat = uncurryThis([].concat); | ||
var push = uncurryThis([].push); | ||
var stringIndexOf = uncurryThis(''.indexOf); | ||
var stringSlice = uncurryThis(''.slice); | ||
@@ -62,4 +69,4 @@ var maybeToString = function (it) { | ||
return replacer | ||
? replacer.call(searchValue, O, replaceValue) | ||
: nativeReplace.call(toString(O), searchValue, replaceValue); | ||
? call(replacer, searchValue, O, replaceValue) | ||
: call(nativeReplace, toString(O), searchValue, replaceValue); | ||
}, | ||
@@ -73,5 +80,5 @@ // `RegExp.prototype[@@replace]` method | ||
if ( | ||
typeof replaceValue === 'string' && | ||
replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1 && | ||
replaceValue.indexOf('$<') === -1 | ||
typeof replaceValue == 'string' && | ||
stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 && | ||
stringIndexOf(replaceValue, '$<') === -1 | ||
) { | ||
@@ -95,3 +102,3 @@ var res = maybeCallNative(nativeReplace, rx, S, replaceValue); | ||
results.push(result); | ||
push(results, result); | ||
if (!global) break; | ||
@@ -116,8 +123,8 @@ | ||
// causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. | ||
for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j])); | ||
for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j])); | ||
var namedCaptures = result.groups; | ||
if (functionalReplace) { | ||
var replacerArgs = [matched].concat(captures, position, S); | ||
if (namedCaptures !== undefined) replacerArgs.push(namedCaptures); | ||
var replacement = toString(replaceValue.apply(undefined, replacerArgs)); | ||
var replacerArgs = concat([matched], captures, position, S); | ||
if (namedCaptures !== undefined) push(replacerArgs, namedCaptures); | ||
var replacement = toString(apply(replaceValue, undefined, replacerArgs)); | ||
} else { | ||
@@ -127,9 +134,9 @@ replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); | ||
if (position >= nextSourcePosition) { | ||
accumulatedResult += S.slice(nextSourcePosition, position) + replacement; | ||
accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement; | ||
nextSourcePosition = position + matched.length; | ||
} | ||
} | ||
return accumulatedResult + S.slice(nextSourcePosition); | ||
return accumulatedResult + stringSlice(S, nextSourcePosition); | ||
} | ||
]; | ||
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE); |
'use strict'; | ||
var call = require('../internals/function-call'); | ||
var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); | ||
@@ -18,3 +19,3 @@ var anObject = require('../internals/an-object'); | ||
var searcher = regexp == undefined ? undefined : getMethod(regexp, SEARCH); | ||
return searcher ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](toString(O)); | ||
return searcher ? call(searcher, regexp, O) : new RegExp(regexp)[SEARCH](toString(O)); | ||
}, | ||
@@ -21,0 +22,0 @@ // `RegExp.prototype[@@search]` method |
'use strict'; | ||
var apply = require('../internals/function-apply'); | ||
var call = require('../internals/function-call'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); | ||
@@ -11,2 +14,3 @@ var isRegExp = require('../internals/is-regexp'); | ||
var getMethod = require('../internals/get-method'); | ||
var arraySlice = require('../internals/array-slice'); | ||
var callRegExpExec = require('../internals/regexp-exec-abstract'); | ||
@@ -18,5 +22,8 @@ var regexpExec = require('../internals/regexp-exec'); | ||
var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y; | ||
var arrayPush = [].push; | ||
var MAX_UINT32 = 0xFFFFFFFF; | ||
var min = Math.min; | ||
var MAX_UINT32 = 0xFFFFFFFF; | ||
var $push = [].push; | ||
var exec = uncurryThis(/./.exec); | ||
var push = uncurryThis($push); | ||
var stringSlice = uncurryThis(''.slice); | ||
@@ -55,3 +62,3 @@ // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec | ||
if (!isRegExp(separator)) { | ||
return nativeSplit.call(string, separator, lim); | ||
return call(nativeSplit, string, separator, lim); | ||
} | ||
@@ -67,7 +74,7 @@ var output = []; | ||
var match, lastIndex, lastLength; | ||
while (match = regexpExec.call(separatorCopy, string)) { | ||
while (match = call(regexpExec, separatorCopy, string)) { | ||
lastIndex = separatorCopy.lastIndex; | ||
if (lastIndex > lastLastIndex) { | ||
output.push(string.slice(lastLastIndex, match.index)); | ||
if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1)); | ||
push(output, stringSlice(string, lastLastIndex, match.index)); | ||
if (match.length > 1 && match.index < string.length) apply($push, output, arraySlice(match, 1)); | ||
lastLength = match[0].length; | ||
@@ -80,5 +87,5 @@ lastLastIndex = lastIndex; | ||
if (lastLastIndex === string.length) { | ||
if (lastLength || !separatorCopy.test('')) output.push(''); | ||
} else output.push(string.slice(lastLastIndex)); | ||
return output.length > lim ? output.slice(0, lim) : output; | ||
if (lastLength || !exec(separatorCopy, '')) push(output, ''); | ||
} else push(output, stringSlice(string, lastLastIndex)); | ||
return output.length > lim ? arraySlice(output, 0, lim) : output; | ||
}; | ||
@@ -88,3 +95,3 @@ // Chakra, V8 | ||
internalSplit = function (separator, limit) { | ||
return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit); | ||
return separator === undefined && limit === 0 ? [] : call(nativeSplit, this, separator, limit); | ||
}; | ||
@@ -100,4 +107,4 @@ } else internalSplit = nativeSplit; | ||
return splitter | ||
? splitter.call(separator, O, limit) | ||
: internalSplit.call(toString(O), separator, limit); | ||
? call(splitter, separator, O, limit) | ||
: call(internalSplit, toString(O), separator, limit); | ||
}, | ||
@@ -135,3 +142,3 @@ // `RegExp.prototype[@@split]` method | ||
splitter.lastIndex = UNSUPPORTED_Y ? 0 : q; | ||
var z = callRegExpExec(splitter, UNSUPPORTED_Y ? S.slice(q) : S); | ||
var z = callRegExpExec(splitter, UNSUPPORTED_Y ? stringSlice(S, q) : S); | ||
var e; | ||
@@ -144,6 +151,6 @@ if ( | ||
} else { | ||
A.push(S.slice(p, q)); | ||
push(A, stringSlice(S, p, q)); | ||
if (A.length === lim) return A; | ||
for (var i = 1; i <= z.length - 1; i++) { | ||
A.push(z[i]); | ||
push(A, z[i]); | ||
if (A.length === lim) return A; | ||
@@ -154,3 +161,3 @@ } | ||
} | ||
A.push(S.slice(p)); | ||
push(A, stringSlice(S, p)); | ||
return A; | ||
@@ -157,0 +164,0 @@ } |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; | ||
@@ -12,3 +13,4 @@ var toLength = require('../internals/to-length'); | ||
// eslint-disable-next-line es/no-string-prototype-startswith -- safe | ||
var $startsWith = ''.startsWith; | ||
var un$StartsWith = uncurryThis(''.startsWith); | ||
var stringSlice = uncurryThis(''.slice); | ||
var min = Math.min; | ||
@@ -31,6 +33,6 @@ | ||
var search = toString(searchString); | ||
return $startsWith | ||
? $startsWith.call(that, search, index) | ||
: that.slice(index, index + search.length) === search; | ||
return un$StartsWith | ||
? un$StartsWith(that, search, index) | ||
: stringSlice(that, index, index + search.length) === search; | ||
} | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var requireObjectCoercible = require('../internals/require-object-coercible'); | ||
@@ -7,3 +8,3 @@ var toIntegerOrInfinity = require('../internals/to-integer-or-infinity'); | ||
var slice = ''.slice; | ||
var stringSlice = uncurryThis(''.slice); | ||
var max = Math.max; | ||
@@ -28,4 +29,4 @@ var min = Math.min; | ||
intEnd = min(intStart + intLength, size); | ||
return intStart >= intEnd ? '' : slice.call(that, intStart, intEnd); | ||
return intStart >= intEnd ? '' : stringSlice(that, intStart, intEnd); | ||
} | ||
}); |
@@ -7,5 +7,7 @@ // `Symbol.prototype.description` getter | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var hasOwn = require('../internals/has-own-property'); | ||
var isCallable = require('../internals/is-callable'); | ||
var isObject = require('../internals/is-object'); | ||
var isPrototypeOf = require('../internals/object-is-prototype-of'); | ||
var toString = require('../internals/to-string'); | ||
var defineProperty = require('../internals/object-define-property').f; | ||
@@ -15,4 +17,5 @@ var copyConstructorProperties = require('../internals/copy-constructor-properties'); | ||
var NativeSymbol = global.Symbol; | ||
var SymbolPrototype = NativeSymbol && NativeSymbol.prototype; | ||
if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in NativeSymbol.prototype) || | ||
if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototype) || | ||
// Safari 12 bug | ||
@@ -24,4 +27,4 @@ NativeSymbol().description !== undefined | ||
var SymbolWrapper = function Symbol() { | ||
var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]); | ||
var result = this instanceof SymbolWrapper | ||
var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString(arguments[0]); | ||
var result = isPrototypeOf(SymbolPrototype, this) | ||
? new NativeSymbol(description) | ||
@@ -33,16 +36,21 @@ // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)' | ||
}; | ||
copyConstructorProperties(SymbolWrapper, NativeSymbol); | ||
var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype; | ||
symbolPrototype.constructor = SymbolWrapper; | ||
SymbolWrapper.prototype = SymbolPrototype; | ||
SymbolPrototype.constructor = SymbolWrapper; | ||
var symbolToString = symbolPrototype.toString; | ||
var nativeSymbol = String(NativeSymbol('test')) == 'Symbol(test)'; | ||
var NATIVE_SYMBOL = String(NativeSymbol('test')) == 'Symbol(test)'; | ||
var symbolToString = uncurryThis(SymbolPrototype.toString); | ||
var symbolValueOf = uncurryThis(SymbolPrototype.valueOf); | ||
var regexp = /^Symbol\((.*)\)[^)]+$/; | ||
defineProperty(symbolPrototype, 'description', { | ||
var replace = uncurryThis(''.replace); | ||
var stringSlice = uncurryThis(''.slice); | ||
defineProperty(SymbolPrototype, 'description', { | ||
configurable: true, | ||
get: function description() { | ||
var symbol = isObject(this) ? this.valueOf() : this; | ||
var string = symbolToString.call(symbol); | ||
var symbol = symbolValueOf(this); | ||
var string = symbolToString(symbol); | ||
if (hasOwn(EmptyStringDescriptionStore, symbol)) return ''; | ||
var desc = nativeSymbol ? string.slice(7, -1) : string.replace(regexp, '$1'); | ||
var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1'); | ||
return desc === '' ? undefined : desc; | ||
@@ -49,0 +57,0 @@ } |
@@ -5,2 +5,5 @@ 'use strict'; | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var apply = require('../internals/function-apply'); | ||
var call = require('../internals/function-call'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
@@ -14,2 +17,3 @@ var DESCRIPTORS = require('../internals/descriptors'); | ||
var isObject = require('../internals/is-object'); | ||
var isPrototypeOf = require('../internals/object-is-prototype-of'); | ||
var isSymbol = require('../internals/is-symbol'); | ||
@@ -30,2 +34,3 @@ var anObject = require('../internals/an-object'); | ||
var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable'); | ||
var arraySlice = require('../internals/array-slice'); | ||
var redefine = require('../internals/redefine'); | ||
@@ -47,6 +52,11 @@ var shared = require('../internals/shared'); | ||
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); | ||
var setInternalState = InternalStateModule.set; | ||
var getInternalState = InternalStateModule.getterFor(SYMBOL); | ||
var ObjectPrototype = Object[PROTOTYPE]; | ||
var $Symbol = global.Symbol; | ||
var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE]; | ||
var TypeError = global.TypeError; | ||
var QObject = global.QObject; | ||
var $stringify = getBuiltIn('JSON', 'stringify'); | ||
@@ -57,2 +67,4 @@ var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; | ||
var nativePropertyIsEnumerable = propertyIsEnumerableModule.f; | ||
var push = uncurryThis([].push); | ||
var AllSymbols = shared('symbols'); | ||
@@ -63,3 +75,3 @@ var ObjectPrototypeSymbols = shared('op-symbols'); | ||
var WellKnownSymbolsStore = shared('wks'); | ||
var QObject = global.QObject; | ||
// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 | ||
@@ -83,3 +95,3 @@ var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; | ||
var wrap = function (tag, description) { | ||
var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]); | ||
var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype); | ||
setInternalState(symbol, { | ||
@@ -115,3 +127,3 @@ type: SYMBOL, | ||
$forEach(keys, function (key) { | ||
if (!DESCRIPTORS || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]); | ||
if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]); | ||
}); | ||
@@ -127,3 +139,3 @@ return O; | ||
var P = toPropertyKey(V); | ||
var enumerable = nativePropertyIsEnumerable.call(this, P); | ||
var enumerable = call(nativePropertyIsEnumerable, this, P); | ||
if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false; | ||
@@ -149,3 +161,3 @@ return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P] | ||
$forEach(names, function (key) { | ||
if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) result.push(key); | ||
if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key); | ||
}); | ||
@@ -161,3 +173,3 @@ return result; | ||
if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) { | ||
result.push(AllSymbols[key]); | ||
push(result, AllSymbols[key]); | ||
} | ||
@@ -172,7 +184,7 @@ }); | ||
$Symbol = function Symbol() { | ||
if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor'); | ||
if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor'); | ||
var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]); | ||
var tag = uid(description); | ||
var setter = function (value) { | ||
if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value); | ||
if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value); | ||
if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false; | ||
@@ -185,3 +197,5 @@ setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value)); | ||
redefine($Symbol[PROTOTYPE], 'toString', function toString() { | ||
SymbolPrototype = $Symbol[PROTOTYPE]; | ||
redefine(SymbolPrototype, 'toString', function toString() { | ||
return getInternalState(this).tag; | ||
@@ -206,3 +220,3 @@ }); | ||
// https://github.com/tc39/proposal-Symbol-description | ||
nativeDefineProperty($Symbol[PROTOTYPE], 'description', { | ||
nativeDefineProperty(SymbolPrototype, 'description', { | ||
configurable: true, | ||
@@ -296,14 +310,11 @@ get: function description() { | ||
stringify: function stringify(it, replacer, space) { | ||
var args = [it]; | ||
var index = 1; | ||
var $replacer; | ||
while (arguments.length > index) args.push(arguments[index++]); | ||
$replacer = replacer; | ||
var args = arraySlice(arguments); | ||
var $replacer = replacer; | ||
if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined | ||
if (!isArray(replacer)) replacer = function (key, value) { | ||
if (isCallable($replacer)) value = $replacer.call(this, key, value); | ||
if (isCallable($replacer)) value = call($replacer, this, key, value); | ||
if (!isSymbol(value)) return value; | ||
}; | ||
args[1] = replacer; | ||
return $stringify.apply(null, args); | ||
return apply($stringify, null, args); | ||
} | ||
@@ -315,6 +326,8 @@ }); | ||
// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive | ||
if (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) { | ||
var valueOf = $Symbol[PROTOTYPE].valueOf; | ||
redefine($Symbol[PROTOTYPE], TO_PRIMITIVE, function () { | ||
return valueOf.apply(this, arguments); | ||
if (!SymbolPrototype[TO_PRIMITIVE]) { | ||
var valueOf = SymbolPrototype.valueOf; | ||
// eslint-disable-next-line no-unused-vars -- required for .length | ||
redefine(SymbolPrototype, TO_PRIMITIVE, function (hint) { | ||
// TODO: improve hint logic | ||
return call(valueOf, this); | ||
}); | ||
@@ -321,0 +334,0 @@ } |
'use strict'; | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); | ||
var $copyWithin = require('../internals/array-copy-within'); | ||
var $ArrayCopyWithin = require('../internals/array-copy-within'); | ||
var u$ArrayCopyWithin = uncurryThis($ArrayCopyWithin); | ||
var aTypedArray = ArrayBufferViewCore.aTypedArray; | ||
@@ -11,3 +13,3 @@ var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; | ||
exportTypedArrayMethod('copyWithin', function copyWithin(target, start /* , end */) { | ||
return $copyWithin.call(aTypedArray(this), target, start, arguments.length > 2 ? arguments[2] : undefined); | ||
return u$ArrayCopyWithin(aTypedArray(this), target, start, arguments.length > 2 ? arguments[2] : undefined); | ||
}); |
'use strict'; | ||
var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); | ||
var call = require('../internals/function-call'); | ||
var $fill = require('../internals/array-fill'); | ||
@@ -10,5 +11,11 @@ | ||
// https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill | ||
// eslint-disable-next-line no-unused-vars -- required for `.length` | ||
exportTypedArrayMethod('fill', function fill(value /* , start, end */) { | ||
return $fill.apply(aTypedArray(this), arguments); | ||
var length = arguments.length; | ||
return call( | ||
$fill, | ||
aTypedArray(this), | ||
value, | ||
length > 1 ? arguments[1] : undefined, | ||
length > 2 ? arguments[2] : undefined | ||
); | ||
}); |
'use strict'; | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var PROPER_FUNCTION_NAME = require('../internals/function-name').PROPER; | ||
@@ -10,5 +11,5 @@ var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); | ||
var Uint8Array = global.Uint8Array; | ||
var arrayValues = ArrayIterators.values; | ||
var arrayKeys = ArrayIterators.keys; | ||
var arrayEntries = ArrayIterators.entries; | ||
var arrayValues = uncurryThis(ArrayIterators.values); | ||
var arrayKeys = uncurryThis(ArrayIterators.keys); | ||
var arrayEntries = uncurryThis(ArrayIterators.entries); | ||
var aTypedArray = ArrayBufferViewCore.aTypedArray; | ||
@@ -21,3 +22,3 @@ var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; | ||
var typedArrayValues = function values() { | ||
return arrayValues.call(aTypedArray(this)); | ||
return arrayValues(aTypedArray(this)); | ||
}; | ||
@@ -28,3 +29,3 @@ | ||
exportTypedArrayMethod('entries', function entries() { | ||
return arrayEntries.call(aTypedArray(this)); | ||
return arrayEntries(aTypedArray(this)); | ||
}); | ||
@@ -34,3 +35,3 @@ // `%TypedArray%.prototype.keys` method | ||
exportTypedArrayMethod('keys', function keys() { | ||
return arrayKeys.call(aTypedArray(this)); | ||
return arrayKeys(aTypedArray(this)); | ||
}); | ||
@@ -37,0 +38,0 @@ // `%TypedArray%.prototype.values` method |
'use strict'; | ||
var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var aTypedArray = ArrayBufferViewCore.aTypedArray; | ||
var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; | ||
var $join = [].join; | ||
var $join = uncurryThis([].join); | ||
// `%TypedArray%.prototype.join` method | ||
// https://tc39.es/ecma262/#sec-%typedarray%.prototype.join | ||
// eslint-disable-next-line no-unused-vars -- required for `.length` | ||
exportTypedArrayMethod('join', function join(separator) { | ||
return $join.apply(aTypedArray(this), arguments); | ||
return $join(aTypedArray(this), separator); | ||
}); |
'use strict'; | ||
var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); | ||
var apply = require('../internals/function-apply'); | ||
var $lastIndexOf = require('../internals/array-last-index-of'); | ||
@@ -10,5 +11,5 @@ | ||
// https://tc39.es/ecma262/#sec-%typedarray%.prototype.lastindexof | ||
// eslint-disable-next-line no-unused-vars -- required for `.length` | ||
exportTypedArrayMethod('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */) { | ||
return $lastIndexOf.apply(aTypedArray(this), arguments); | ||
var length = arguments.length; | ||
return apply($lastIndexOf, aTypedArray(this), length > 1 ? [searchElement, arguments[1]] : [searchElement]); | ||
}); |
@@ -11,3 +11,4 @@ 'use strict'; | ||
exportTypedArrayMethod('reduceRight', function reduceRight(callbackfn /* , initialValue */) { | ||
return $reduceRight(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); | ||
var length = arguments.length; | ||
return $reduceRight(aTypedArray(this), callbackfn, length, length > 1 ? arguments[1] : undefined); | ||
}); |
@@ -11,3 +11,4 @@ 'use strict'; | ||
exportTypedArrayMethod('reduce', function reduce(callbackfn /* , initialValue */) { | ||
return $reduce(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); | ||
var length = arguments.length; | ||
return $reduce(aTypedArray(this), callbackfn, length, length > 1 ? arguments[1] : undefined); | ||
}); |
'use strict'; | ||
var global = require('../internals/global'); | ||
var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); | ||
@@ -8,2 +9,3 @@ var lengthOfArrayLike = require('../internals/length-of-array-like'); | ||
var RangeError = global.RangeError; | ||
var aTypedArray = ArrayBufferViewCore.aTypedArray; | ||
@@ -10,0 +12,0 @@ var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; |
@@ -5,6 +5,6 @@ 'use strict'; | ||
var fails = require('../internals/fails'); | ||
var arraySlice = require('../internals/array-slice'); | ||
var aTypedArray = ArrayBufferViewCore.aTypedArray; | ||
var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; | ||
var $slice = [].slice; | ||
@@ -19,3 +19,3 @@ var FORCED = fails(function () { | ||
exportTypedArrayMethod('slice', function slice(start, end) { | ||
var list = $slice.call(aTypedArray(this), start, end); | ||
var list = arraySlice(aTypedArray(this), start, end); | ||
var C = typedArraySpeciesConstructor(this); | ||
@@ -22,0 +22,0 @@ var index = 0; |
'use strict'; | ||
var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var fails = require('../internals/fails'); | ||
var aCallable = require('../internals/a-callable'); | ||
var lengthOfArrayLike = require('../internals/length-of-array-like'); | ||
var internalSort = require('../internals/array-sort'); | ||
var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); | ||
var FF = require('../internals/engine-ff-version'); | ||
@@ -13,15 +13,16 @@ var IE_OR_EDGE = require('../internals/engine-is-ie-or-edge'); | ||
var Array = global.Array; | ||
var aTypedArray = ArrayBufferViewCore.aTypedArray; | ||
var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; | ||
var Uint16Array = global.Uint16Array; | ||
var nativeSort = Uint16Array && Uint16Array.prototype.sort; | ||
var un$Sort = Uint16Array && uncurryThis(Uint16Array.prototype.sort); | ||
// WebKit | ||
var ACCEPT_INCORRECT_ARGUMENTS = !!nativeSort && !fails(function () { | ||
var array = new Uint16Array(2); | ||
array.sort(null); | ||
array.sort({}); | ||
}); | ||
var ACCEPT_INCORRECT_ARGUMENTS = !!un$Sort && !(fails(function () { | ||
un$Sort(new Uint16Array(2), null); | ||
}) && fails(function () { | ||
un$Sort(new Uint16Array(2), {}); | ||
})); | ||
var STABLE_SORT = !!nativeSort && !fails(function () { | ||
var STABLE_SORT = !!un$Sort && !fails(function () { | ||
// feature detection can be too slow, so check engines versions | ||
@@ -43,3 +44,3 @@ if (V8) return V8 < 74; | ||
array.sort(function (a, b) { | ||
un$Sort(array, function (a, b) { | ||
return (a / 4 | 0) - (b / 4 | 0); | ||
@@ -68,22 +69,6 @@ }); | ||
exportTypedArrayMethod('sort', function sort(comparefn) { | ||
var array = this; | ||
if (comparefn !== undefined) aCallable(comparefn); | ||
if (STABLE_SORT) return nativeSort.call(array, comparefn); | ||
if (STABLE_SORT) return un$Sort(this, comparefn); | ||
aTypedArray(array); | ||
var arrayLength = lengthOfArrayLike(array); | ||
var items = Array(arrayLength); | ||
var index; | ||
for (index = 0; index < arrayLength; index++) { | ||
items[index] = array[index]; | ||
} | ||
items = internalSort(array, getSortCompare(comparefn)); | ||
for (index = 0; index < arrayLength; index++) { | ||
array[index] = items[index]; | ||
} | ||
return array; | ||
return internalSort(aTypedArray(this), getSortCompare(comparefn)); | ||
}, !STABLE_SORT || ACCEPT_INCORRECT_ARGUMENTS); |
'use strict'; | ||
var global = require('../internals/global'); | ||
var apply = require('../internals/function-apply'); | ||
var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); | ||
var fails = require('../internals/fails'); | ||
var arraySlice = require('../internals/array-slice'); | ||
@@ -10,3 +12,2 @@ var Int8Array = global.Int8Array; | ||
var $toLocaleString = [].toLocaleString; | ||
var $slice = [].slice; | ||
@@ -27,3 +28,7 @@ // iOS Safari 6.x fails here | ||
exportTypedArrayMethod('toLocaleString', function toLocaleString() { | ||
return $toLocaleString.apply(TO_LOCALE_STRING_BUG ? $slice.call(aTypedArray(this)) : aTypedArray(this), arguments); | ||
return apply( | ||
$toLocaleString, | ||
TO_LOCALE_STRING_BUG ? arraySlice(aTypedArray(this)) : aTypedArray(this), | ||
arraySlice(arguments) | ||
); | ||
}, FORCED); |
@@ -5,2 +5,3 @@ 'use strict'; | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
@@ -10,7 +11,7 @@ var Uint8Array = global.Uint8Array; | ||
var arrayToString = [].toString; | ||
var arrayJoin = [].join; | ||
var join = uncurryThis([].join); | ||
if (fails(function () { arrayToString.call({}); })) { | ||
arrayToString = function toString() { | ||
return arrayJoin.call(this); | ||
return join(this); | ||
}; | ||
@@ -17,0 +18,0 @@ } |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var toString = require('../internals/to-string'); | ||
var fromCharCode = String.fromCharCode; | ||
var charAt = uncurryThis(''.charAt); | ||
var exec = uncurryThis(/./.exec); | ||
var stringSlice = uncurryThis(''.slice); | ||
var hex2 = /^[\da-f]{2}$/i; | ||
@@ -17,10 +22,10 @@ var hex4 = /^[\da-f]{4}$/i; | ||
var index = 0; | ||
var chr, slice; | ||
var chr, part; | ||
while (index < length) { | ||
chr = str.charAt(index++); | ||
chr = charAt(str, index++); | ||
if (chr === '%') { | ||
if (str.charAt(index) === 'u') { | ||
slice = str.slice(index + 1, index + 5); | ||
if (hex4.test(slice)) { | ||
result += fromCharCode(parseInt(slice, 16)); | ||
if (charAt(str, index) === 'u') { | ||
part = stringSlice(str, index + 1, index + 5); | ||
if (exec(hex4, part)) { | ||
result += fromCharCode(parseInt(part, 16)); | ||
index += 5; | ||
@@ -30,5 +35,5 @@ continue; | ||
} else { | ||
slice = str.slice(index, index + 2); | ||
if (hex2.test(slice)) { | ||
result += fromCharCode(parseInt(slice, 16)); | ||
part = stringSlice(str, index, index + 2); | ||
if (exec(hex2, part)) { | ||
result += fromCharCode(parseInt(part, 16)); | ||
index += 2; | ||
@@ -35,0 +40,0 @@ continue; |
'use strict'; | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var redefineAll = require('../internals/redefine-all'); | ||
@@ -24,3 +25,3 @@ var InternalMetadataModule = require('../internals/internal-metadata'); | ||
// https://tc39.es/ecma262/#sec-weakmap-constructor | ||
var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak); | ||
var $WeakMap = collection('WeakMap', wrapper, collectionWeak); | ||
@@ -34,6 +35,6 @@ // IE11 WeakMap frozen keys fix | ||
var WeakMapPrototype = $WeakMap.prototype; | ||
var nativeDelete = WeakMapPrototype['delete']; | ||
var nativeHas = WeakMapPrototype.has; | ||
var nativeGet = WeakMapPrototype.get; | ||
var nativeSet = WeakMapPrototype.set; | ||
var nativeDelete = uncurryThis(WeakMapPrototype['delete']); | ||
var nativeHas = uncurryThis(WeakMapPrototype.has); | ||
var nativeGet = uncurryThis(WeakMapPrototype.get); | ||
var nativeSet = uncurryThis(WeakMapPrototype.set); | ||
redefineAll(WeakMapPrototype, { | ||
@@ -44,4 +45,4 @@ 'delete': function (key) { | ||
if (!state.frozen) state.frozen = new InternalWeakMap(); | ||
return nativeDelete.call(this, key) || state.frozen['delete'](key); | ||
} return nativeDelete.call(this, key); | ||
return nativeDelete(this, key) || state.frozen['delete'](key); | ||
} return nativeDelete(this, key); | ||
}, | ||
@@ -52,4 +53,4 @@ has: function has(key) { | ||
if (!state.frozen) state.frozen = new InternalWeakMap(); | ||
return nativeHas.call(this, key) || state.frozen.has(key); | ||
} return nativeHas.call(this, key); | ||
return nativeHas(this, key) || state.frozen.has(key); | ||
} return nativeHas(this, key); | ||
}, | ||
@@ -60,4 +61,4 @@ get: function get(key) { | ||
if (!state.frozen) state.frozen = new InternalWeakMap(); | ||
return nativeHas.call(this, key) ? nativeGet.call(this, key) : state.frozen.get(key); | ||
} return nativeGet.call(this, key); | ||
return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key); | ||
} return nativeGet(this, key); | ||
}, | ||
@@ -68,4 +69,4 @@ set: function set(key, value) { | ||
if (!state.frozen) state.frozen = new InternalWeakMap(); | ||
nativeHas.call(this, key) ? nativeSet.call(this, key, value) : state.frozen.set(key, value); | ||
} else nativeSet.call(this, key, value); | ||
nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value); | ||
} else nativeSet(this, key, value); | ||
return this; | ||
@@ -72,0 +73,0 @@ } |
@@ -14,3 +14,3 @@ var $ = require('../internals/export'); | ||
element = array[index++]; | ||
if (!(typeof element === 'string' || (allowUndefined && typeof element === 'undefined'))) { | ||
if (!(typeof element == 'string' || (allowUndefined && typeof element == 'undefined'))) { | ||
return false; | ||
@@ -17,0 +17,0 @@ } |
'use strict'; | ||
// https://github.com/tc39/proposal-iterator-helpers | ||
var $ = require('../internals/export'); | ||
var apply = require('../internals/function-apply'); | ||
var anObject = require('../internals/an-object'); | ||
@@ -11,3 +12,3 @@ var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy'); | ||
return Promise.resolve(anObject(state.next.apply(iterator, args))).then(function (step) { | ||
return Promise.resolve(anObject(apply(state.next, iterator, args))).then(function (step) { | ||
if (anObject(step).done) { | ||
@@ -14,0 +15,0 @@ state.done = true; |
@@ -14,3 +14,3 @@ 'use strict'; | ||
var AsyncIteratorConstructor = function AsyncIterator() { | ||
anInstance(this, AsyncIteratorConstructor); | ||
anInstance(this, AsyncIteratorPrototype); | ||
}; | ||
@@ -17,0 +17,0 @@ |
'use strict'; | ||
// https://github.com/tc39/proposal-iterator-helpers | ||
var $ = require('../internals/export'); | ||
var apply = require('../internals/function-apply'); | ||
var anObject = require('../internals/an-object'); | ||
@@ -15,3 +16,3 @@ var toPositiveInteger = require('../internals/to-positive-integer'); | ||
Promise.resolve( | ||
anObject(state.next.apply(state.iterator, state.remaining ? [] : args)) | ||
anObject(apply(state.next, state.iterator, state.remaining ? [] : args)) | ||
).then(function (step) { | ||
@@ -18,0 +19,0 @@ try { |
'use strict'; | ||
// https://github.com/tc39/proposal-iterator-helpers | ||
var $ = require('../internals/export'); | ||
var apply = require('../internals/function-apply'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -15,3 +16,3 @@ var anObject = require('../internals/an-object'); | ||
try { | ||
Promise.resolve(anObject(state.next.apply(state.iterator, args))).then(function (step) { | ||
Promise.resolve(anObject(apply(state.next, state.iterator, args))).then(function (step) { | ||
try { | ||
@@ -18,0 +19,0 @@ if (anObject(step).done) { |
'use strict'; | ||
// https://github.com/tc39/proposal-iterator-helpers | ||
var $ = require('../internals/export'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -17,3 +18,3 @@ var anObject = require('../internals/an-object'); | ||
try { | ||
Promise.resolve(anObject(state.next.call(state.iterator))).then(function (step) { | ||
Promise.resolve(anObject(call(state.next, state.iterator))).then(function (step) { | ||
try { | ||
@@ -40,3 +41,3 @@ if (anObject(step).done) { | ||
try { | ||
Promise.resolve(anObject(state.innerNext.call(innerIterator))).then(function (result) { | ||
Promise.resolve(anObject(call(state.innerNext, innerIterator))).then(function (result) { | ||
try { | ||
@@ -43,0 +44,0 @@ if (anObject(result).done) { |
// https://github.com/tc39/proposal-iterator-helpers | ||
var $ = require('../internals/export'); | ||
var apply = require('../internals/function-apply'); | ||
var anObject = require('../internals/an-object'); | ||
var toObject = require('../internals/to-object'); | ||
var isPrototypeOf = require('../internals/object-is-prototype-of'); | ||
var AsyncIteratorPrototype = require('../internals/async-iterator-prototype'); | ||
@@ -16,6 +18,4 @@ var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy'); | ||
var isPrototypeOf = {}.isPrototypeOf; | ||
var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise, args) { | ||
return anObject(this.next.apply(this.iterator, args)); | ||
return anObject(apply(this.next, this.iterator, args)); | ||
}, true); | ||
@@ -30,3 +30,3 @@ | ||
iterator = getAsyncIterator(object, usingIterator); | ||
if (isPrototypeOf.call(AsyncIteratorPrototype, iterator)) return iterator; | ||
if (isPrototypeOf(AsyncIteratorPrototype, iterator)) return iterator; | ||
} | ||
@@ -33,0 +33,0 @@ if (iterator === undefined) { |
'use strict'; | ||
// https://github.com/tc39/proposal-iterator-helpers | ||
var $ = require('../internals/export'); | ||
var apply = require('../internals/function-apply'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -12,3 +13,3 @@ var anObject = require('../internals/an-object'); | ||
return Promise.resolve(anObject(state.next.apply(state.iterator, args))).then(function (step) { | ||
return Promise.resolve(anObject(apply(state.next, state.iterator, args))).then(function (step) { | ||
if (anObject(step).done) { | ||
@@ -15,0 +16,0 @@ state.done = true; |
'use strict'; | ||
// https://github.com/tc39/proposal-iterator-helpers | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -9,2 +11,3 @@ var anObject = require('../internals/an-object'); | ||
var Promise = getBuiltIn('Promise'); | ||
var TypeError = global.TypeError; | ||
@@ -22,3 +25,3 @@ $({ target: 'AsyncIterator', proto: true, real: true }, { | ||
try { | ||
Promise.resolve(anObject(next.call(iterator))).then(function (step) { | ||
Promise.resolve(anObject(call(next, iterator))).then(function (step) { | ||
try { | ||
@@ -25,0 +28,0 @@ if (anObject(step).done) { |
'use strict'; | ||
// https://github.com/tc39/proposal-iterator-helpers | ||
var $ = require('../internals/export'); | ||
var apply = require('../internals/function-apply'); | ||
var call = require('../internals/function-call'); | ||
var anObject = require('../internals/an-object'); | ||
@@ -16,3 +18,3 @@ var toPositiveInteger = require('../internals/to-positive-integer'); | ||
if (returnMethod !== undefined) { | ||
return Promise.resolve(returnMethod.call(iterator)).then(function () { | ||
return Promise.resolve(call(returnMethod, iterator)).then(function () { | ||
return result; | ||
@@ -22,3 +24,3 @@ }); | ||
return result; | ||
} return this.next.apply(iterator, args); | ||
} return apply(this.next, iterator, args); | ||
}); | ||
@@ -25,0 +27,0 @@ |
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var apply = require('../internals/function-apply'); | ||
var getCompositeKeyNode = require('../internals/composite-key'); | ||
@@ -6,2 +8,4 @@ var getBuiltIn = require('../internals/get-built-in'); | ||
var Object = global.Object; | ||
var initializer = function () { | ||
@@ -15,4 +19,4 @@ var freeze = getBuiltIn('Object', 'freeze'); | ||
compositeKey: function compositeKey() { | ||
return getCompositeKeyNode.apply(Object, arguments).get('object', initializer); | ||
return apply(getCompositeKeyNode, Object, arguments).get('object', initializer); | ||
} | ||
}); |
var $ = require('../internals/export'); | ||
var getCompositeKeyNode = require('../internals/composite-key'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var apply = require('../internals/function-apply'); | ||
@@ -8,5 +9,5 @@ // https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey | ||
compositeSymbol: function compositeSymbol() { | ||
if (arguments.length === 1 && typeof arguments[0] === 'string') return getBuiltIn('Symbol')['for'](arguments[0]); | ||
return getCompositeKeyNode.apply(null, arguments).get('symbol', getBuiltIn('Symbol')); | ||
if (arguments.length == 1 && typeof arguments[0] == 'string') return getBuiltIn('Symbol')['for'](arguments[0]); | ||
return apply(getCompositeKeyNode, null, arguments).get('symbol', getBuiltIn('Symbol')); | ||
} | ||
}); |
'use strict'; | ||
// https://github.com/tc39/proposal-iterator-helpers | ||
var $ = require('../internals/export'); | ||
var apply = require('../internals/function-apply'); | ||
var anObject = require('../internals/an-object'); | ||
@@ -8,3 +9,3 @@ var createIteratorProxy = require('../internals/iterator-create-proxy'); | ||
var IteratorProxy = createIteratorProxy(function (args) { | ||
var result = anObject(this.next.apply(this.iterator, args)); | ||
var result = anObject(apply(this.next, this.iterator, args)); | ||
var done = this.done = !!result.done; | ||
@@ -11,0 +12,0 @@ if (!done) return [this.index++, result.value]; |
@@ -26,3 +26,3 @@ 'use strict'; | ||
var IteratorConstructor = function Iterator() { | ||
anInstance(this, IteratorConstructor); | ||
anInstance(this, IteratorPrototype); | ||
}; | ||
@@ -29,0 +29,0 @@ |
'use strict'; | ||
// https://github.com/tc39/proposal-iterator-helpers | ||
var $ = require('../internals/export'); | ||
var apply = require('../internals/function-apply'); | ||
var call = require('../internals/function-call'); | ||
var anObject = require('../internals/an-object'); | ||
@@ -14,7 +16,7 @@ var toPositiveInteger = require('../internals/to-positive-integer'); | ||
this.remaining--; | ||
result = anObject(next.call(iterator)); | ||
result = anObject(call(next, iterator)); | ||
done = this.done = !!result.done; | ||
if (done) return; | ||
} | ||
result = anObject(next.apply(iterator, args)); | ||
result = anObject(apply(next, iterator, args)); | ||
done = this.done = !!result.done; | ||
@@ -21,0 +23,0 @@ if (!done) return result.value; |
'use strict'; | ||
// https://github.com/tc39/proposal-iterator-helpers | ||
var $ = require('../internals/export'); | ||
var apply = require('../internals/function-apply'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -15,3 +16,3 @@ var anObject = require('../internals/an-object'); | ||
while (true) { | ||
result = anObject(next.apply(iterator, args)); | ||
result = anObject(apply(next, iterator, args)); | ||
done = this.done = !!result.done; | ||
@@ -18,0 +19,0 @@ if (done) return; |
'use strict'; | ||
// https://github.com/tc39/proposal-iterator-helpers | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -10,2 +12,4 @@ var anObject = require('../internals/an-object'); | ||
var TypeError = global.TypeError; | ||
var IteratorProxy = createIteratorProxy(function () { | ||
@@ -19,3 +23,3 @@ var iterator = this.iterator; | ||
if (innerIterator = this.innerIterator) { | ||
result = anObject(this.innerNext.call(innerIterator)); | ||
result = anObject(call(this.innerNext, innerIterator)); | ||
if (!result.done) return result.value; | ||
@@ -25,3 +29,3 @@ this.innerIterator = this.innerNext = null; | ||
result = anObject(this.next.call(iterator)); | ||
result = anObject(call(this.next, iterator)); | ||
@@ -37,3 +41,3 @@ if (this.done = !!result.done) return; | ||
this.innerIterator = innerIterator = anObject(iteratorMethod.call(mapped)); | ||
this.innerIterator = innerIterator = anObject(call(iteratorMethod, mapped)); | ||
this.innerNext = aCallable(innerIterator.next); | ||
@@ -40,0 +44,0 @@ } catch (error) { |
// https://github.com/tc39/proposal-iterator-helpers | ||
var $ = require('../internals/export'); | ||
var apply = require('../internals/function-apply'); | ||
var anObject = require('../internals/an-object'); | ||
var toObject = require('../internals/to-object'); | ||
var isPrototypeOf = require('../internals/object-is-prototype-of'); | ||
var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype; | ||
@@ -10,6 +12,4 @@ var createIteratorProxy = require('../internals/iterator-create-proxy'); | ||
var isPrototypeOf = {}.isPrototypeOf; | ||
var IteratorProxy = createIteratorProxy(function (args) { | ||
var result = anObject(this.next.apply(this.iterator, args)); | ||
var result = anObject(apply(this.next, this.iterator, args)); | ||
var done = this.done = !!result.done; | ||
@@ -26,3 +26,3 @@ if (!done) return result.value; | ||
iterator = getIterator(object, usingIterator); | ||
if (isPrototypeOf.call(IteratorPrototype, iterator)) return iterator; | ||
if (isPrototypeOf(IteratorPrototype, iterator)) return iterator; | ||
} else { | ||
@@ -29,0 +29,0 @@ iterator = object; |
'use strict'; | ||
// https://github.com/tc39/proposal-iterator-helpers | ||
var $ = require('../internals/export'); | ||
var apply = require('../internals/function-apply'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -11,3 +12,3 @@ var anObject = require('../internals/an-object'); | ||
var iterator = this.iterator; | ||
var result = anObject(this.next.apply(iterator, args)); | ||
var result = anObject(apply(this.next, iterator, args)); | ||
var done = this.done = !!result.done; | ||
@@ -14,0 +15,0 @@ if (!done) return callWithSafeIterationClosing(iterator, this.mapper, result.value); |
'use strict'; | ||
// https://github.com/tc39/proposal-iterator-helpers | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var iterate = require('../internals/iterate'); | ||
@@ -8,2 +9,4 @@ var aCallable = require('../internals/a-callable'); | ||
var TypeError = global.TypeError; | ||
$({ target: 'Iterator', proto: true, real: true }, { | ||
@@ -10,0 +13,0 @@ reduce: function reduce(reducer /* , initialValue */) { |
'use strict'; | ||
// https://github.com/tc39/proposal-iterator-helpers | ||
var $ = require('../internals/export'); | ||
var apply = require('../internals/function-apply'); | ||
var anObject = require('../internals/an-object'); | ||
@@ -15,3 +16,3 @@ var toPositiveInteger = require('../internals/to-positive-integer'); | ||
} | ||
var result = anObject(this.next.apply(iterator, args)); | ||
var result = anObject(apply(this.next, iterator, args)); | ||
var done = this.done = !!result.done; | ||
@@ -18,0 +19,0 @@ if (!done) return result.value; |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var collectionDeleteAll = require('../internals/collection-delete-all'); | ||
var deleteAll = require('../internals/collection-delete-all'); | ||
@@ -9,5 +9,3 @@ // `Map.prototype.deleteAll` method | ||
$({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { | ||
deleteAll: function deleteAll(/* ...elements */) { | ||
return collectionDeleteAll.apply(this, arguments); | ||
} | ||
deleteAll: deleteAll | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $emplace = require('../internals/map-emplace'); | ||
var emplace = require('../internals/map-emplace'); | ||
@@ -9,3 +9,3 @@ // `Map.prototype.emplace` method | ||
$({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { | ||
emplace: $emplace | ||
emplace: emplace | ||
}); |
@@ -15,3 +15,3 @@ 'use strict'; | ||
var iterator = getMapIterator(map); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); | ||
return !iterate(iterator, function (key, value, stop) { | ||
@@ -18,0 +18,0 @@ if (!boundFunction(value, key, map)) return stop(); |
'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var bind = require('../internals/function-bind-context'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
var anObject = require('../internals/an-object'); | ||
var bind = require('../internals/function-bind-context'); | ||
var speciesConstructor = require('../internals/species-constructor'); | ||
@@ -18,7 +19,7 @@ var getMapIterator = require('../internals/get-map-iterator'); | ||
var iterator = getMapIterator(map); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); | ||
var newMap = new (speciesConstructor(map, getBuiltIn('Map')))(); | ||
var setter = aCallable(newMap.set); | ||
iterate(iterator, function (key, value) { | ||
if (boundFunction(value, key, map)) setter.call(newMap, key, value); | ||
if (boundFunction(value, key, map)) call(setter, newMap, key, value); | ||
}, { AS_ENTRIES: true, IS_ITERATOR: true }); | ||
@@ -25,0 +26,0 @@ return newMap; |
@@ -15,3 +15,3 @@ 'use strict'; | ||
var iterator = getMapIterator(map); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); | ||
return iterate(iterator, function (key, value, stop) { | ||
@@ -18,0 +18,0 @@ if (boundFunction(value, key, map)) return stop(key); |
@@ -15,3 +15,3 @@ 'use strict'; | ||
var iterator = getMapIterator(map); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); | ||
return iterate(iterator, function (key, value, stop) { | ||
@@ -18,0 +18,0 @@ if (boundFunction(value, key, map)) return stop(value); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var call = require('../internals/function-call'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -7,2 +9,4 @@ var getIterator = require('../internals/get-iterator'); | ||
var push = uncurryThis([].push); | ||
// `Map.groupBy` method | ||
@@ -20,4 +24,4 @@ // https://github.com/tc39/proposal-collection-methods | ||
var derivedKey = keyDerivative(element); | ||
if (!has.call(newMap, derivedKey)) set.call(newMap, derivedKey, [element]); | ||
else get.call(newMap, derivedKey).push(element); | ||
if (!call(has, newMap, derivedKey)) call(set, newMap, derivedKey, [element]); | ||
else push(call(get, newMap, derivedKey), element); | ||
}, { IS_ITERATOR: true }); | ||
@@ -24,0 +28,0 @@ return newMap; |
'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var anObject = require('../internals/an-object'); | ||
@@ -5,0 +5,0 @@ var getMapIterator = require('../internals/get-map-iterator'); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var call = require('../internals/function-call'); | ||
var iterate = require('../internals/iterate'); | ||
@@ -14,3 +15,3 @@ var aCallable = require('../internals/a-callable'); | ||
iterate(iterable, function (element) { | ||
setter.call(newMap, keyDerivative(element), element); | ||
call(setter, newMap, keyDerivative(element), element); | ||
}); | ||
@@ -17,0 +18,0 @@ return newMap; |
'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var bind = require('../internals/function-bind-context'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
var anObject = require('../internals/an-object'); | ||
var bind = require('../internals/function-bind-context'); | ||
var speciesConstructor = require('../internals/species-constructor'); | ||
@@ -18,7 +19,7 @@ var getMapIterator = require('../internals/get-map-iterator'); | ||
var iterator = getMapIterator(map); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); | ||
var newMap = new (speciesConstructor(map, getBuiltIn('Map')))(); | ||
var setter = aCallable(newMap.set); | ||
iterate(iterator, function (key, value) { | ||
setter.call(newMap, boundFunction(value, key, map), value); | ||
call(setter, newMap, boundFunction(value, key, map), value); | ||
}, { AS_ENTRIES: true, IS_ITERATOR: true }); | ||
@@ -25,0 +26,0 @@ return newMap; |
'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var bind = require('../internals/function-bind-context'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
var anObject = require('../internals/an-object'); | ||
var bind = require('../internals/function-bind-context'); | ||
var speciesConstructor = require('../internals/species-constructor'); | ||
@@ -18,7 +19,7 @@ var getMapIterator = require('../internals/get-map-iterator'); | ||
var iterator = getMapIterator(map); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); | ||
var newMap = new (speciesConstructor(map, getBuiltIn('Map')))(); | ||
var setter = aCallable(newMap.set); | ||
iterate(iterator, function (key, value) { | ||
setter.call(newMap, key, boundFunction(value, key, map)); | ||
call(setter, newMap, key, boundFunction(value, key, map)); | ||
}, { AS_ENTRIES: true, IS_ITERATOR: true }); | ||
@@ -25,0 +26,0 @@ return newMap; |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
@@ -9,2 +10,4 @@ var anObject = require('../internals/an-object'); | ||
var TypeError = global.TypeError; | ||
// `Map.prototype.reduce` method | ||
@@ -11,0 +14,0 @@ // https://github.com/tc39/proposal-collection-methods |
@@ -15,3 +15,3 @@ 'use strict'; | ||
var iterator = getMapIterator(map); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); | ||
return iterate(iterator, function (key, value, stop) { | ||
@@ -18,0 +18,0 @@ if (boundFunction(value, key, map)) return stop(); |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $upsert = require('../internals/map-upsert'); | ||
var upsert = require('../internals/map-upsert'); | ||
@@ -11,3 +11,3 @@ // `Map.prototype.updateOrInsert` method (replaced by `Map.prototype.emplace`) | ||
$({ target: 'Map', proto: true, real: true, name: 'upsert', forced: IS_PURE }, { | ||
updateOrInsert: $upsert | ||
updateOrInsert: upsert | ||
}); |
'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var global = require('../internals/global'); | ||
var call = require('../internals/function-call'); | ||
var anObject = require('../internals/an-object'); | ||
var aCallable = require('../internals/a-callable'); | ||
var TypeError = global.TypeError; | ||
// `Set.prototype.update` method | ||
@@ -12,12 +16,15 @@ // https://github.com/tc39/proposal-collection-methods | ||
var map = anObject(this); | ||
var get = aCallable(map.get); | ||
var has = aCallable(map.has); | ||
var set = aCallable(map.set); | ||
var length = arguments.length; | ||
aCallable(callback); | ||
var isPresentInMap = map.has(key); | ||
var isPresentInMap = call(has, map, key); | ||
if (!isPresentInMap && length < 3) { | ||
throw TypeError('Updating absent value'); | ||
} | ||
var value = isPresentInMap ? map.get(key) : aCallable(length > 2 ? arguments[2] : undefined)(key, map); | ||
map.set(key, callback(value, key, map)); | ||
var value = isPresentInMap ? call(get, map, key) : aCallable(length > 2 ? arguments[2] : undefined)(key, map); | ||
call(set, map, key, callback(value, key, map)); | ||
return map; | ||
} | ||
}); |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $upsert = require('../internals/map-upsert'); | ||
var upsert = require('../internals/map-upsert'); | ||
@@ -11,3 +11,3 @@ // `Map.prototype.upsert` method (replaced by `Map.prototype.emplace`) | ||
$({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { | ||
upsert: $upsert | ||
upsert: upsert | ||
}); |
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var anObject = require('../internals/an-object'); | ||
@@ -9,5 +10,6 @@ var numberIsFinite = require('../internals/number-is-finite'); | ||
var SEEDED_RANDOM_GENERATOR = SEEDED_RANDOM + ' Generator'; | ||
var SEED_TYPE_ERROR = 'Math.seededPRNG() argument should have a "seed" field with a finite value.'; | ||
var setInternalState = InternalStateModule.set; | ||
var getInternalState = InternalStateModule.getterFor(SEEDED_RANDOM_GENERATOR); | ||
var SEED_TYPE_ERROR = 'Math.seededPRNG() argument should have a "seed" field with a finite value.'; | ||
var TypeError = global.TypeError; | ||
@@ -14,0 +16,0 @@ var $SeededRandomGenerator = createIteratorConstructor(function SeededRandomGenerator(seed) { |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity'); | ||
@@ -8,3 +10,10 @@ var parseInt = require('../internals/number-parse-int'); | ||
var INVALID_RADIX = 'Invalid radix'; | ||
var RangeError = global.RangeError; | ||
var SyntaxError = global.SyntaxError; | ||
var TypeError = global.TypeError; | ||
var valid = /^[\da-z]+$/; | ||
var charAt = uncurryThis(''.charAt); | ||
var exec = uncurryThis(valid.exec); | ||
var numberToString = uncurryThis(1.0.toString); | ||
var stringSlice = uncurryThis(''.slice); | ||
@@ -19,5 +28,5 @@ // `Number.fromString` method | ||
if (!string.length) throw SyntaxError(INVALID_NUMBER_REPRESENTATION); | ||
if (string.charAt(0) == '-') { | ||
if (charAt(string, 0) == '-') { | ||
sign = -1; | ||
string = string.slice(1); | ||
string = stringSlice(string, 1); | ||
if (!string.length) throw SyntaxError(INVALID_NUMBER_REPRESENTATION); | ||
@@ -27,3 +36,3 @@ } | ||
if (R < 2 || R > 36) throw RangeError(INVALID_RADIX); | ||
if (!valid.test(string) || (mathNum = parseInt(string, R)).toString(R) !== string) { | ||
if (!exec(valid, string) || numberToString(mathNum = parseInt(string, R), R) !== string) { | ||
throw SyntaxError(INVALID_NUMBER_REPRESENTATION); | ||
@@ -30,0 +39,0 @@ } |
'use strict'; | ||
// https://github.com/tc39/proposal-observable | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var call = require('../internals/function-call'); | ||
var DESCRIPTORS = require('../internals/descriptors'); | ||
@@ -25,2 +27,3 @@ var setSpecies = require('../internals/set-species'); | ||
var setInternalState = InternalStateModule.set; | ||
var Array = global.Array; | ||
@@ -61,3 +64,3 @@ var cleanupSubscription = function (subscriptionState) { | ||
try { | ||
if (start = getMethod(observer, 'start')) start.call(observer, this); | ||
if (start = getMethod(observer, 'start')) call(start, observer, this); | ||
} catch (error) { | ||
@@ -109,3 +112,3 @@ hostReportErrors(error); | ||
var nextMethod = getMethod(observer, 'next'); | ||
if (nextMethod) nextMethod.call(observer, value); | ||
if (nextMethod) call(nextMethod, observer, value); | ||
} catch (error) { | ||
@@ -123,3 +126,3 @@ hostReportErrors(error); | ||
var errorMethod = getMethod(observer, 'error'); | ||
if (errorMethod) errorMethod.call(observer, value); | ||
if (errorMethod) call(errorMethod, observer, value); | ||
else hostReportErrors(value); | ||
@@ -138,3 +141,3 @@ } catch (err) { | ||
var completeMethod = getMethod(observer, 'complete'); | ||
if (completeMethod) completeMethod.call(observer); | ||
if (completeMethod) call(completeMethod, observer); | ||
} catch (error) { | ||
@@ -155,7 +158,9 @@ hostReportErrors(error); | ||
var $Observable = function Observable(subscriber) { | ||
anInstance(this, $Observable, 'Observable'); | ||
anInstance(this, ObservablePrototype); | ||
setInternalState(this, { subscriber: aCallable(subscriber) }); | ||
}; | ||
redefineAll($Observable.prototype, { | ||
var ObservablePrototype = $Observable.prototype; | ||
redefineAll(ObservablePrototype, { | ||
subscribe: function subscribe(observer) { | ||
@@ -176,3 +181,3 @@ var length = arguments.length; | ||
if (observableMethod) { | ||
var observable = anObject(observableMethod.call(x)); | ||
var observable = anObject(call(observableMethod, x)); | ||
return observable.constructor === C ? observable : new C(function (observer) { | ||
@@ -194,3 +199,3 @@ return observable.subscribe(observer); | ||
var length = arguments.length; | ||
var items = new Array(length); | ||
var items = Array(length); | ||
var index = 0; | ||
@@ -207,3 +212,3 @@ while (index < length) items[index] = arguments[index++]; | ||
redefine($Observable.prototype, OBSERVABLE, function () { return this; }); | ||
redefine(ObservablePrototype, OBSERVABLE, function () { return this; }); | ||
@@ -210,0 +215,0 @@ $({ global: true }, { |
var $ = require('../internals/export'); | ||
// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` | ||
var Set = require('../modules/es.set'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var ReflectMetadataModule = require('../internals/reflect-metadata'); | ||
var anObject = require('../internals/an-object'); | ||
var getPrototypeOf = require('../internals/object-get-prototype-of'); | ||
var iterate = require('../internals/iterate'); | ||
var $arrayUniqueBy = require('../internals/array-unique-by'); | ||
var arrayUniqueBy = uncurryThis($arrayUniqueBy); | ||
var concat = uncurryThis([].concat); | ||
var ordinaryOwnMetadataKeys = ReflectMetadataModule.keys; | ||
var toMetadataKey = ReflectMetadataModule.toKey; | ||
var from = function (iter) { | ||
var result = []; | ||
iterate(iter, result.push, { that: result }); | ||
return result; | ||
}; | ||
var ordinaryMetadataKeys = function (O, P) { | ||
@@ -23,3 +18,3 @@ var oKeys = ordinaryOwnMetadataKeys(O, P); | ||
var pKeys = ordinaryMetadataKeys(parent, P); | ||
return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys; | ||
return pKeys.length ? oKeys.length ? arrayUniqueBy(concat(oKeys, pKeys)) : pKeys : oKeys; | ||
}; | ||
@@ -26,0 +21,0 @@ |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var collectionAddAll = require('../internals/collection-add-all'); | ||
var addAll = require('../internals/collection-add-all'); | ||
@@ -9,5 +9,3 @@ // `Set.prototype.addAll` method | ||
$({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { | ||
addAll: function addAll(/* ...elements */) { | ||
return collectionAddAll.apply(this, arguments); | ||
} | ||
addAll: addAll | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var collectionDeleteAll = require('../internals/collection-delete-all'); | ||
var deleteAll = require('../internals/collection-delete-all'); | ||
@@ -9,5 +9,3 @@ // `Set.prototype.deleteAll` method | ||
$({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { | ||
deleteAll: function deleteAll(/* ...elements */) { | ||
return collectionDeleteAll.apply(this, arguments); | ||
} | ||
deleteAll: deleteAll | ||
}); |
'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -18,3 +19,3 @@ var anObject = require('../internals/an-object'); | ||
iterate(iterable, function (value) { | ||
remover.call(newSet, value); | ||
call(remover, newSet, value); | ||
}); | ||
@@ -21,0 +22,0 @@ return newSet; |
@@ -15,3 +15,3 @@ 'use strict'; | ||
var iterator = getSetIterator(set); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); | ||
return !iterate(iterator, function (value, stop) { | ||
@@ -18,0 +18,0 @@ if (!boundFunction(value, value, set)) return stop(); |
'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -18,7 +19,7 @@ var anObject = require('../internals/an-object'); | ||
var iterator = getSetIterator(set); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); | ||
var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(); | ||
var adder = aCallable(newSet.add); | ||
iterate(iterator, function (value) { | ||
if (boundFunction(value, value, set)) adder.call(newSet, value); | ||
if (boundFunction(value, value, set)) call(adder, newSet, value); | ||
}, { IS_ITERATOR: true }); | ||
@@ -25,0 +26,0 @@ return newSet; |
@@ -15,3 +15,3 @@ 'use strict'; | ||
var iterator = getSetIterator(set); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); | ||
return iterate(iterator, function (value, stop) { | ||
@@ -18,0 +18,0 @@ if (boundFunction(value, value, set)) return stop(value); |
'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -19,3 +20,3 @@ var anObject = require('../internals/an-object'); | ||
iterate(iterable, function (value) { | ||
if (hasCheck.call(set, value)) adder.call(newSet, value); | ||
if (call(hasCheck, set, value)) call(adder, newSet, value); | ||
}); | ||
@@ -22,0 +23,0 @@ return newSet; |
'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -15,5 +16,5 @@ var anObject = require('../internals/an-object'); | ||
return !iterate(iterable, function (value, stop) { | ||
if (hasCheck.call(set, value) === true) return stop(); | ||
if (call(hasCheck, set, value) === true) return stop(); | ||
}, { INTERRUPTED: true }).stopped; | ||
} | ||
}); |
'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -23,5 +24,5 @@ var isCallable = require('../internals/is-callable'); | ||
return !iterate(iterator, function (value, stop) { | ||
if (hasCheck.call(otherSet, value) === false) return stop(); | ||
if (call(hasCheck, otherSet, value) === false) return stop(); | ||
}, { IS_ITERATOR: true, INTERRUPTED: true }).stopped; | ||
} | ||
}); |
'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -15,5 +16,5 @@ var anObject = require('../internals/an-object'); | ||
return !iterate(iterable, function (value, stop) { | ||
if (hasCheck.call(set, value) === false) return stop(); | ||
if (call(hasCheck, set, value) === false) return stop(); | ||
}, { INTERRUPTED: true }).stopped; | ||
} | ||
}); |
'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var anObject = require('../internals/an-object'); | ||
var toString = require('../internals/to-string'); | ||
var getSetIterator = require('../internals/get-set-iterator'); | ||
var iterate = require('../internals/iterate'); | ||
var arrayJoin = uncurryThis([].join); | ||
var push = [].push; | ||
// `Set.prototype.join` method | ||
@@ -14,7 +19,7 @@ // https://github.com/tc39/proposal-collection-methods | ||
var iterator = getSetIterator(set); | ||
var sep = separator === undefined ? ',' : String(separator); | ||
var sep = separator === undefined ? ',' : toString(separator); | ||
var result = []; | ||
iterate(iterator, result.push, { that: result, IS_ITERATOR: true }); | ||
return result.join(sep); | ||
iterate(iterator, push, { that: result, IS_ITERATOR: true }); | ||
return arrayJoin(result, sep); | ||
} | ||
}); |
'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var bind = require('../internals/function-bind-context'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
var anObject = require('../internals/an-object'); | ||
var bind = require('../internals/function-bind-context'); | ||
var speciesConstructor = require('../internals/species-constructor'); | ||
@@ -18,7 +19,7 @@ var getSetIterator = require('../internals/get-set-iterator'); | ||
var iterator = getSetIterator(set); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); | ||
var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(); | ||
var adder = aCallable(newSet.add); | ||
iterate(iterator, function (value) { | ||
adder.call(newSet, boundFunction(value, value, set)); | ||
call(adder, newSet, boundFunction(value, value, set)); | ||
}, { IS_ITERATOR: true }); | ||
@@ -25,0 +26,0 @@ return newSet; |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
@@ -9,2 +10,4 @@ var aCallable = require('../internals/a-callable'); | ||
var TypeError = global.TypeError; | ||
// `Set.prototype.reduce` method | ||
@@ -11,0 +14,0 @@ // https://github.com/tc39/proposal-collection-methods |
@@ -15,3 +15,3 @@ 'use strict'; | ||
var iterator = getSetIterator(set); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); | ||
return iterate(iterator, function (value, stop) { | ||
@@ -18,0 +18,0 @@ if (boundFunction(value, value, set)) return stop(); |
'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
@@ -19,3 +20,3 @@ var anObject = require('../internals/an-object'); | ||
iterate(iterable, function (value) { | ||
remover.call(newSet, value) || adder.call(newSet, value); | ||
call(remover, newSet, value) || call(adder, newSet, value); | ||
}); | ||
@@ -22,0 +23,0 @@ return newSet; |
@@ -14,3 +14,2 @@ 'use strict'; | ||
// https://github.com/tc39/proposal-array-from-async | ||
// eslint-disable-next-line -- required for .length | ||
exportTypedArrayStaticMethod('fromAsync', function fromAsync(asyncItems /* , mapfn = undefined, thisArg = undefined */) { | ||
@@ -17,0 +16,0 @@ var C = this; |
'use strict'; | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); | ||
var arrayUniqueBy = require('../internals/array-unique-by'); | ||
var $arrayUniqueBy = require('../internals/array-unique-by'); | ||
var fromSpeciesAndList = require('../internals/typed-array-from-species-and-list'); | ||
@@ -8,2 +9,3 @@ | ||
var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; | ||
var arrayUniqueBy = uncurryThis($arrayUniqueBy); | ||
@@ -13,3 +15,3 @@ // `%TypedArray%.prototype.uniqueBy` method | ||
exportTypedArrayMethod('uniqueBy', function uniqueBy(resolver) { | ||
return fromSpeciesAndList(this, arrayUniqueBy.call(aTypedArray(this), resolver)); | ||
return fromSpeciesAndList(this, arrayUniqueBy(aTypedArray(this), resolver)); | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var collectionDeleteAll = require('../internals/collection-delete-all'); | ||
var deleteAll = require('../internals/collection-delete-all'); | ||
@@ -9,5 +9,3 @@ // `WeakMap.prototype.deleteAll` method | ||
$({ target: 'WeakMap', proto: true, real: true, forced: IS_PURE }, { | ||
deleteAll: function deleteAll(/* ...elements */) { | ||
return collectionDeleteAll.apply(this, arguments); | ||
} | ||
deleteAll: deleteAll | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $emplace = require('../internals/map-emplace'); | ||
var emplace = require('../internals/map-emplace'); | ||
@@ -9,3 +9,3 @@ // `WeakMap.prototype.emplace` method | ||
$({ target: 'WeakMap', proto: true, real: true, forced: IS_PURE }, { | ||
emplace: $emplace | ||
emplace: emplace | ||
}); |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var IS_PURE = require('../internals/is-pure'); | ||
var $upsert = require('../internals/map-upsert'); | ||
var upsert = require('../internals/map-upsert'); | ||
@@ -11,3 +11,3 @@ // `WeakMap.prototype.upsert` method (replaced by `WeakMap.prototype.emplace`) | ||
$({ target: 'WeakMap', proto: true, real: true, forced: IS_PURE }, { | ||
upsert: $upsert | ||
upsert: upsert | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var collectionAddAll = require('../internals/collection-add-all'); | ||
var addAll = require('../internals/collection-add-all'); | ||
@@ -9,5 +9,3 @@ // `WeakSet.prototype.addAll` method | ||
$({ target: 'WeakSet', proto: true, real: true, forced: IS_PURE }, { | ||
addAll: function addAll(/* ...elements */) { | ||
return collectionAddAll.apply(this, arguments); | ||
} | ||
addAll: addAll | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var IS_PURE = require('../internals/is-pure'); | ||
var collectionDeleteAll = require('../internals/collection-delete-all'); | ||
var deleteAll = require('../internals/collection-delete-all'); | ||
@@ -9,5 +9,3 @@ // `WeakSet.prototype.deleteAll` method | ||
$({ target: 'WeakSet', proto: true, real: true, forced: IS_PURE }, { | ||
deleteAll: function deleteAll(/* ...elements */) { | ||
return collectionDeleteAll.apply(this, arguments); | ||
} | ||
deleteAll: deleteAll | ||
}); |
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var apply = require('../internals/function-apply'); | ||
var isCallable = require('../internals/is-callable'); | ||
var userAgent = require('../internals/engine-user-agent'); | ||
var arraySlice = require('../internals/array-slice'); | ||
var slice = [].slice; | ||
var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check | ||
var Function = global.Function; | ||
@@ -12,6 +14,5 @@ var wrap = function (scheduler) { | ||
var boundArgs = arguments.length > 2; | ||
var args = boundArgs ? slice.call(arguments, 2) : undefined; | ||
var args = boundArgs ? arraySlice(arguments, 2) : undefined; | ||
return scheduler(boundArgs ? function () { | ||
// eslint-disable-next-line no-new-func -- spec requirement | ||
(isCallable(handler) ? handler : Function(handler)).apply(this, args); | ||
apply(isCallable(handler) ? handler : Function(handler), this, args); | ||
} : handler, timeout); | ||
@@ -18,0 +19,0 @@ }; |
@@ -5,3 +5,6 @@ 'use strict'; | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var call = require('../internals/function-call'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var USE_NATIVE_URL = require('../internals/native-url'); | ||
@@ -26,7 +29,4 @@ var redefine = require('../internals/redefine'); | ||
var wellKnownSymbol = require('../internals/well-known-symbol'); | ||
var arraySort = require('../internals/array-sort'); | ||
var nativeFetch = getBuiltIn('fetch'); | ||
var NativeRequest = getBuiltIn('Request'); | ||
var RequestPrototype = NativeRequest && NativeRequest.prototype; | ||
var Headers = getBuiltIn('Headers'); | ||
var ITERATOR = wellKnownSymbol('iterator'); | ||
@@ -39,2 +39,20 @@ var URL_SEARCH_PARAMS = 'URLSearchParams'; | ||
var n$Fetch = getBuiltIn('fetch'); | ||
var N$Request = getBuiltIn('Request'); | ||
var Headers = getBuiltIn('Headers'); | ||
var RequestPrototype = N$Request && N$Request.prototype; | ||
var HeadersPrototype = Headers && Headers.prototype; | ||
var RegExp = global.RegExp; | ||
var TypeError = global.TypeError; | ||
var decodeURIComponent = global.decodeURIComponent; | ||
var encodeURIComponent = global.encodeURIComponent; | ||
var charAt = uncurryThis(''.charAt); | ||
var join = uncurryThis([].join); | ||
var push = uncurryThis([].push); | ||
var replace = uncurryThis(''.replace); | ||
var shift = uncurryThis([].shift); | ||
var splice = uncurryThis([].splice); | ||
var split = uncurryThis(''.split); | ||
var stringSlice = uncurryThis(''.slice); | ||
var plus = /\+/g; | ||
@@ -56,3 +74,3 @@ var sequences = Array(4); | ||
var deserialize = function (it) { | ||
var result = it.replace(plus, ' '); | ||
var result = replace(it, plus, ' '); | ||
var bytes = 4; | ||
@@ -63,3 +81,3 @@ try { | ||
while (bytes) { | ||
result = result.replace(percentSequence(bytes--), percentDecode); | ||
result = replace(result, percentSequence(bytes--), percentDecode); | ||
} | ||
@@ -72,3 +90,3 @@ return result; | ||
var replace = { | ||
var replacements = { | ||
'!': '%21', | ||
@@ -83,7 +101,7 @@ "'": '%27', | ||
var replacer = function (match) { | ||
return replace[match]; | ||
return replacements[match]; | ||
}; | ||
var serialize = function (it) { | ||
return encodeURIComponent(it).replace(find, replacer); | ||
return replace(encodeURIComponent(it), find, replacer); | ||
}; | ||
@@ -93,3 +111,3 @@ | ||
if (query) { | ||
var attributes = query.split('&'); | ||
var attributes = split(query, '&'); | ||
var index = 0; | ||
@@ -100,6 +118,6 @@ var attribute, entry; | ||
if (attribute.length) { | ||
entry = attribute.split('='); | ||
result.push({ | ||
key: deserialize(entry.shift()), | ||
value: deserialize(entry.join('=')) | ||
entry = split(attribute, '='); | ||
push(result, { | ||
key: deserialize(shift(entry)), | ||
value: deserialize(join(entry, '=')) | ||
}); | ||
@@ -139,3 +157,3 @@ } | ||
var URLSearchParamsConstructor = function URLSearchParams(/* init */) { | ||
anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS); | ||
anInstance(this, URLSearchParamsPrototype); | ||
var init = arguments.length > 0 ? arguments[0] : undefined; | ||
@@ -159,17 +177,17 @@ var that = this; | ||
next = iterator.next; | ||
while (!(step = next.call(iterator)).done) { | ||
while (!(step = call(next, iterator)).done) { | ||
entryIterator = getIterator(anObject(step.value)); | ||
entryNext = entryIterator.next; | ||
if ( | ||
(first = entryNext.call(entryIterator)).done || | ||
(second = entryNext.call(entryIterator)).done || | ||
!entryNext.call(entryIterator).done | ||
(first = call(entryNext, entryIterator)).done || | ||
(second = call(entryNext, entryIterator)).done || | ||
!call(entryNext, entryIterator).done | ||
) throw TypeError('Expected sequence with length 2'); | ||
entries.push({ key: $toString(first.value), value: $toString(second.value) }); | ||
push(entries, { key: $toString(first.value), value: $toString(second.value) }); | ||
} | ||
} else for (key in init) if (hasOwn(init, key)) entries.push({ key: key, value: $toString(init[key]) }); | ||
} else for (key in init) if (hasOwn(init, key)) push(entries, { key: key, value: $toString(init[key]) }); | ||
} else { | ||
parseSearchParams( | ||
entries, | ||
typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : $toString(init) | ||
typeof init == 'string' ? charAt(init, 0) === '?' ? stringSlice(init, 1) : init : $toString(init) | ||
); | ||
@@ -188,3 +206,3 @@ } | ||
var state = getInternalParamsState(this); | ||
state.entries.push({ key: $toString(name), value: $toString(value) }); | ||
push(state.entries, { key: $toString(name), value: $toString(value) }); | ||
state.updateURL(); | ||
@@ -201,3 +219,3 @@ }, | ||
while (index < entries.length) { | ||
if (entries[index].key === key) entries.splice(index, 1); | ||
if (entries[index].key === key) splice(entries, index, 1); | ||
else index++; | ||
@@ -228,3 +246,3 @@ } | ||
for (; index < entries.length; index++) { | ||
if (entries[index].key === key) result.push(entries[index].value); | ||
if (entries[index].key === key) push(result, entries[index].value); | ||
} | ||
@@ -259,3 +277,3 @@ return result; | ||
if (entry.key === key) { | ||
if (found) entries.splice(index--, 1); | ||
if (found) splice(entries, index--, 1); | ||
else { | ||
@@ -267,3 +285,3 @@ found = true; | ||
} | ||
if (!found) entries.push({ key: key, value: val }); | ||
if (!found) push(entries, { key: key, value: val }); | ||
state.updateURL(); | ||
@@ -275,17 +293,5 @@ }, | ||
var state = getInternalParamsState(this); | ||
var entries = state.entries; | ||
// Array#sort is not stable in some engines | ||
var slice = entries.slice(); | ||
var entry, entriesIndex, sliceIndex; | ||
entries.length = 0; | ||
for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) { | ||
entry = slice[sliceIndex]; | ||
for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) { | ||
if (entries[entriesIndex].key > entry.key) { | ||
entries.splice(entriesIndex, 0, entry); | ||
break; | ||
} | ||
} | ||
if (entriesIndex === sliceIndex) entries.push(entry); | ||
} | ||
arraySort(state.entries, function (a, b) { | ||
return a.key > b.key ? 1 : -1; | ||
}); | ||
state.updateURL(); | ||
@@ -296,3 +302,3 @@ }, | ||
var entries = getInternalParamsState(this).entries; | ||
var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined, 3); | ||
var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined); | ||
var index = 0; | ||
@@ -331,4 +337,4 @@ var entry; | ||
entry = entries[index++]; | ||
result.push(serialize(entry.key) + '=' + serialize(entry.value)); | ||
} return result.join('&'); | ||
push(result, serialize(entry.key) + '=' + serialize(entry.value)); | ||
} return join(result, '&'); | ||
}, { enumerable: true }); | ||
@@ -344,2 +350,5 @@ | ||
if (!USE_NATIVE_URL && isCallable(Headers)) { | ||
var headersHas = uncurryThis(HeadersPrototype.has); | ||
var headersSet = uncurryThis(HeadersPrototype.set); | ||
var wrapRequestOptions = function (init) { | ||
@@ -351,7 +360,7 @@ if (isObject(init)) { | ||
headers = init.headers ? new Headers(init.headers) : new Headers(); | ||
if (!headers.has('content-type')) { | ||
headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); | ||
if (!headersHas(headers, 'content-type')) { | ||
headersSet(headers, 'content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); | ||
} | ||
return create(init, { | ||
body: createPropertyDescriptor(0, String(body)), | ||
body: createPropertyDescriptor(0, $toString(body)), | ||
headers: createPropertyDescriptor(0, headers) | ||
@@ -363,6 +372,6 @@ }); | ||
if (isCallable(nativeFetch)) { | ||
if (isCallable(n$Fetch)) { | ||
$({ global: true, enumerable: true, forced: true }, { | ||
fetch: function fetch(input /* , init */) { | ||
return nativeFetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); | ||
return n$Fetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); | ||
} | ||
@@ -372,6 +381,6 @@ }); | ||
if (isCallable(NativeRequest)) { | ||
if (isCallable(N$Request)) { | ||
var RequestConstructor = function Request(input /* , init */) { | ||
anInstance(this, RequestConstructor, 'Request'); | ||
return new NativeRequest(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); | ||
anInstance(this, RequestPrototype); | ||
return new N$Request(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); | ||
}; | ||
@@ -378,0 +387,0 @@ |
@@ -8,2 +8,5 @@ 'use strict'; | ||
var global = require('../internals/global'); | ||
var bind = require('../internals/function-bind-context'); | ||
var call = require('../internals/function-call'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var defineProperties = require('../internals/object-define-properties'); | ||
@@ -15,2 +18,3 @@ var redefine = require('../internals/redefine'); | ||
var arrayFrom = require('../internals/array-from'); | ||
var arraySlice = require('../internals/array-slice'); | ||
var codeAt = require('../internals/string-multibyte').codeAt; | ||
@@ -23,9 +27,24 @@ var toASCII = require('../internals/string-punycode-to-ascii'); | ||
var NativeURL = global.URL; | ||
var setInternalState = InternalStateModule.set; | ||
var getInternalURLState = InternalStateModule.getterFor('URL'); | ||
var URLSearchParams = URLSearchParamsModule.URLSearchParams; | ||
var getInternalSearchParamsState = URLSearchParamsModule.getState; | ||
var setInternalState = InternalStateModule.set; | ||
var getInternalURLState = InternalStateModule.getterFor('URL'); | ||
var NativeURL = global.URL; | ||
var TypeError = global.TypeError; | ||
var parseInt = global.parseInt; | ||
var floor = Math.floor; | ||
var pow = Math.pow; | ||
var charAt = uncurryThis(''.charAt); | ||
var exec = uncurryThis(/./.exec); | ||
var join = uncurryThis([].join); | ||
var numberToString = uncurryThis(1.0.toString); | ||
var pop = uncurryThis([].pop); | ||
var push = uncurryThis([].push); | ||
var replace = uncurryThis(''.replace); | ||
var shift = uncurryThis([].shift); | ||
var split = uncurryThis(''.split); | ||
var stringSlice = uncurryThis(''.slice); | ||
var toLowerCase = uncurryThis(''.toLowerCase); | ||
var unshift = uncurryThis([].unshift); | ||
@@ -55,5 +74,5 @@ var INVALID_AUTHORITY = 'Invalid authority'; | ||
var result, codePoints, index; | ||
if (input.charAt(0) == '[') { | ||
if (input.charAt(input.length - 1) != ']') return INVALID_HOST; | ||
result = parseIPv6(input.slice(1, -1)); | ||
if (charAt(input, 0) == '[') { | ||
if (charAt(input, input.length - 1) != ']') return INVALID_HOST; | ||
result = parseIPv6(stringSlice(input, 1, -1)); | ||
if (!result) return INVALID_HOST; | ||
@@ -63,3 +82,3 @@ url.host = result; | ||
} else if (!isSpecial(url)) { | ||
if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input)) return INVALID_HOST; | ||
if (exec(FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT, input)) return INVALID_HOST; | ||
result = ''; | ||
@@ -73,3 +92,3 @@ codePoints = arrayFrom(input); | ||
input = toASCII(input); | ||
if (FORBIDDEN_HOST_CODE_POINT.test(input)) return INVALID_HOST; | ||
if (exec(FORBIDDEN_HOST_CODE_POINT, input)) return INVALID_HOST; | ||
result = parseIPv4(input); | ||
@@ -82,6 +101,6 @@ if (result === null) return INVALID_HOST; | ||
var parseIPv4 = function (input) { | ||
var parts = input.split('.'); | ||
var parts = split(input, '.'); | ||
var partsLength, numbers, index, part, radix, number, ipv4; | ||
if (parts.length && parts[parts.length - 1] == '') { | ||
parts.pop(); | ||
parts.length--; | ||
} | ||
@@ -95,5 +114,5 @@ partsLength = parts.length; | ||
radix = 10; | ||
if (part.length > 1 && part.charAt(0) == '0') { | ||
radix = HEX_START.test(part) ? 16 : 8; | ||
part = part.slice(radix == 8 ? 1 : 2); | ||
if (part.length > 1 && charAt(part, 0) == '0') { | ||
radix = exec(HEX_START, part) ? 16 : 8; | ||
part = stringSlice(part, radix == 8 ? 1 : 2); | ||
} | ||
@@ -103,6 +122,6 @@ if (part === '') { | ||
} else { | ||
if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part)) return input; | ||
if (!exec(radix == 10 ? DEC : radix == 8 ? OCT : HEX, part)) return input; | ||
number = parseInt(part, radix); | ||
} | ||
numbers.push(number); | ||
push(numbers, number); | ||
} | ||
@@ -115,3 +134,3 @@ for (index = 0; index < partsLength; index++) { | ||
} | ||
ipv4 = numbers.pop(); | ||
ipv4 = pop(numbers); | ||
for (index = 0; index < numbers.length; index++) { | ||
@@ -132,7 +151,7 @@ ipv4 += numbers[index] * pow(256, 3 - index); | ||
var chr = function () { | ||
return input.charAt(pointer); | ||
return charAt(input, pointer); | ||
}; | ||
if (chr() == ':') { | ||
if (input.charAt(1) != ':') return; | ||
if (charAt(input, 1) != ':') return; | ||
pointer += 2; | ||
@@ -152,3 +171,3 @@ pieceIndex++; | ||
value = length = 0; | ||
while (length < 4 && HEX.test(chr())) { | ||
while (length < 4 && exec(HEX, chr())) { | ||
value = value * 16 + parseInt(chr(), 16); | ||
@@ -169,4 +188,4 @@ pointer++; | ||
} | ||
if (!DIGIT.test(chr())) return; | ||
while (DIGIT.test(chr())) { | ||
if (!exec(DIGIT, chr())) return; | ||
while (exec(DIGIT, chr())) { | ||
number = parseInt(chr(), 10); | ||
@@ -235,5 +254,5 @@ if (ipv4Piece === null) ipv4Piece = number; | ||
for (index = 0; index < 4; index++) { | ||
result.unshift(host % 256); | ||
unshift(result, host % 256); | ||
host = floor(host / 256); | ||
} return result.join('.'); | ||
} return join(result, '.'); | ||
// ipv6 | ||
@@ -250,3 +269,3 @@ } else if (typeof host == 'object') { | ||
} else { | ||
result += host[index].toString(16); | ||
result += numberToString(host[index], 16); | ||
if (index < 7) result += ':'; | ||
@@ -298,4 +317,4 @@ } | ||
var second; | ||
return string.length == 2 && ALPHA.test(string.charAt(0)) | ||
&& ((second = string.charAt(1)) == ':' || (!normalized && second == '|')); | ||
return string.length == 2 && exec(ALPHA, charAt(string, 0)) | ||
&& ((second = charAt(string, 1)) == ':' || (!normalized && second == '|')); | ||
}; | ||
@@ -305,5 +324,5 @@ | ||
var third; | ||
return string.length > 1 && isWindowsDriveLetter(string.slice(0, 2)) && ( | ||
return string.length > 1 && isWindowsDriveLetter(stringSlice(string, 0, 2)) && ( | ||
string.length == 2 || | ||
((third = string.charAt(2)) === '/' || third === '\\' || third === '?' || third === '#') | ||
((third = charAt(string, 2)) === '/' || third === '\\' || third === '?' || third === '#') | ||
); | ||
@@ -316,3 +335,3 @@ }; | ||
if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) { | ||
path.pop(); | ||
path.length--; | ||
} | ||
@@ -322,7 +341,7 @@ }; | ||
var isSingleDot = function (segment) { | ||
return segment === '.' || segment.toLowerCase() === '%2e'; | ||
return segment === '.' || toLowerCase(segment) === '%2e'; | ||
}; | ||
var isDoubleDot = function (segment) { | ||
segment = segment.toLowerCase(); | ||
segment = toLowerCase(segment); | ||
return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e'; | ||
@@ -374,6 +393,6 @@ }; | ||
url.cannotBeABaseURL = false; | ||
input = input.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, ''); | ||
input = replace(input, LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, ''); | ||
} | ||
input = input.replace(TAB_AND_NEW_LINE, ''); | ||
input = replace(input, TAB_AND_NEW_LINE, ''); | ||
@@ -386,4 +405,4 @@ codePoints = arrayFrom(input); | ||
case SCHEME_START: | ||
if (chr && ALPHA.test(chr)) { | ||
buffer += chr.toLowerCase(); | ||
if (chr && exec(ALPHA, chr)) { | ||
buffer += toLowerCase(chr); | ||
state = SCHEME; | ||
@@ -397,4 +416,4 @@ } else if (!stateOverride) { | ||
case SCHEME: | ||
if (chr && (ALPHANUMERIC.test(chr) || chr == '+' || chr == '-' || chr == '.')) { | ||
buffer += chr.toLowerCase(); | ||
if (chr && (exec(ALPHANUMERIC, chr) || chr == '+' || chr == '-' || chr == '.')) { | ||
buffer += toLowerCase(chr); | ||
} else if (chr == ':') { | ||
@@ -423,3 +442,3 @@ if (stateOverride && ( | ||
url.cannotBeABaseURL = true; | ||
url.path.push(''); | ||
push(url.path, ''); | ||
state = CANNOT_BE_A_BASE_URL_PATH; | ||
@@ -439,3 +458,3 @@ } | ||
url.scheme = base.scheme; | ||
url.path = base.path.slice(); | ||
url.path = arraySlice(base.path); | ||
url.query = base.query; | ||
@@ -475,3 +494,3 @@ url.fragment = ''; | ||
url.port = base.port; | ||
url.path = base.path.slice(); | ||
url.path = arraySlice(base.path); | ||
url.query = base.query; | ||
@@ -485,3 +504,3 @@ } else if (chr == '/' || (chr == '\\' && isSpecial(url))) { | ||
url.port = base.port; | ||
url.path = base.path.slice(); | ||
url.path = arraySlice(base.path); | ||
url.query = ''; | ||
@@ -494,3 +513,3 @@ state = QUERY; | ||
url.port = base.port; | ||
url.path = base.path.slice(); | ||
url.path = arraySlice(base.path); | ||
url.query = base.query; | ||
@@ -504,4 +523,4 @@ url.fragment = ''; | ||
url.port = base.port; | ||
url.path = base.path.slice(); | ||
url.path.pop(); | ||
url.path = arraySlice(base.path); | ||
url.path.length--; | ||
state = PATH; | ||
@@ -527,3 +546,3 @@ continue; | ||
state = SPECIAL_AUTHORITY_IGNORE_SLASHES; | ||
if (chr != '/' || buffer.charAt(pointer + 1) != '/') continue; | ||
if (chr != '/' || charAt(buffer, pointer + 1) != '/') continue; | ||
pointer++; | ||
@@ -596,3 +615,3 @@ break; | ||
case PORT: | ||
if (DIGIT.test(chr)) { | ||
if (exec(DIGIT, chr)) { | ||
buffer += chr; | ||
@@ -622,7 +641,7 @@ } else if ( | ||
url.host = base.host; | ||
url.path = base.path.slice(); | ||
url.path = arraySlice(base.path); | ||
url.query = base.query; | ||
} else if (chr == '?') { | ||
url.host = base.host; | ||
url.path = base.path.slice(); | ||
url.path = arraySlice(base.path); | ||
url.query = ''; | ||
@@ -632,3 +651,3 @@ state = QUERY; | ||
url.host = base.host; | ||
url.path = base.path.slice(); | ||
url.path = arraySlice(base.path); | ||
url.query = base.query; | ||
@@ -638,5 +657,5 @@ url.fragment = ''; | ||
} else { | ||
if (!startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) { | ||
if (!startsWithWindowsDriveLetter(join(arraySlice(codePoints, pointer), ''))) { | ||
url.host = base.host; | ||
url.path = base.path.slice(); | ||
url.path = arraySlice(base.path); | ||
shortenURLsPath(url); | ||
@@ -657,4 +676,4 @@ } | ||
} | ||
if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) { | ||
if (isWindowsDriveLetter(base.path[0], true)) url.path.push(base.path[0]); | ||
if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(join(arraySlice(codePoints, pointer), ''))) { | ||
if (isWindowsDriveLetter(base.path[0], true)) push(url.path, base.path[0]); | ||
else url.host = base.host; | ||
@@ -708,7 +727,7 @@ } | ||
if (chr != '/' && !(chr == '\\' && isSpecial(url))) { | ||
url.path.push(''); | ||
push(url.path, ''); | ||
} | ||
} else if (isSingleDot(buffer)) { | ||
if (chr != '/' && !(chr == '\\' && isSpecial(url))) { | ||
url.path.push(''); | ||
push(url.path, ''); | ||
} | ||
@@ -718,5 +737,5 @@ } else { | ||
if (url.host) url.host = ''; | ||
buffer = buffer.charAt(0) + ':'; // normalize windows drive letter | ||
buffer = charAt(buffer, 0) + ':'; // normalize windows drive letter | ||
} | ||
url.path.push(buffer); | ||
push(url.path, buffer); | ||
} | ||
@@ -726,3 +745,3 @@ buffer = ''; | ||
while (url.path.length > 1 && url.path[0] === '') { | ||
url.path.shift(); | ||
shift(url.path); | ||
} | ||
@@ -774,3 +793,3 @@ } | ||
var URLConstructor = function URL(url /* , base */) { | ||
var that = anInstance(this, URLConstructor, 'URL'); | ||
var that = anInstance(this, URLPrototype); | ||
var base = arguments.length > 1 ? arguments[1] : undefined; | ||
@@ -781,4 +800,5 @@ var urlString = $toString(url); | ||
if (base !== undefined) { | ||
if (base instanceof URLConstructor) baseState = getInternalURLState(base); | ||
else { | ||
try { | ||
baseState = getInternalURLState(base); | ||
} catch (error) { | ||
failure = parseURL(baseState = {}, $toString(base)); | ||
@@ -794,17 +814,17 @@ if (failure) throw TypeError(failure); | ||
searchParamsState.updateURL = function () { | ||
state.query = String(searchParams) || null; | ||
state.query = $toString(searchParams) || null; | ||
}; | ||
if (!DESCRIPTORS) { | ||
that.href = serializeURL.call(that); | ||
that.origin = getOrigin.call(that); | ||
that.protocol = getProtocol.call(that); | ||
that.username = getUsername.call(that); | ||
that.password = getPassword.call(that); | ||
that.host = getHost.call(that); | ||
that.hostname = getHostname.call(that); | ||
that.port = getPort.call(that); | ||
that.pathname = getPathname.call(that); | ||
that.search = getSearch.call(that); | ||
that.searchParams = getSearchParams.call(that); | ||
that.hash = getHash.call(that); | ||
that.href = call(serializeURL, that); | ||
that.origin = call(getOrigin, that); | ||
that.protocol = call(getProtocol, that); | ||
that.username = call(getUsername, that); | ||
that.password = call(getPassword, that); | ||
that.host = call(getHost, that); | ||
that.hostname = call(getHostname, that); | ||
that.port = call(getPort, that); | ||
that.pathname = call(getPathname, that); | ||
that.search = call(getSearch, that); | ||
that.searchParams = call(getSearchParams, that); | ||
that.hash = call(getHash, that); | ||
} | ||
@@ -834,3 +854,3 @@ }; | ||
} else if (scheme == 'file') output += '//'; | ||
output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : ''; | ||
output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : ''; | ||
if (query !== null) output += '?' + query; | ||
@@ -882,3 +902,3 @@ if (fragment !== null) output += '#' + fragment; | ||
var port = getInternalURLState(this).port; | ||
return port === null ? '' : String(port); | ||
return port === null ? '' : $toString(port); | ||
}; | ||
@@ -889,3 +909,3 @@ | ||
var path = url.path; | ||
return url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : ''; | ||
return url.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : ''; | ||
}; | ||
@@ -992,3 +1012,3 @@ | ||
} else { | ||
if ('?' == search.charAt(0)) search = search.slice(1); | ||
if ('?' == charAt(search, 0)) search = stringSlice(search, 1); | ||
url.query = ''; | ||
@@ -1011,3 +1031,3 @@ parseURL(url, search, QUERY); | ||
} | ||
if ('#' == hash.charAt(0)) hash = hash.slice(1); | ||
if ('#' == charAt(hash, 0)) hash = stringSlice(hash, 1); | ||
url.fragment = ''; | ||
@@ -1022,3 +1042,3 @@ parseURL(url, hash, FRAGMENT); | ||
redefine(URLPrototype, 'toJSON', function toJSON() { | ||
return serializeURL.call(this); | ||
return call(serializeURL, this); | ||
}, { enumerable: true }); | ||
@@ -1029,3 +1049,3 @@ | ||
redefine(URLPrototype, 'toString', function toString() { | ||
return serializeURL.call(this); | ||
return call(serializeURL, this); | ||
}, { enumerable: true }); | ||
@@ -1038,12 +1058,6 @@ | ||
// https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL | ||
// eslint-disable-next-line no-unused-vars -- required for `.length` | ||
if (nativeCreateObjectURL) redefine(URLConstructor, 'createObjectURL', function createObjectURL(blob) { | ||
return nativeCreateObjectURL.apply(NativeURL, arguments); | ||
}); | ||
if (nativeCreateObjectURL) redefine(URLConstructor, 'createObjectURL', bind(nativeCreateObjectURL, NativeURL)); | ||
// `URL.revokeObjectURL` method | ||
// https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL | ||
// eslint-disable-next-line no-unused-vars -- required for `.length` | ||
if (nativeRevokeObjectURL) redefine(URLConstructor, 'revokeObjectURL', function revokeObjectURL(url) { | ||
return nativeRevokeObjectURL.apply(NativeURL, arguments); | ||
}); | ||
if (nativeRevokeObjectURL) redefine(URLConstructor, 'revokeObjectURL', bind(nativeRevokeObjectURL, NativeURL)); | ||
} | ||
@@ -1050,0 +1064,0 @@ |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var call = require('../internals/function-call'); | ||
@@ -8,4 +9,4 @@ // `URL.prototype.toJSON` method | ||
toJSON: function toJSON() { | ||
return URL.prototype.toString.call(this); | ||
return call(URL.prototype.toString, this); | ||
} | ||
}); |
{ | ||
"name": "core-js", | ||
"description": "Standard library", | ||
"version": "3.18.3", | ||
"version": "3.19.0", | ||
"repository": { | ||
@@ -57,3 +57,3 @@ "type": "git", | ||
}, | ||
"gitHead": "11f8efbfd552c8fca86188554ec3a8003580dd0c" | ||
"gitHead": "6123ff17d26eddf3ba8d456feb97decab3a9e9f6" | ||
} |
require('../../modules/web.dom-collections.iterator'); | ||
var entries = require('../array/virtual/entries'); | ||
var classof = require('../../internals/classof'); | ||
var hasOwn = require('../../internals/has-own-property'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/entries'); | ||
var ArrayPrototype = Array.prototype; | ||
@@ -13,5 +16,4 @@ | ||
var own = it.entries; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.entries) | ||
// eslint-disable-next-line no-prototype-builtins -- safe | ||
|| DOMIterables.hasOwnProperty(classof(it)) ? entries : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.entries) | ||
|| hasOwn(DOMIterables, classof(it)) ? method : own; | ||
}; |
require('../../modules/web.dom-collections.iterator'); | ||
var forEach = require('../array/virtual/for-each'); | ||
var classof = require('../../internals/classof'); | ||
var hasOwn = require('../../internals/has-own-property'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/for-each'); | ||
var ArrayPrototype = Array.prototype; | ||
@@ -13,5 +16,4 @@ | ||
var own = it.forEach; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.forEach) | ||
// eslint-disable-next-line no-prototype-builtins -- safe | ||
|| DOMIterables.hasOwnProperty(classof(it)) ? forEach : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.forEach) | ||
|| hasOwn(DOMIterables, classof(it)) ? method : own; | ||
}; |
require('../../modules/web.dom-collections.iterator'); | ||
var keys = require('../array/virtual/keys'); | ||
var classof = require('../../internals/classof'); | ||
var hasOwn = require('../../internals/has-own-property'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/keys'); | ||
var ArrayPrototype = Array.prototype; | ||
@@ -13,5 +16,4 @@ | ||
var own = it.keys; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.keys) | ||
// eslint-disable-next-line no-prototype-builtins -- safe | ||
|| DOMIterables.hasOwnProperty(classof(it)) ? keys : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.keys) | ||
|| hasOwn(DOMIterables, classof(it)) ? method : own; | ||
}; |
require('../../modules/web.dom-collections.iterator'); | ||
var values = require('../array/virtual/values'); | ||
var classof = require('../../internals/classof'); | ||
var hasOwn = require('../../internals/has-own-property'); | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/values'); | ||
var ArrayPrototype = Array.prototype; | ||
@@ -13,5 +16,4 @@ | ||
var own = it.values; | ||
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.values) | ||
// eslint-disable-next-line no-prototype-builtins -- safe | ||
|| DOMIterables.hasOwnProperty(classof(it)) ? values : own; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.values) | ||
|| hasOwn(DOMIterables, classof(it)) ? method : own; | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
816375
1889
19234