core-js 3.1.2 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (788) hide show
  1. package/README.md +3 -3
  2. package/es/array/concat.js +2 -1
  3. package/es/array/copy-within.js +2 -1
  4. package/es/array/entries.js +2 -1
  5. package/es/array/every.js +2 -1
  6. package/es/array/fill.js +2 -1
  7. package/es/array/filter.js +2 -1
  8. package/es/array/find-index.js +2 -1
  9. package/es/array/find.js +2 -1
  10. package/es/array/flat-map.js +2 -1
  11. package/es/array/flat.js +2 -1
  12. package/es/array/for-each.js +2 -1
  13. package/es/array/from.js +2 -1
  14. package/es/array/includes.js +2 -1
  15. package/es/array/index-of.js +2 -1
  16. package/es/array/index.js +2 -1
  17. package/es/array/is-array.js +2 -1
  18. package/es/array/iterator.js +2 -1
  19. package/es/array/join.js +2 -1
  20. package/es/array/keys.js +2 -1
  21. package/es/array/last-index-of.js +2 -1
  22. package/es/array/map.js +2 -1
  23. package/es/array/of.js +2 -1
  24. package/es/array/reduce-right.js +2 -1
  25. package/es/array/reduce.js +2 -1
  26. package/es/array/reverse.js +2 -1
  27. package/es/array/slice.js +2 -1
  28. package/es/array/some.js +2 -1
  29. package/es/array/sort.js +2 -1
  30. package/es/array/splice.js +2 -1
  31. package/es/array/values.js +2 -1
  32. package/es/array/virtual/concat.js +2 -1
  33. package/es/array/virtual/copy-within.js +2 -1
  34. package/es/array/virtual/entries.js +2 -1
  35. package/es/array/virtual/every.js +2 -1
  36. package/es/array/virtual/fill.js +2 -1
  37. package/es/array/virtual/filter.js +2 -1
  38. package/es/array/virtual/find-index.js +2 -1
  39. package/es/array/virtual/find.js +2 -1
  40. package/es/array/virtual/flat-map.js +2 -1
  41. package/es/array/virtual/flat.js +2 -1
  42. package/es/array/virtual/for-each.js +2 -1
  43. package/es/array/virtual/includes.js +2 -1
  44. package/es/array/virtual/index-of.js +2 -1
  45. package/es/array/virtual/index.js +2 -1
  46. package/es/array/virtual/iterator.js +2 -1
  47. package/es/array/virtual/join.js +2 -1
  48. package/es/array/virtual/keys.js +2 -1
  49. package/es/array/virtual/last-index-of.js +2 -1
  50. package/es/array/virtual/map.js +2 -1
  51. package/es/array/virtual/reduce-right.js +2 -1
  52. package/es/array/virtual/reduce.js +2 -1
  53. package/es/array/virtual/reverse.js +2 -1
  54. package/es/array/virtual/slice.js +2 -1
  55. package/es/array/virtual/some.js +2 -1
  56. package/es/array/virtual/sort.js +2 -1
  57. package/es/array/virtual/splice.js +2 -1
  58. package/es/array/virtual/values.js +2 -1
  59. package/es/array-buffer/constructor.js +2 -1
  60. package/es/array-buffer/index.js +2 -1
  61. package/es/array-buffer/is-view.js +2 -1
  62. package/es/data-view/index.js +2 -1
  63. package/es/date/index.js +2 -1
  64. package/es/date/now.js +2 -1
  65. package/es/date/to-iso-string.js +2 -1
  66. package/es/date/to-json.js +2 -1
  67. package/es/function/bind.js +2 -1
  68. package/es/function/has-instance.js +2 -1
  69. package/es/function/index.js +2 -1
  70. package/es/function/virtual/bind.js +2 -1
  71. package/es/function/virtual/index.js +2 -1
  72. package/es/index.js +1 -0
  73. package/es/instance/bind.js +1 -0
  74. package/es/instance/code-point-at.js +1 -0
  75. package/es/instance/concat.js +1 -0
  76. package/es/instance/copy-within.js +1 -0
  77. package/es/instance/ends-with.js +1 -0
  78. package/es/instance/entries.js +1 -0
  79. package/es/instance/every.js +1 -0
  80. package/es/instance/fill.js +1 -0
  81. package/es/instance/filter.js +1 -0
  82. package/es/instance/find-index.js +1 -0
  83. package/es/instance/find.js +1 -0
  84. package/es/instance/flags.js +1 -0
  85. package/es/instance/flat-map.js +1 -0
  86. package/es/instance/flat.js +1 -0
  87. package/es/instance/for-each.js +1 -0
  88. package/es/instance/includes.js +1 -0
  89. package/es/instance/index-of.js +1 -0
  90. package/es/instance/keys.js +1 -0
  91. package/es/instance/last-index-of.js +1 -0
  92. package/es/instance/map.js +1 -0
  93. package/es/instance/match-all.js +1 -0
  94. package/es/instance/pad-end.js +1 -0
  95. package/es/instance/pad-start.js +1 -0
  96. package/es/instance/reduce-right.js +1 -0
  97. package/es/instance/reduce.js +1 -0
  98. package/es/instance/repeat.js +1 -0
  99. package/es/instance/reverse.js +1 -0
  100. package/es/instance/slice.js +1 -0
  101. package/es/instance/some.js +1 -0
  102. package/es/instance/sort.js +1 -0
  103. package/es/instance/splice.js +1 -0
  104. package/es/instance/starts-with.js +1 -0
  105. package/es/instance/trim-end.js +1 -0
  106. package/es/instance/trim-left.js +1 -0
  107. package/es/instance/trim-right.js +1 -0
  108. package/es/instance/trim-start.js +1 -0
  109. package/es/instance/trim.js +1 -0
  110. package/es/instance/values.js +1 -0
  111. package/es/json/index.js +0 -1
  112. package/es/map/index.js +2 -1
  113. package/es/math/acosh.js +2 -1
  114. package/es/math/asinh.js +2 -1
  115. package/es/math/atanh.js +2 -1
  116. package/es/math/cbrt.js +2 -1
  117. package/es/math/clz32.js +2 -1
  118. package/es/math/cosh.js +2 -1
  119. package/es/math/expm1.js +2 -1
  120. package/es/math/fround.js +2 -1
  121. package/es/math/hypot.js +2 -1
  122. package/es/math/imul.js +2 -1
  123. package/es/math/index.js +2 -1
  124. package/es/math/log10.js +2 -1
  125. package/es/math/log1p.js +2 -1
  126. package/es/math/log2.js +2 -1
  127. package/es/math/sign.js +2 -1
  128. package/es/math/sinh.js +2 -1
  129. package/es/math/tanh.js +2 -1
  130. package/es/math/trunc.js +2 -1
  131. package/es/number/index.js +2 -1
  132. package/es/number/is-finite.js +2 -1
  133. package/es/number/is-integer.js +2 -1
  134. package/es/number/is-nan.js +2 -1
  135. package/es/number/is-safe-integer.js +2 -1
  136. package/es/number/parse-float.js +2 -1
  137. package/es/number/parse-int.js +2 -1
  138. package/es/number/to-fixed.js +2 -1
  139. package/es/number/to-precision.js +2 -1
  140. package/es/number/virtual/index.js +2 -1
  141. package/es/number/virtual/to-fixed.js +2 -1
  142. package/es/number/virtual/to-precision.js +2 -1
  143. package/es/object/assign.js +2 -1
  144. package/es/object/create.js +3 -1
  145. package/es/object/define-getter.js +2 -1
  146. package/es/object/define-properties.js +3 -1
  147. package/es/object/define-property.js +3 -1
  148. package/es/object/define-setter.js +2 -1
  149. package/es/object/entries.js +2 -1
  150. package/es/object/freeze.js +2 -1
  151. package/es/object/from-entries.js +2 -1
  152. package/es/object/get-own-property-descriptor.js +3 -1
  153. package/es/object/get-own-property-descriptors.js +2 -1
  154. package/es/object/get-own-property-names.js +3 -1
  155. package/es/object/get-own-property-symbols.js +2 -1
  156. package/es/object/get-prototype-of.js +2 -1
  157. package/es/object/index.js +2 -1
  158. package/es/object/is-extensible.js +2 -1
  159. package/es/object/is-frozen.js +2 -1
  160. package/es/object/is-sealed.js +2 -1
  161. package/es/object/is.js +2 -1
  162. package/es/object/keys.js +2 -1
  163. package/es/object/lookup-getter.js +2 -1
  164. package/es/object/lookup-setter.js +2 -1
  165. package/es/object/prevent-extensions.js +2 -1
  166. package/es/object/seal.js +2 -1
  167. package/es/object/set-prototype-of.js +2 -1
  168. package/es/object/values.js +2 -1
  169. package/es/parse-float.js +2 -1
  170. package/es/parse-int.js +2 -1
  171. package/es/promise/all-settled.js +11 -0
  172. package/es/promise/finally.js +2 -1
  173. package/es/promise/index.js +3 -1
  174. package/es/reflect/apply.js +2 -1
  175. package/es/reflect/construct.js +2 -1
  176. package/es/reflect/define-property.js +2 -1
  177. package/es/reflect/delete-property.js +2 -1
  178. package/es/reflect/get-own-property-descriptor.js +2 -1
  179. package/es/reflect/get-prototype-of.js +2 -1
  180. package/es/reflect/get.js +2 -1
  181. package/es/reflect/has.js +2 -1
  182. package/es/reflect/index.js +2 -1
  183. package/es/reflect/is-extensible.js +2 -1
  184. package/es/reflect/own-keys.js +2 -1
  185. package/es/reflect/prevent-extensions.js +2 -1
  186. package/es/reflect/set-prototype-of.js +2 -1
  187. package/es/reflect/set.js +2 -1
  188. package/es/regexp/match.js +3 -1
  189. package/es/regexp/replace.js +3 -1
  190. package/es/regexp/search.js +3 -1
  191. package/es/regexp/split.js +3 -1
  192. package/es/set/index.js +2 -1
  193. package/es/string/anchor.js +2 -1
  194. package/es/string/big.js +2 -1
  195. package/es/string/blink.js +2 -1
  196. package/es/string/bold.js +2 -1
  197. package/es/string/code-point-at.js +2 -1
  198. package/es/string/ends-with.js +2 -1
  199. package/es/string/fixed.js +2 -1
  200. package/es/string/fontcolor.js +2 -1
  201. package/es/string/fontsize.js +2 -1
  202. package/es/string/from-code-point.js +2 -1
  203. package/es/string/includes.js +2 -1
  204. package/es/string/index.js +2 -1
  205. package/es/string/italics.js +2 -1
  206. package/es/string/iterator.js +3 -1
  207. package/es/string/link.js +2 -1
  208. package/es/string/match-all.js +2 -1
  209. package/es/string/match.js +2 -1
  210. package/es/string/pad-end.js +2 -1
  211. package/es/string/pad-start.js +2 -1
  212. package/es/string/raw.js +2 -1
  213. package/es/string/repeat.js +2 -1
  214. package/es/string/replace.js +2 -1
  215. package/es/string/search.js +2 -1
  216. package/es/string/small.js +2 -1
  217. package/es/string/split.js +2 -1
  218. package/es/string/starts-with.js +2 -1
  219. package/es/string/strike.js +2 -1
  220. package/es/string/sub.js +2 -1
  221. package/es/string/sup.js +2 -1
  222. package/es/string/trim-end.js +2 -1
  223. package/es/string/trim-left.js +2 -1
  224. package/es/string/trim-right.js +2 -1
  225. package/es/string/trim-start.js +2 -1
  226. package/es/string/trim.js +2 -1
  227. package/es/string/virtual/anchor.js +2 -1
  228. package/es/string/virtual/big.js +2 -1
  229. package/es/string/virtual/blink.js +2 -1
  230. package/es/string/virtual/bold.js +2 -1
  231. package/es/string/virtual/code-point-at.js +2 -1
  232. package/es/string/virtual/ends-with.js +2 -1
  233. package/es/string/virtual/fixed.js +2 -1
  234. package/es/string/virtual/fontcolor.js +2 -1
  235. package/es/string/virtual/fontsize.js +2 -1
  236. package/es/string/virtual/includes.js +2 -1
  237. package/es/string/virtual/index.js +2 -1
  238. package/es/string/virtual/italics.js +2 -1
  239. package/es/string/virtual/iterator.js +2 -1
  240. package/es/string/virtual/link.js +2 -1
  241. package/es/string/virtual/match-all.js +2 -1
  242. package/es/string/virtual/pad-end.js +2 -1
  243. package/es/string/virtual/pad-start.js +2 -1
  244. package/es/string/virtual/repeat.js +2 -1
  245. package/es/string/virtual/small.js +2 -1
  246. package/es/string/virtual/starts-with.js +2 -1
  247. package/es/string/virtual/strike.js +2 -1
  248. package/es/string/virtual/sub.js +2 -1
  249. package/es/string/virtual/sup.js +2 -1
  250. package/es/string/virtual/trim-end.js +2 -1
  251. package/es/string/virtual/trim-left.js +2 -1
  252. package/es/string/virtual/trim-right.js +2 -1
  253. package/es/string/virtual/trim-start.js +2 -1
  254. package/es/string/virtual/trim.js +2 -1
  255. package/es/symbol/async-iterator.js +2 -1
  256. package/es/symbol/for.js +2 -1
  257. package/es/symbol/has-instance.js +2 -1
  258. package/es/symbol/index.js +2 -1
  259. package/es/symbol/is-concat-spreadable.js +2 -1
  260. package/es/symbol/iterator.js +2 -1
  261. package/es/symbol/key-for.js +2 -1
  262. package/es/symbol/match-all.js +2 -1
  263. package/es/symbol/match.js +2 -1
  264. package/es/symbol/replace.js +2 -1
  265. package/es/symbol/search.js +2 -1
  266. package/es/symbol/species.js +3 -1
  267. package/es/symbol/split.js +2 -1
  268. package/es/symbol/to-primitive.js +2 -1
  269. package/es/symbol/to-string-tag.js +2 -1
  270. package/es/symbol/unscopables.js +2 -1
  271. package/es/typed-array/float32-array.js +2 -1
  272. package/es/typed-array/float64-array.js +2 -1
  273. package/es/typed-array/int16-array.js +2 -1
  274. package/es/typed-array/int32-array.js +2 -1
  275. package/es/typed-array/int8-array.js +2 -1
  276. package/es/typed-array/uint16-array.js +2 -1
  277. package/es/typed-array/uint32-array.js +2 -1
  278. package/es/typed-array/uint8-array.js +2 -1
  279. package/es/typed-array/uint8-clamped-array.js +2 -1
  280. package/es/weak-map/index.js +2 -1
  281. package/es/weak-set/index.js +2 -1
  282. package/features/aggregate-error.js +2 -1
  283. package/features/array/index.js +1 -0
  284. package/features/array/is-template-object.js +4 -0
  285. package/features/composite-key.js +2 -1
  286. package/features/composite-symbol.js +2 -1
  287. package/features/dom-collections/for-each.js +1 -3
  288. package/features/dom-collections/index.js +1 -11
  289. package/features/dom-collections/iterator.js +1 -3
  290. package/features/global-this.js +1 -1
  291. package/features/instance/at.js +1 -0
  292. package/features/instance/code-points.js +1 -0
  293. package/features/instance/replace-all.js +1 -0
  294. package/features/map/delete-all.js +2 -1
  295. package/features/map/every.js +2 -1
  296. package/features/map/filter.js +2 -1
  297. package/features/map/find-key.js +2 -1
  298. package/features/map/find.js +2 -1
  299. package/features/map/from.js +5 -1
  300. package/features/map/group-by.js +3 -1
  301. package/features/map/includes.js +2 -1
  302. package/features/map/index.js +1 -0
  303. package/features/map/key-by.js +3 -1
  304. package/features/map/key-of.js +2 -1
  305. package/features/map/map-keys.js +2 -1
  306. package/features/map/map-values.js +2 -1
  307. package/features/map/merge.js +2 -1
  308. package/features/map/of.js +5 -1
  309. package/features/map/reduce.js +2 -1
  310. package/features/map/some.js +2 -1
  311. package/features/map/update-or-insert.js +5 -0
  312. package/features/map/update.js +2 -1
  313. package/features/math/clamp.js +2 -1
  314. package/features/math/degrees.js +2 -1
  315. package/features/math/fscale.js +2 -1
  316. package/features/math/iaddh.js +2 -1
  317. package/features/math/imulh.js +2 -1
  318. package/features/math/isubh.js +2 -1
  319. package/features/math/radians.js +2 -1
  320. package/features/math/scale.js +2 -1
  321. package/features/math/seeded-prng.js +2 -1
  322. package/features/math/signbit.js +2 -1
  323. package/features/math/umulh.js +2 -1
  324. package/features/number/from-string.js +2 -1
  325. package/features/observable/index.js +2 -1
  326. package/features/promise/all-settled.js +2 -7
  327. package/features/promise/any.js +3 -1
  328. package/features/promise/index.js +1 -0
  329. package/features/promise/try.js +3 -1
  330. package/features/reflect/define-metadata.js +2 -1
  331. package/features/reflect/delete-metadata.js +4 -1
  332. package/features/reflect/get-metadata-keys.js +2 -1
  333. package/features/reflect/get-metadata.js +2 -1
  334. package/features/reflect/get-own-metadata-keys.js +2 -1
  335. package/features/reflect/get-own-metadata.js +2 -1
  336. package/features/reflect/has-metadata.js +2 -1
  337. package/features/reflect/has-own-metadata.js +2 -1
  338. package/features/reflect/metadata.js +2 -1
  339. package/features/set/add-all.js +2 -1
  340. package/features/set/delete-all.js +2 -1
  341. package/features/set/difference.js +4 -1
  342. package/features/set/every.js +2 -1
  343. package/features/set/filter.js +2 -1
  344. package/features/set/find.js +2 -1
  345. package/features/set/from.js +5 -1
  346. package/features/set/intersection.js +2 -1
  347. package/features/set/is-disjoint-from.js +2 -1
  348. package/features/set/is-subset-of.js +4 -1
  349. package/features/set/is-superset-of.js +2 -1
  350. package/features/set/join.js +2 -1
  351. package/features/set/map.js +2 -1
  352. package/features/set/of.js +5 -1
  353. package/features/set/reduce.js +2 -1
  354. package/features/set/some.js +2 -1
  355. package/features/set/symmetric-difference.js +4 -1
  356. package/features/set/union.js +4 -1
  357. package/features/string/at.js +2 -1
  358. package/features/string/replace-all.js +2 -1
  359. package/features/string/virtual/at.js +2 -1
  360. package/features/string/virtual/replace-all.js +2 -1
  361. package/features/symbol/async-dispose.js +4 -0
  362. package/features/symbol/dispose.js +2 -1
  363. package/features/symbol/index.js +1 -0
  364. package/features/symbol/observable.js +2 -1
  365. package/features/symbol/pattern-match.js +2 -1
  366. package/features/symbol/replace-all.js +2 -1
  367. package/features/url/index.js +1 -5
  368. package/features/url/to-json.js +1 -1
  369. package/features/url-search-params/index.js +1 -3
  370. package/features/weak-map/delete-all.js +2 -1
  371. package/features/weak-map/from.js +5 -1
  372. package/features/weak-map/of.js +5 -1
  373. package/features/weak-set/add-all.js +2 -1
  374. package/features/weak-set/delete-all.js +2 -1
  375. package/features/weak-set/from.js +5 -1
  376. package/features/weak-set/of.js +5 -1
  377. package/internals/a-possible-prototype.js +7 -0
  378. package/internals/add-to-unscopables.js +3 -1
  379. package/internals/advance-string-index.js +2 -2
  380. package/internals/array-buffer-view-core.js +7 -4
  381. package/internals/array-buffer.js +13 -12
  382. package/internals/array-copy-within.js +3 -1
  383. package/internals/array-for-each.js +5 -7
  384. package/internals/array-from.js +1 -1
  385. package/internals/array-includes.js +12 -7
  386. package/internals/{array-methods.js → array-iteration.js} +30 -18
  387. package/internals/array-last-index-of.js +6 -4
  388. package/internals/array-method-has-species-support.js +3 -1
  389. package/internals/array-reduce.js +30 -21
  390. package/internals/array-species-create.js +3 -1
  391. package/internals/check-correctness-of-iteration.js +3 -1
  392. package/internals/classof.js +3 -1
  393. package/internals/collection-delete-all.js +3 -1
  394. package/internals/collection-from.js +3 -2
  395. package/internals/collection-strong.js +1 -0
  396. package/internals/collection-weak.js +6 -5
  397. package/internals/collection.js +16 -16
  398. package/internals/composite-key.js +1 -0
  399. package/internals/correct-is-regexp-logic.js +3 -1
  400. package/internals/correct-prototype-getter.js +3 -1
  401. package/internals/create-html.js +1 -0
  402. package/internals/date-to-iso-string.js +12 -13
  403. package/internals/define-iterator.js +5 -3
  404. package/internals/descriptors.js +3 -1
  405. package/internals/document-create-element.js +5 -3
  406. package/internals/entry-unbind.js +1 -0
  407. package/internals/forced-string-trim-method.js +1 -0
  408. package/internals/freezing.js +3 -1
  409. package/internals/function-bind.js +4 -3
  410. package/internals/function-to-string.js +3 -1
  411. package/internals/get-iterator-method.js +3 -1
  412. package/internals/html.js +2 -2
  413. package/internals/indexed-object.js +2 -1
  414. package/internals/inherit-if-required.js +13 -6
  415. package/internals/internal-metadata.js +4 -2
  416. package/internals/internal-state.js +3 -1
  417. package/internals/is-array-iterator-method.js +4 -2
  418. package/internals/is-forced.js +1 -0
  419. package/internals/is-integer.js +1 -0
  420. package/internals/is-iterable.js +3 -1
  421. package/internals/is-regexp.js +3 -1
  422. package/internals/iterate.js +19 -10
  423. package/internals/iterators-core.js +3 -1
  424. package/internals/math-expm1.js +2 -1
  425. package/internals/math-fround.js +3 -1
  426. package/internals/math-log1p.js +3 -1
  427. package/internals/microtask.js +4 -2
  428. package/internals/native-promise-constructor.js +3 -0
  429. package/internals/native-url.js +4 -2
  430. package/internals/native-weak-map.js +3 -1
  431. package/internals/new-promise-capability.js +1 -1
  432. package/internals/not-a-regexp.js +7 -0
  433. package/internals/number-is-finite.js +3 -1
  434. package/internals/object-assign.js +3 -1
  435. package/internals/object-create.js +5 -2
  436. package/internals/object-define-properties.js +4 -2
  437. package/internals/object-define-property.js +3 -0
  438. package/internals/object-get-own-property-descriptor.js +3 -0
  439. package/internals/object-get-own-property-names-external.js +2 -1
  440. package/internals/object-get-own-property-names.js +5 -2
  441. package/internals/object-get-prototype-of.js +5 -2
  442. package/internals/object-keys-internal.js +2 -2
  443. package/internals/object-keys.js +2 -1
  444. package/internals/object-property-is-enumerable.js +5 -3
  445. package/internals/object-set-prototype-of.js +10 -6
  446. package/internals/object-to-array.js +25 -15
  447. package/internals/object-to-string.js +3 -1
  448. package/internals/own-keys.js +2 -2
  449. package/internals/parse-float.js +10 -6
  450. package/internals/parse-int.js +9 -5
  451. package/internals/punycode-to-ascii.js +2 -4
  452. package/internals/redefine.js +1 -0
  453. package/internals/reflect-metadata.js +5 -2
  454. package/internals/regexp-exec.js +0 -1
  455. package/internals/regexp-flags.js +1 -0
  456. package/internals/set-species.js +11 -6
  457. package/internals/set-to-string-tag.js +3 -1
  458. package/internals/shared-key.js +4 -2
  459. package/internals/shared.js +2 -1
  460. package/internals/species-constructor.js +3 -1
  461. package/internals/string-multibyte.js +27 -0
  462. package/internals/string-pad.js +25 -11
  463. package/internals/string-trim.js +23 -9
  464. package/internals/task.js +1 -0
  465. package/internals/to-absolute-index.js +1 -0
  466. package/internals/to-length.js +1 -0
  467. package/internals/to-primitive.js +8 -6
  468. package/internals/typed-array-constructor.js +98 -95
  469. package/internals/typed-arrays-constructors-requires-wrappers.js +1 -0
  470. package/internals/uid.js +1 -1
  471. package/internals/user-agent.js +2 -3
  472. package/internals/well-known-symbol.js +5 -2
  473. package/modules/es.array-buffer.constructor.js +9 -4
  474. package/modules/es.array-buffer.is-view.js +3 -1
  475. package/modules/es.array-buffer.slice.js +5 -2
  476. package/modules/es.array.concat.js +9 -4
  477. package/modules/es.array.copy-within.js +7 -3
  478. package/modules/es.array.every.js +5 -5
  479. package/modules/es.array.fill.js +8 -2
  480. package/modules/es.array.filter.js +5 -5
  481. package/modules/es.array.find-index.js +7 -4
  482. package/modules/es.array.find.js +7 -4
  483. package/modules/es.array.flat-map.js +3 -2
  484. package/modules/es.array.flat.js +3 -2
  485. package/modules/es.array.for-each.js +4 -1
  486. package/modules/es.array.from.js +7 -3
  487. package/modules/es.array.includes.js +6 -4
  488. package/modules/es.array.index-of.js +7 -4
  489. package/modules/es.array.is-array.js +6 -1
  490. package/modules/es.array.iterator.js +1 -0
  491. package/modules/es.array.join.js +7 -3
  492. package/modules/es.array.last-index-of.js +4 -3
  493. package/modules/es.array.map.js +5 -5
  494. package/modules/es.array.of.js +4 -2
  495. package/modules/es.array.reduce-right.js +5 -5
  496. package/modules/es.array.reduce.js +5 -5
  497. package/modules/es.array.reverse.js +3 -1
  498. package/modules/es.array.slice.js +6 -4
  499. package/modules/es.array.some.js +5 -5
  500. package/modules/es.array.sort.js +5 -2
  501. package/modules/es.array.species.js +3 -1
  502. package/modules/es.array.splice.js +4 -3
  503. package/modules/es.array.unscopables.flat-map.js +3 -1
  504. package/modules/es.array.unscopables.flat.js +3 -1
  505. package/modules/es.data-view.js +4 -2
  506. package/modules/es.date.now.js +3 -1
  507. package/modules/es.date.to-iso-string.js +2 -1
  508. package/modules/es.date.to-json.js +4 -2
  509. package/modules/es.date.to-primitive.js +3 -1
  510. package/modules/es.date.to-string.js +3 -1
  511. package/modules/es.function.bind.js +5 -2
  512. package/modules/es.function.has-instance.js +3 -1
  513. package/modules/es.function.name.js +1 -0
  514. package/modules/es.json.to-string-tag.js +4 -1
  515. package/modules/es.map.js +6 -3
  516. package/modules/es.math.acosh.js +3 -1
  517. package/modules/es.math.asinh.js +3 -1
  518. package/modules/es.math.atanh.js +3 -1
  519. package/modules/es.math.cbrt.js +3 -1
  520. package/modules/es.math.clz32.js +3 -1
  521. package/modules/es.math.cosh.js +3 -1
  522. package/modules/es.math.expm1.js +3 -4
  523. package/modules/es.math.fround.js +4 -1
  524. package/modules/es.math.hypot.js +8 -1
  525. package/modules/es.math.imul.js +5 -2
  526. package/modules/es.math.log10.js +3 -1
  527. package/modules/es.math.log1p.js +4 -1
  528. package/modules/es.math.log2.js +3 -1
  529. package/modules/es.math.sign.js +6 -1
  530. package/modules/es.math.sinh.js +5 -2
  531. package/modules/es.math.tanh.js +3 -1
  532. package/modules/es.math.to-string-tag.js +3 -1
  533. package/modules/es.math.trunc.js +3 -1
  534. package/modules/es.number.constructor.js +16 -13
  535. package/modules/es.number.epsilon.js +5 -1
  536. package/modules/es.number.is-finite.js +4 -3
  537. package/modules/es.number.is-integer.js +5 -2
  538. package/modules/es.number.is-nan.js +3 -1
  539. package/modules/es.number.is-safe-integer.js +3 -1
  540. package/modules/es.number.max-safe-integer.js +5 -1
  541. package/modules/es.number.min-safe-integer.js +5 -1
  542. package/modules/es.number.parse-float.js +2 -1
  543. package/modules/es.number.parse-int.js +2 -1
  544. package/modules/es.number.to-fixed.js +67 -58
  545. package/modules/es.number.to-precision.js +8 -4
  546. package/modules/es.object.assign.js +4 -1
  547. package/modules/es.object.create.js +7 -3
  548. package/modules/es.object.define-getter.js +5 -3
  549. package/modules/es.object.define-properties.js +4 -2
  550. package/modules/es.object.define-property.js +4 -2
  551. package/modules/es.object.define-setter.js +5 -3
  552. package/modules/es.object.entries.js +4 -3
  553. package/modules/es.object.freeze.js +6 -3
  554. package/modules/es.object.from-entries.js +2 -1
  555. package/modules/es.object.get-own-property-descriptor.js +5 -2
  556. package/modules/es.object.get-own-property-descriptors.js +5 -4
  557. package/modules/es.object.get-own-property-names.js +5 -2
  558. package/modules/es.object.get-prototype-of.js +5 -4
  559. package/modules/es.object.is-extensible.js +5 -2
  560. package/modules/es.object.is-frozen.js +5 -2
  561. package/modules/es.object.is-sealed.js +5 -2
  562. package/modules/es.object.is.js +6 -1
  563. package/modules/es.object.keys.js +5 -2
  564. package/modules/es.object.lookup-getter.js +5 -3
  565. package/modules/es.object.lookup-setter.js +5 -3
  566. package/modules/es.object.prevent-extensions.js +6 -3
  567. package/modules/es.object.seal.js +6 -3
  568. package/modules/es.object.set-prototype-of.js +5 -2
  569. package/modules/es.object.to-string.js +3 -1
  570. package/modules/es.object.values.js +4 -3
  571. package/modules/es.parse-float.js +2 -1
  572. package/modules/es.parse-int.js +2 -1
  573. package/modules/es.promise.all-settled.js +43 -0
  574. package/modules/es.promise.finally.js +10 -1
  575. package/modules/es.promise.js +48 -25
  576. package/modules/es.reflect.apply.js +7 -3
  577. package/modules/es.reflect.construct.js +7 -4
  578. package/modules/es.reflect.define-property.js +8 -6
  579. package/modules/es.reflect.delete-property.js +3 -2
  580. package/modules/es.reflect.get-own-property-descriptor.js +4 -3
  581. package/modules/es.reflect.get-prototype-of.js +3 -2
  582. package/modules/es.reflect.get.js +7 -4
  583. package/modules/es.reflect.has.js +3 -1
  584. package/modules/es.reflect.is-extensible.js +3 -1
  585. package/modules/es.reflect.own-keys.js +6 -1
  586. package/modules/es.reflect.prevent-extensions.js +2 -1
  587. package/modules/es.reflect.set-prototype-of.js +6 -3
  588. package/modules/es.reflect.set.js +7 -4
  589. package/modules/es.regexp.constructor.js +8 -5
  590. package/modules/es.regexp.exec.js +4 -4
  591. package/modules/es.regexp.flags.js +7 -3
  592. package/modules/es.regexp.to-string.js +4 -2
  593. package/modules/es.set.js +6 -3
  594. package/modules/es.string.anchor.js +3 -2
  595. package/modules/es.string.big.js +3 -2
  596. package/modules/es.string.blink.js +3 -2
  597. package/modules/es.string.bold.js +3 -2
  598. package/modules/es.string.code-point-at.js +4 -3
  599. package/modules/es.string.ends-with.js +9 -7
  600. package/modules/es.string.fixed.js +3 -2
  601. package/modules/es.string.fontcolor.js +3 -2
  602. package/modules/es.string.fontsize.js +3 -2
  603. package/modules/es.string.from-code-point.js +3 -1
  604. package/modules/es.string.includes.js +7 -7
  605. package/modules/es.string.italics.js +3 -2
  606. package/modules/es.string.iterator.js +3 -2
  607. package/modules/es.string.link.js +3 -2
  608. package/modules/es.string.match-all.js +6 -3
  609. package/modules/es.string.match.js +32 -36
  610. package/modules/es.string.pad-end.js +4 -3
  611. package/modules/es.string.pad-start.js +4 -3
  612. package/modules/es.string.raw.js +2 -1
  613. package/modules/es.string.repeat.js +5 -2
  614. package/modules/es.string.replace.js +95 -98
  615. package/modules/es.string.search.js +25 -29
  616. package/modules/es.string.small.js +3 -2
  617. package/modules/es.string.split.js +107 -111
  618. package/modules/es.string.starts-with.js +11 -7
  619. package/modules/es.string.strike.js +3 -2
  620. package/modules/es.string.sub.js +3 -2
  621. package/modules/es.string.sup.js +3 -2
  622. package/modules/es.string.trim-end.js +7 -4
  623. package/modules/es.string.trim-start.js +7 -4
  624. package/modules/es.string.trim.js +5 -4
  625. package/modules/es.symbol.async-iterator.js +3 -1
  626. package/modules/es.symbol.description.js +7 -2
  627. package/modules/es.symbol.has-instance.js +3 -1
  628. package/modules/es.symbol.is-concat-spreadable.js +3 -1
  629. package/modules/es.symbol.iterator.js +3 -1
  630. package/modules/es.symbol.js +107 -95
  631. package/modules/es.symbol.match-all.js +3 -1
  632. package/modules/es.symbol.match.js +3 -1
  633. package/modules/es.symbol.replace.js +3 -1
  634. package/modules/es.symbol.search.js +3 -1
  635. package/modules/es.symbol.species.js +3 -1
  636. package/modules/es.symbol.split.js +3 -1
  637. package/modules/es.symbol.to-primitive.js +3 -1
  638. package/modules/es.symbol.to-string-tag.js +3 -1
  639. package/modules/es.symbol.unscopables.js +3 -1
  640. package/modules/es.typed-array.copy-within.js +3 -2
  641. package/modules/es.typed-array.every.js +3 -2
  642. package/modules/es.typed-array.fill.js +3 -2
  643. package/modules/es.typed-array.filter.js +4 -3
  644. package/modules/es.typed-array.find-index.js +3 -2
  645. package/modules/es.typed-array.find.js +3 -2
  646. package/modules/es.typed-array.float32-array.js +3 -1
  647. package/modules/es.typed-array.float64-array.js +3 -1
  648. package/modules/es.typed-array.for-each.js +3 -2
  649. package/modules/es.typed-array.includes.js +3 -2
  650. package/modules/es.typed-array.index-of.js +3 -2
  651. package/modules/es.typed-array.int16-array.js +3 -1
  652. package/modules/es.typed-array.int32-array.js +3 -1
  653. package/modules/es.typed-array.int8-array.js +3 -1
  654. package/modules/es.typed-array.iterator.js +6 -3
  655. package/modules/es.typed-array.join.js +3 -2
  656. package/modules/es.typed-array.last-index-of.js +3 -2
  657. package/modules/es.typed-array.map.js +6 -6
  658. package/modules/es.typed-array.of.js +2 -1
  659. package/modules/es.typed-array.reduce-right.js +3 -3
  660. package/modules/es.typed-array.reduce.js +3 -3
  661. package/modules/es.typed-array.reverse.js +3 -1
  662. package/modules/es.typed-array.set.js +5 -3
  663. package/modules/es.typed-array.slice.js +6 -4
  664. package/modules/es.typed-array.some.js +3 -2
  665. package/modules/es.typed-array.sort.js +3 -2
  666. package/modules/es.typed-array.subarray.js +2 -1
  667. package/modules/es.typed-array.to-locale-string.js +10 -7
  668. package/modules/es.typed-array.to-string.js +6 -3
  669. package/modules/es.typed-array.uint16-array.js +3 -1
  670. package/modules/es.typed-array.uint32-array.js +3 -1
  671. package/modules/es.typed-array.uint8-array.js +3 -1
  672. package/modules/es.typed-array.uint8-clamped-array.js +3 -1
  673. package/modules/es.weak-map.js +6 -4
  674. package/modules/es.weak-set.js +6 -3
  675. package/modules/esnext.aggregate-error.js +6 -4
  676. package/modules/esnext.array.is-template-object.js +28 -0
  677. package/modules/esnext.array.last-index.js +2 -1
  678. package/modules/esnext.array.last-item.js +2 -1
  679. package/modules/esnext.composite-key.js +2 -1
  680. package/modules/esnext.composite-symbol.js +2 -1
  681. package/modules/esnext.global-this.js +6 -1
  682. package/modules/esnext.map.delete-all.js +3 -3
  683. package/modules/esnext.map.every.js +7 -6
  684. package/modules/esnext.map.filter.js +7 -6
  685. package/modules/esnext.map.find-key.js +7 -6
  686. package/modules/esnext.map.find.js +7 -6
  687. package/modules/esnext.map.from.js +5 -2
  688. package/modules/esnext.map.group-by.js +2 -1
  689. package/modules/esnext.map.includes.js +7 -8
  690. package/modules/esnext.map.key-by.js +2 -1
  691. package/modules/esnext.map.key-of.js +7 -8
  692. package/modules/esnext.map.map-keys.js +7 -6
  693. package/modules/esnext.map.map-values.js +7 -6
  694. package/modules/esnext.map.merge.js +3 -1
  695. package/modules/esnext.map.of.js +5 -2
  696. package/modules/esnext.map.reduce.js +8 -6
  697. package/modules/esnext.map.some.js +7 -6
  698. package/modules/esnext.map.update-or-insert.js +18 -0
  699. package/modules/esnext.map.update.js +6 -3
  700. package/modules/esnext.math.clamp.js +3 -1
  701. package/modules/esnext.math.deg-per-rad.js +5 -1
  702. package/modules/esnext.math.degrees.js +5 -3
  703. package/modules/esnext.math.fscale.js +3 -1
  704. package/modules/esnext.math.iaddh.js +3 -1
  705. package/modules/esnext.math.imulh.js +3 -1
  706. package/modules/esnext.math.isubh.js +3 -1
  707. package/modules/esnext.math.rad-per-deg.js +5 -1
  708. package/modules/esnext.math.radians.js +3 -1
  709. package/modules/esnext.math.scale.js +6 -1
  710. package/modules/esnext.math.seeded-prng.js +4 -2
  711. package/modules/esnext.math.signbit.js +8 -4
  712. package/modules/esnext.math.umulh.js +3 -1
  713. package/modules/esnext.number.from-string.js +3 -1
  714. package/modules/esnext.observable.js +33 -26
  715. package/modules/esnext.promise.all-settled.js +2 -42
  716. package/modules/esnext.promise.any.js +5 -3
  717. package/modules/esnext.promise.try.js +4 -3
  718. package/modules/esnext.reflect.define-metadata.js +3 -1
  719. package/modules/esnext.reflect.delete-metadata.js +3 -1
  720. package/modules/esnext.reflect.get-metadata-keys.js +4 -1
  721. package/modules/esnext.reflect.get-metadata.js +3 -1
  722. package/modules/esnext.reflect.get-own-metadata-keys.js +3 -1
  723. package/modules/esnext.reflect.get-own-metadata.js +3 -1
  724. package/modules/esnext.reflect.has-metadata.js +3 -1
  725. package/modules/esnext.reflect.has-own-metadata.js +3 -1
  726. package/modules/esnext.reflect.metadata.js +3 -1
  727. package/modules/esnext.set.add-all.js +3 -1
  728. package/modules/esnext.set.delete-all.js +3 -1
  729. package/modules/esnext.set.difference.js +3 -1
  730. package/modules/esnext.set.every.js +7 -5
  731. package/modules/esnext.set.filter.js +7 -5
  732. package/modules/esnext.set.find.js +7 -5
  733. package/modules/esnext.set.from.js +5 -2
  734. package/modules/esnext.set.intersection.js +3 -1
  735. package/modules/esnext.set.is-disjoint-from.js +6 -5
  736. package/modules/esnext.set.is-subset-of.js +6 -5
  737. package/modules/esnext.set.is-superset-of.js +6 -5
  738. package/modules/esnext.set.join.js +5 -3
  739. package/modules/esnext.set.map.js +7 -5
  740. package/modules/esnext.set.of.js +5 -2
  741. package/modules/esnext.set.reduce.js +8 -5
  742. package/modules/esnext.set.some.js +7 -5
  743. package/modules/esnext.set.symmetric-difference.js +3 -1
  744. package/modules/esnext.set.union.js +3 -1
  745. package/modules/esnext.string.at.js +4 -3
  746. package/modules/esnext.string.code-points.js +8 -4
  747. package/modules/esnext.string.replace-all.js +9 -6
  748. package/modules/esnext.symbol.async-dispose.js +5 -0
  749. package/modules/esnext.symbol.dispose.js +4 -2
  750. package/modules/esnext.symbol.observable.js +4 -1
  751. package/modules/esnext.symbol.pattern-match.js +3 -1
  752. package/modules/esnext.symbol.replace-all.js +3 -1
  753. package/modules/esnext.weak-map.delete-all.js +3 -3
  754. package/modules/esnext.weak-map.from.js +5 -2
  755. package/modules/esnext.weak-map.of.js +5 -2
  756. package/modules/esnext.weak-set.add-all.js +3 -2
  757. package/modules/esnext.weak-set.delete-all.js +3 -2
  758. package/modules/esnext.weak-set.from.js +5 -2
  759. package/modules/esnext.weak-set.of.js +5 -2
  760. package/modules/web.dom-collections.for-each.js +1 -1
  761. package/modules/web.dom-collections.iterator.js +2 -1
  762. package/modules/web.immediate.js +6 -0
  763. package/modules/web.queue-microtask.js +9 -5
  764. package/modules/web.timers.js +15 -9
  765. package/modules/web.url-search-params.js +59 -42
  766. package/modules/web.url.js +53 -47
  767. package/modules/web.url.to-json.js +3 -1
  768. package/package.json +2 -2
  769. package/proposals/array-is-template-object.js +1 -0
  770. package/proposals/map-update-or-insert.js +1 -0
  771. package/proposals/promise-all-settled.js +1 -0
  772. package/proposals/string-match-all.js +0 -2
  773. package/proposals/using-statement.js +1 -0
  774. package/scripts/postinstall.js +20 -8
  775. package/stable/dom-collections/index.js +2 -1
  776. package/stable/dom-collections/iterator.js +2 -1
  777. package/stable/promise/all-settled.js +1 -0
  778. package/stage/1.js +2 -3
  779. package/stage/2.js +3 -0
  780. package/stage/3.js +0 -1
  781. package/stage/4.js +1 -0
  782. package/web/queue-microtask.js +2 -1
  783. package/web/url-search-params.js +2 -1
  784. package/web/url.js +2 -1
  785. package/internals/enum-keys.js +0 -16
  786. package/internals/string-at.js +0 -16
  787. package/internals/validate-set-prototype-of-arguments.js +0 -9
  788. package/internals/validate-string-method-arguments.js +0 -9
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
-
2
+ var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
3
3
  var anObject = require('../internals/an-object');
4
4
  var toObject = require('../internals/to-object');
5
5
  var toLength = require('../internals/to-length');
@@ -7,6 +7,7 @@ var toInteger = require('../internals/to-integer');
7
7
  var requireObjectCoercible = require('../internals/require-object-coercible');
8
8
  var advanceStringIndex = require('../internals/advance-string-index');
9
9
  var regExpExec = require('../internals/regexp-exec-abstract');
10
+
10
11
  var max = Math.max;
11
12
  var min = Math.min;
12
13
  var floor = Math.floor;
@@ -18,112 +19,108 @@ var maybeToString = function (it) {
18
19
  };
19
20
 
20
21
  // @@replace logic
21
- require('../internals/fix-regexp-well-known-symbol-logic')(
22
- 'replace',
23
- 2,
24
- function (REPLACE, nativeReplace, maybeCallNative) {
25
- return [
26
- // `String.prototype.replace` method
27
- // https://tc39.github.io/ecma262/#sec-string.prototype.replace
28
- function replace(searchValue, replaceValue) {
29
- var O = requireObjectCoercible(this);
30
- var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
31
- return replacer !== undefined
32
- ? replacer.call(searchValue, O, replaceValue)
33
- : nativeReplace.call(String(O), searchValue, replaceValue);
34
- },
35
- // `RegExp.prototype[@@replace]` method
36
- // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
37
- function (regexp, replaceValue) {
38
- var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
39
- if (res.done) return res.value;
22
+ fixRegExpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative) {
23
+ return [
24
+ // `String.prototype.replace` method
25
+ // https://tc39.github.io/ecma262/#sec-string.prototype.replace
26
+ function replace(searchValue, replaceValue) {
27
+ var O = requireObjectCoercible(this);
28
+ var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
29
+ return replacer !== undefined
30
+ ? replacer.call(searchValue, O, replaceValue)
31
+ : nativeReplace.call(String(O), searchValue, replaceValue);
32
+ },
33
+ // `RegExp.prototype[@@replace]` method
34
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
35
+ function (regexp, replaceValue) {
36
+ var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
37
+ if (res.done) return res.value;
40
38
 
41
- var rx = anObject(regexp);
42
- var S = String(this);
39
+ var rx = anObject(regexp);
40
+ var S = String(this);
43
41
 
44
- var functionalReplace = typeof replaceValue === 'function';
45
- if (!functionalReplace) replaceValue = String(replaceValue);
42
+ var functionalReplace = typeof replaceValue === 'function';
43
+ if (!functionalReplace) replaceValue = String(replaceValue);
46
44
 
47
- var global = rx.global;
48
- if (global) {
49
- var fullUnicode = rx.unicode;
50
- rx.lastIndex = 0;
51
- }
52
- var results = [];
53
- while (true) {
54
- var result = regExpExec(rx, S);
55
- if (result === null) break;
45
+ var global = rx.global;
46
+ if (global) {
47
+ var fullUnicode = rx.unicode;
48
+ rx.lastIndex = 0;
49
+ }
50
+ var results = [];
51
+ while (true) {
52
+ var result = regExpExec(rx, S);
53
+ if (result === null) break;
56
54
 
57
- results.push(result);
58
- if (!global) break;
55
+ results.push(result);
56
+ if (!global) break;
59
57
 
60
- var matchStr = String(result[0]);
61
- if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
62
- }
58
+ var matchStr = String(result[0]);
59
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
60
+ }
63
61
 
64
- var accumulatedResult = '';
65
- var nextSourcePosition = 0;
66
- for (var i = 0; i < results.length; i++) {
67
- result = results[i];
62
+ var accumulatedResult = '';
63
+ var nextSourcePosition = 0;
64
+ for (var i = 0; i < results.length; i++) {
65
+ result = results[i];
68
66
 
69
- var matched = String(result[0]);
70
- var position = max(min(toInteger(result.index), S.length), 0);
71
- var captures = [];
72
- // NOTE: This is equivalent to
73
- // captures = result.slice(1).map(maybeToString)
74
- // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
75
- // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
76
- // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
77
- for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
78
- var namedCaptures = result.groups;
79
- if (functionalReplace) {
80
- var replacerArgs = [matched].concat(captures, position, S);
81
- if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
82
- var replacement = String(replaceValue.apply(undefined, replacerArgs));
83
- } else {
84
- replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
85
- }
86
- if (position >= nextSourcePosition) {
87
- accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
88
- nextSourcePosition = position + matched.length;
89
- }
67
+ var matched = String(result[0]);
68
+ var position = max(min(toInteger(result.index), S.length), 0);
69
+ var captures = [];
70
+ // NOTE: This is equivalent to
71
+ // captures = result.slice(1).map(maybeToString)
72
+ // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
73
+ // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
74
+ // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
75
+ for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
76
+ var namedCaptures = result.groups;
77
+ if (functionalReplace) {
78
+ var replacerArgs = [matched].concat(captures, position, S);
79
+ if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
80
+ var replacement = String(replaceValue.apply(undefined, replacerArgs));
81
+ } else {
82
+ replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
83
+ }
84
+ if (position >= nextSourcePosition) {
85
+ accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
86
+ nextSourcePosition = position + matched.length;
90
87
  }
91
- return accumulatedResult + S.slice(nextSourcePosition);
92
88
  }
93
- ];
89
+ return accumulatedResult + S.slice(nextSourcePosition);
90
+ }
91
+ ];
94
92
 
95
- // https://tc39.github.io/ecma262/#sec-getsubstitution
96
- function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
97
- var tailPos = position + matched.length;
98
- var m = captures.length;
99
- var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
100
- if (namedCaptures !== undefined) {
101
- namedCaptures = toObject(namedCaptures);
102
- symbols = SUBSTITUTION_SYMBOLS;
103
- }
104
- return nativeReplace.call(replacement, symbols, function (match, ch) {
105
- var capture;
106
- switch (ch.charAt(0)) {
107
- case '$': return '$';
108
- case '&': return matched;
109
- case '`': return str.slice(0, position);
110
- case "'": return str.slice(tailPos);
111
- case '<':
112
- capture = namedCaptures[ch.slice(1, -1)];
113
- break;
114
- default: // \d\d?
115
- var n = +ch;
116
- if (n === 0) return match;
117
- if (n > m) {
118
- var f = floor(n / 10);
119
- if (f === 0) return match;
120
- if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
121
- return match;
122
- }
123
- capture = captures[n - 1];
124
- }
125
- return capture === undefined ? '' : capture;
126
- });
93
+ // https://tc39.github.io/ecma262/#sec-getsubstitution
94
+ function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
95
+ var tailPos = position + matched.length;
96
+ var m = captures.length;
97
+ var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
98
+ if (namedCaptures !== undefined) {
99
+ namedCaptures = toObject(namedCaptures);
100
+ symbols = SUBSTITUTION_SYMBOLS;
127
101
  }
102
+ return nativeReplace.call(replacement, symbols, function (match, ch) {
103
+ var capture;
104
+ switch (ch.charAt(0)) {
105
+ case '$': return '$';
106
+ case '&': return matched;
107
+ case '`': return str.slice(0, position);
108
+ case "'": return str.slice(tailPos);
109
+ case '<':
110
+ capture = namedCaptures[ch.slice(1, -1)];
111
+ break;
112
+ default: // \d\d?
113
+ var n = +ch;
114
+ if (n === 0) return match;
115
+ if (n > m) {
116
+ var f = floor(n / 10);
117
+ if (f === 0) return match;
118
+ if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
119
+ return match;
120
+ }
121
+ capture = captures[n - 1];
122
+ }
123
+ return capture === undefined ? '' : capture;
124
+ });
128
125
  }
129
- );
126
+ });
@@ -1,38 +1,34 @@
1
1
  'use strict';
2
-
2
+ var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
3
3
  var anObject = require('../internals/an-object');
4
4
  var requireObjectCoercible = require('../internals/require-object-coercible');
5
5
  var sameValue = require('../internals/same-value');
6
6
  var regExpExec = require('../internals/regexp-exec-abstract');
7
7
 
8
8
  // @@search logic
9
- require('../internals/fix-regexp-well-known-symbol-logic')(
10
- 'search',
11
- 1,
12
- function (SEARCH, nativeSearch, maybeCallNative) {
13
- return [
14
- // `String.prototype.search` method
15
- // https://tc39.github.io/ecma262/#sec-string.prototype.search
16
- function search(regexp) {
17
- var O = requireObjectCoercible(this);
18
- var searcher = regexp == undefined ? undefined : regexp[SEARCH];
19
- return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
20
- },
21
- // `RegExp.prototype[@@search]` method
22
- // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
23
- function (regexp) {
24
- var res = maybeCallNative(nativeSearch, regexp, this);
25
- if (res.done) return res.value;
9
+ fixRegExpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) {
10
+ return [
11
+ // `String.prototype.search` method
12
+ // https://tc39.github.io/ecma262/#sec-string.prototype.search
13
+ function search(regexp) {
14
+ var O = requireObjectCoercible(this);
15
+ var searcher = regexp == undefined ? undefined : regexp[SEARCH];
16
+ return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
17
+ },
18
+ // `RegExp.prototype[@@search]` method
19
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
20
+ function (regexp) {
21
+ var res = maybeCallNative(nativeSearch, regexp, this);
22
+ if (res.done) return res.value;
26
23
 
27
- var rx = anObject(regexp);
28
- var S = String(this);
24
+ var rx = anObject(regexp);
25
+ var S = String(this);
29
26
 
30
- var previousLastIndex = rx.lastIndex;
31
- if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
32
- var result = regExpExec(rx, S);
33
- if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
34
- return result === null ? -1 : result.index;
35
- }
36
- ];
37
- }
38
- );
27
+ var previousLastIndex = rx.lastIndex;
28
+ if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
29
+ var result = regExpExec(rx, S);
30
+ if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
31
+ return result === null ? -1 : result.index;
32
+ }
33
+ ];
34
+ });
@@ -1,10 +1,11 @@
1
1
  'use strict';
2
+ var $ = require('../internals/export');
2
3
  var createHTML = require('../internals/create-html');
3
- var FORCED = require('../internals/forced-string-html-method')('small');
4
+ var forcedStringHTMLMethod = require('../internals/forced-string-html-method');
4
5
 
5
6
  // `String.prototype.small` method
6
7
  // https://tc39.github.io/ecma262/#sec-string.prototype.small
7
- require('../internals/export')({ target: 'String', proto: true, forced: FORCED }, {
8
+ $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('small') }, {
8
9
  small: function small() {
9
10
  return createHTML(this, 'small', '', '');
10
11
  }
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
-
2
+ var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
3
3
  var isRegExp = require('../internals/is-regexp');
4
4
  var anObject = require('../internals/an-object');
5
5
  var requireObjectCoercible = require('../internals/require-object-coercible');
@@ -9,6 +9,7 @@ var toLength = require('../internals/to-length');
9
9
  var callRegExpExec = require('../internals/regexp-exec-abstract');
10
10
  var regexpExec = require('../internals/regexp-exec');
11
11
  var fails = require('../internals/fails');
12
+
12
13
  var arrayPush = [].push;
13
14
  var min = Math.min;
14
15
  var MAX_UINT32 = 0xFFFFFFFF;
@@ -17,122 +18,117 @@ var MAX_UINT32 = 0xFFFFFFFF;
17
18
  var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
18
19
 
19
20
  // @@split logic
20
- require('../internals/fix-regexp-well-known-symbol-logic')(
21
- 'split',
22
- 2,
23
- function (SPLIT, nativeSplit, maybeCallNative) {
24
- var internalSplit;
25
- if (
26
- 'abbc'.split(/(b)*/)[1] == 'c' ||
27
- 'test'.split(/(?:)/, -1).length != 4 ||
28
- 'ab'.split(/(?:ab)*/).length != 2 ||
29
- '.'.split(/(.?)(.?)/).length != 4 ||
30
- '.'.split(/()()/).length > 1 ||
31
- ''.split(/.?/).length
32
- ) {
33
- // based on es5-shim implementation, need to rework it
34
- internalSplit = function (separator, limit) {
35
- var string = String(requireObjectCoercible(this));
36
- var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
37
- if (lim === 0) return [];
38
- if (separator === undefined) return [string];
39
- // If `separator` is not a regex, use native split
40
- if (!isRegExp(separator)) {
41
- return nativeSplit.call(string, separator, lim);
42
- }
43
- var output = [];
44
- var flags = (separator.ignoreCase ? 'i' : '') +
45
- (separator.multiline ? 'm' : '') +
46
- (separator.unicode ? 'u' : '') +
47
- (separator.sticky ? 'y' : '');
48
- var lastLastIndex = 0;
49
- // Make `global` and avoid `lastIndex` issues by working with a copy
50
- var separatorCopy = new RegExp(separator.source, flags + 'g');
51
- var match, lastIndex, lastLength;
52
- while (match = regexpExec.call(separatorCopy, string)) {
53
- lastIndex = separatorCopy.lastIndex;
54
- if (lastIndex > lastLastIndex) {
55
- output.push(string.slice(lastLastIndex, match.index));
56
- if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
57
- lastLength = match[0].length;
58
- lastLastIndex = lastIndex;
59
- if (output.length >= lim) break;
60
- }
61
- if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
21
+ fixRegExpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
22
+ var internalSplit;
23
+ if (
24
+ 'abbc'.split(/(b)*/)[1] == 'c' ||
25
+ 'test'.split(/(?:)/, -1).length != 4 ||
26
+ 'ab'.split(/(?:ab)*/).length != 2 ||
27
+ '.'.split(/(.?)(.?)/).length != 4 ||
28
+ '.'.split(/()()/).length > 1 ||
29
+ ''.split(/.?/).length
30
+ ) {
31
+ // based on es5-shim implementation, need to rework it
32
+ internalSplit = function (separator, limit) {
33
+ var string = String(requireObjectCoercible(this));
34
+ var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
35
+ if (lim === 0) return [];
36
+ if (separator === undefined) return [string];
37
+ // If `separator` is not a regex, use native split
38
+ if (!isRegExp(separator)) {
39
+ return nativeSplit.call(string, separator, lim);
40
+ }
41
+ var output = [];
42
+ var flags = (separator.ignoreCase ? 'i' : '') +
43
+ (separator.multiline ? 'm' : '') +
44
+ (separator.unicode ? 'u' : '') +
45
+ (separator.sticky ? 'y' : '');
46
+ var lastLastIndex = 0;
47
+ // Make `global` and avoid `lastIndex` issues by working with a copy
48
+ var separatorCopy = new RegExp(separator.source, flags + 'g');
49
+ var match, lastIndex, lastLength;
50
+ while (match = regexpExec.call(separatorCopy, string)) {
51
+ lastIndex = separatorCopy.lastIndex;
52
+ if (lastIndex > lastLastIndex) {
53
+ output.push(string.slice(lastLastIndex, match.index));
54
+ if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
55
+ lastLength = match[0].length;
56
+ lastLastIndex = lastIndex;
57
+ if (output.length >= lim) break;
62
58
  }
63
- if (lastLastIndex === string.length) {
64
- if (lastLength || !separatorCopy.test('')) output.push('');
65
- } else output.push(string.slice(lastLastIndex));
66
- return output.length > lim ? output.slice(0, lim) : output;
67
- };
68
- // Chakra, V8
69
- } else if ('0'.split(undefined, 0).length) {
70
- internalSplit = function (separator, limit) {
71
- return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
72
- };
73
- } else internalSplit = nativeSplit;
59
+ if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
60
+ }
61
+ if (lastLastIndex === string.length) {
62
+ if (lastLength || !separatorCopy.test('')) output.push('');
63
+ } else output.push(string.slice(lastLastIndex));
64
+ return output.length > lim ? output.slice(0, lim) : output;
65
+ };
66
+ // Chakra, V8
67
+ } else if ('0'.split(undefined, 0).length) {
68
+ internalSplit = function (separator, limit) {
69
+ return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
70
+ };
71
+ } else internalSplit = nativeSplit;
74
72
 
75
- return [
76
- // `String.prototype.split` method
77
- // https://tc39.github.io/ecma262/#sec-string.prototype.split
78
- function split(separator, limit) {
79
- var O = requireObjectCoercible(this);
80
- var splitter = separator == undefined ? undefined : separator[SPLIT];
81
- return splitter !== undefined
82
- ? splitter.call(separator, O, limit)
83
- : internalSplit.call(String(O), separator, limit);
84
- },
85
- // `RegExp.prototype[@@split]` method
86
- // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
87
- //
88
- // NOTE: This cannot be properly polyfilled in engines that don't support
89
- // the 'y' flag.
90
- function (regexp, limit) {
91
- var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
92
- if (res.done) return res.value;
73
+ return [
74
+ // `String.prototype.split` method
75
+ // https://tc39.github.io/ecma262/#sec-string.prototype.split
76
+ function split(separator, limit) {
77
+ var O = requireObjectCoercible(this);
78
+ var splitter = separator == undefined ? undefined : separator[SPLIT];
79
+ return splitter !== undefined
80
+ ? splitter.call(separator, O, limit)
81
+ : internalSplit.call(String(O), separator, limit);
82
+ },
83
+ // `RegExp.prototype[@@split]` method
84
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
85
+ //
86
+ // NOTE: This cannot be properly polyfilled in engines that don't support
87
+ // the 'y' flag.
88
+ function (regexp, limit) {
89
+ var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
90
+ if (res.done) return res.value;
93
91
 
94
- var rx = anObject(regexp);
95
- var S = String(this);
96
- var C = speciesConstructor(rx, RegExp);
92
+ var rx = anObject(regexp);
93
+ var S = String(this);
94
+ var C = speciesConstructor(rx, RegExp);
97
95
 
98
- var unicodeMatching = rx.unicode;
99
- var flags = (rx.ignoreCase ? 'i' : '') +
100
- (rx.multiline ? 'm' : '') +
101
- (rx.unicode ? 'u' : '') +
102
- (SUPPORTS_Y ? 'y' : 'g');
96
+ var unicodeMatching = rx.unicode;
97
+ var flags = (rx.ignoreCase ? 'i' : '') +
98
+ (rx.multiline ? 'm' : '') +
99
+ (rx.unicode ? 'u' : '') +
100
+ (SUPPORTS_Y ? 'y' : 'g');
103
101
 
104
- // ^(? + rx + ) is needed, in combination with some S slicing, to
105
- // simulate the 'y' flag.
106
- var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
107
- var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
108
- if (lim === 0) return [];
109
- if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];
110
- var p = 0;
111
- var q = 0;
112
- var A = [];
113
- while (q < S.length) {
114
- splitter.lastIndex = SUPPORTS_Y ? q : 0;
115
- var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q));
116
- var e;
117
- if (
118
- z === null ||
119
- (e = min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
120
- ) {
121
- q = advanceStringIndex(S, q, unicodeMatching);
122
- } else {
123
- A.push(S.slice(p, q));
102
+ // ^(? + rx + ) is needed, in combination with some S slicing, to
103
+ // simulate the 'y' flag.
104
+ var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
105
+ var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
106
+ if (lim === 0) return [];
107
+ if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];
108
+ var p = 0;
109
+ var q = 0;
110
+ var A = [];
111
+ while (q < S.length) {
112
+ splitter.lastIndex = SUPPORTS_Y ? q : 0;
113
+ var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q));
114
+ var e;
115
+ if (
116
+ z === null ||
117
+ (e = min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
118
+ ) {
119
+ q = advanceStringIndex(S, q, unicodeMatching);
120
+ } else {
121
+ A.push(S.slice(p, q));
122
+ if (A.length === lim) return A;
123
+ for (var i = 1; i <= z.length - 1; i++) {
124
+ A.push(z[i]);
124
125
  if (A.length === lim) return A;
125
- for (var i = 1; i <= z.length - 1; i++) {
126
- A.push(z[i]);
127
- if (A.length === lim) return A;
128
- }
129
- q = p = e;
130
126
  }
127
+ q = p = e;
131
128
  }
132
- A.push(S.slice(p));
133
- return A;
134
129
  }
135
- ];
136
- },
137
- !SUPPORTS_Y
138
- );
130
+ A.push(S.slice(p));
131
+ return A;
132
+ }
133
+ ];
134
+ }, !SUPPORTS_Y);
@@ -1,16 +1,20 @@
1
1
  'use strict';
2
+ var $ = require('../internals/export');
2
3
  var toLength = require('../internals/to-length');
3
- var validateArguments = require('../internals/validate-string-method-arguments');
4
- var STARTS_WITH = 'startsWith';
5
- var CORRECT_IS_REGEXP_LOGIC = require('../internals/correct-is-regexp-logic')(STARTS_WITH);
6
- var nativeStartsWith = ''[STARTS_WITH];
4
+ var notARegExp = require('../internals/not-a-regexp');
5
+ var requireObjectCoercible = require('../internals/require-object-coercible');
6
+ var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');
7
+
8
+ var nativeStartsWith = ''.startsWith;
9
+ var min = Math.min;
7
10
 
8
11
  // `String.prototype.startsWith` method
9
12
  // https://tc39.github.io/ecma262/#sec-string.prototype.startswith
10
- require('../internals/export')({ target: 'String', proto: true, forced: !CORRECT_IS_REGEXP_LOGIC }, {
13
+ $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('startsWith') }, {
11
14
  startsWith: function startsWith(searchString /* , position = 0 */) {
12
- var that = validateArguments(this, searchString, STARTS_WITH);
13
- var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length));
15
+ var that = String(requireObjectCoercible(this));
16
+ notARegExp(searchString);
17
+ var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));
14
18
  var search = String(searchString);
15
19
  return nativeStartsWith
16
20
  ? nativeStartsWith.call(that, search, index)
@@ -1,10 +1,11 @@
1
1
  'use strict';
2
+ var $ = require('../internals/export');
2
3
  var createHTML = require('../internals/create-html');
3
- var FORCED = require('../internals/forced-string-html-method')('strike');
4
+ var forcedStringHTMLMethod = require('../internals/forced-string-html-method');
4
5
 
5
6
  // `String.prototype.strike` method
6
7
  // https://tc39.github.io/ecma262/#sec-string.prototype.strike
7
- require('../internals/export')({ target: 'String', proto: true, forced: FORCED }, {
8
+ $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('strike') }, {
8
9
  strike: function strike() {
9
10
  return createHTML(this, 'strike', '', '');
10
11
  }
@@ -1,10 +1,11 @@
1
1
  'use strict';
2
+ var $ = require('../internals/export');
2
3
  var createHTML = require('../internals/create-html');
3
- var FORCED = require('../internals/forced-string-html-method')('sub');
4
+ var forcedStringHTMLMethod = require('../internals/forced-string-html-method');
4
5
 
5
6
  // `String.prototype.sub` method
6
7
  // https://tc39.github.io/ecma262/#sec-string.prototype.sub
7
- require('../internals/export')({ target: 'String', proto: true, forced: FORCED }, {
8
+ $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('sub') }, {
8
9
  sub: function sub() {
9
10
  return createHTML(this, 'sub', '', '');
10
11
  }
@@ -1,10 +1,11 @@
1
1
  'use strict';
2
+ var $ = require('../internals/export');
2
3
  var createHTML = require('../internals/create-html');
3
- var FORCED = require('../internals/forced-string-html-method')('sup');
4
+ var forcedStringHTMLMethod = require('../internals/forced-string-html-method');
4
5
 
5
6
  // `String.prototype.sup` method
6
7
  // https://tc39.github.io/ecma262/#sec-string.prototype.sup
7
- require('../internals/export')({ target: 'String', proto: true, forced: FORCED }, {
8
+ $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('sup') }, {
8
9
  sup: function sup() {
9
10
  return createHTML(this, 'sup', '', '');
10
11
  }