utils.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782
  1. 'use strict';
  2. import bind from './helpers/bind.js';
  3. // utils is a library of generic helper functions non-specific to axios
  4. const {toString} = Object.prototype;
  5. const {getPrototypeOf} = Object;
  6. const {iterator, toStringTag} = Symbol;
  7. const kindOf = (cache => thing => {
  8. const str = toString.call(thing);
  9. return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
  10. })(Object.create(null));
  11. const kindOfTest = (type) => {
  12. type = type.toLowerCase();
  13. return (thing) => kindOf(thing) === type
  14. }
  15. const typeOfTest = type => thing => typeof thing === type;
  16. /**
  17. * Determine if a value is an Array
  18. *
  19. * @param {Object} val The value to test
  20. *
  21. * @returns {boolean} True if value is an Array, otherwise false
  22. */
  23. const {isArray} = Array;
  24. /**
  25. * Determine if a value is undefined
  26. *
  27. * @param {*} val The value to test
  28. *
  29. * @returns {boolean} True if the value is undefined, otherwise false
  30. */
  31. const isUndefined = typeOfTest('undefined');
  32. /**
  33. * Determine if a value is a Buffer
  34. *
  35. * @param {*} val The value to test
  36. *
  37. * @returns {boolean} True if value is a Buffer, otherwise false
  38. */
  39. function isBuffer(val) {
  40. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  41. && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
  42. }
  43. /**
  44. * Determine if a value is an ArrayBuffer
  45. *
  46. * @param {*} val The value to test
  47. *
  48. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  49. */
  50. const isArrayBuffer = kindOfTest('ArrayBuffer');
  51. /**
  52. * Determine if a value is a view on an ArrayBuffer
  53. *
  54. * @param {*} val The value to test
  55. *
  56. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  57. */
  58. function isArrayBufferView(val) {
  59. let result;
  60. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  61. result = ArrayBuffer.isView(val);
  62. } else {
  63. result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
  64. }
  65. return result;
  66. }
  67. /**
  68. * Determine if a value is a String
  69. *
  70. * @param {*} val The value to test
  71. *
  72. * @returns {boolean} True if value is a String, otherwise false
  73. */
  74. const isString = typeOfTest('string');
  75. /**
  76. * Determine if a value is a Function
  77. *
  78. * @param {*} val The value to test
  79. * @returns {boolean} True if value is a Function, otherwise false
  80. */
  81. const isFunction = typeOfTest('function');
  82. /**
  83. * Determine if a value is a Number
  84. *
  85. * @param {*} val The value to test
  86. *
  87. * @returns {boolean} True if value is a Number, otherwise false
  88. */
  89. const isNumber = typeOfTest('number');
  90. /**
  91. * Determine if a value is an Object
  92. *
  93. * @param {*} thing The value to test
  94. *
  95. * @returns {boolean} True if value is an Object, otherwise false
  96. */
  97. const isObject = (thing) => thing !== null && typeof thing === 'object';
  98. /**
  99. * Determine if a value is a Boolean
  100. *
  101. * @param {*} thing The value to test
  102. * @returns {boolean} True if value is a Boolean, otherwise false
  103. */
  104. const isBoolean = thing => thing === true || thing === false;
  105. /**
  106. * Determine if a value is a plain Object
  107. *
  108. * @param {*} val The value to test
  109. *
  110. * @returns {boolean} True if value is a plain Object, otherwise false
  111. */
  112. const isPlainObject = (val) => {
  113. if (kindOf(val) !== 'object') {
  114. return false;
  115. }
  116. const prototype = getPrototypeOf(val);
  117. return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
  118. }
  119. /**
  120. * Determine if a value is an empty object (safely handles Buffers)
  121. *
  122. * @param {*} val The value to test
  123. *
  124. * @returns {boolean} True if value is an empty object, otherwise false
  125. */
  126. const isEmptyObject = (val) => {
  127. // Early return for non-objects or Buffers to prevent RangeError
  128. if (!isObject(val) || isBuffer(val)) {
  129. return false;
  130. }
  131. try {
  132. return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
  133. } catch (e) {
  134. // Fallback for any other objects that might cause RangeError with Object.keys()
  135. return false;
  136. }
  137. }
  138. /**
  139. * Determine if a value is a Date
  140. *
  141. * @param {*} val The value to test
  142. *
  143. * @returns {boolean} True if value is a Date, otherwise false
  144. */
  145. const isDate = kindOfTest('Date');
  146. /**
  147. * Determine if a value is a File
  148. *
  149. * @param {*} val The value to test
  150. *
  151. * @returns {boolean} True if value is a File, otherwise false
  152. */
  153. const isFile = kindOfTest('File');
  154. /**
  155. * Determine if a value is a Blob
  156. *
  157. * @param {*} val The value to test
  158. *
  159. * @returns {boolean} True if value is a Blob, otherwise false
  160. */
  161. const isBlob = kindOfTest('Blob');
  162. /**
  163. * Determine if a value is a FileList
  164. *
  165. * @param {*} val The value to test
  166. *
  167. * @returns {boolean} True if value is a File, otherwise false
  168. */
  169. const isFileList = kindOfTest('FileList');
  170. /**
  171. * Determine if a value is a Stream
  172. *
  173. * @param {*} val The value to test
  174. *
  175. * @returns {boolean} True if value is a Stream, otherwise false
  176. */
  177. const isStream = (val) => isObject(val) && isFunction(val.pipe);
  178. /**
  179. * Determine if a value is a FormData
  180. *
  181. * @param {*} thing The value to test
  182. *
  183. * @returns {boolean} True if value is an FormData, otherwise false
  184. */
  185. const isFormData = (thing) => {
  186. let kind;
  187. return thing && (
  188. (typeof FormData === 'function' && thing instanceof FormData) || (
  189. isFunction(thing.append) && (
  190. (kind = kindOf(thing)) === 'formdata' ||
  191. // detect form-data instance
  192. (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
  193. )
  194. )
  195. )
  196. }
  197. /**
  198. * Determine if a value is a URLSearchParams object
  199. *
  200. * @param {*} val The value to test
  201. *
  202. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  203. */
  204. const isURLSearchParams = kindOfTest('URLSearchParams');
  205. const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
  206. /**
  207. * Trim excess whitespace off the beginning and end of a string
  208. *
  209. * @param {String} str The String to trim
  210. *
  211. * @returns {String} The String freed of excess whitespace
  212. */
  213. const trim = (str) => str.trim ?
  214. str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
  215. /**
  216. * Iterate over an Array or an Object invoking a function for each item.
  217. *
  218. * If `obj` is an Array callback will be called passing
  219. * the value, index, and complete array for each item.
  220. *
  221. * If 'obj' is an Object callback will be called passing
  222. * the value, key, and complete object for each property.
  223. *
  224. * @param {Object|Array} obj The object to iterate
  225. * @param {Function} fn The callback to invoke for each item
  226. *
  227. * @param {Boolean} [allOwnKeys = false]
  228. * @returns {any}
  229. */
  230. function forEach(obj, fn, {allOwnKeys = false} = {}) {
  231. // Don't bother if no value provided
  232. if (obj === null || typeof obj === 'undefined') {
  233. return;
  234. }
  235. let i;
  236. let l;
  237. // Force an array if not already something iterable
  238. if (typeof obj !== 'object') {
  239. /*eslint no-param-reassign:0*/
  240. obj = [obj];
  241. }
  242. if (isArray(obj)) {
  243. // Iterate over array values
  244. for (i = 0, l = obj.length; i < l; i++) {
  245. fn.call(null, obj[i], i, obj);
  246. }
  247. } else {
  248. // Buffer check
  249. if (isBuffer(obj)) {
  250. return;
  251. }
  252. // Iterate over object keys
  253. const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
  254. const len = keys.length;
  255. let key;
  256. for (i = 0; i < len; i++) {
  257. key = keys[i];
  258. fn.call(null, obj[key], key, obj);
  259. }
  260. }
  261. }
  262. function findKey(obj, key) {
  263. if (isBuffer(obj)){
  264. return null;
  265. }
  266. key = key.toLowerCase();
  267. const keys = Object.keys(obj);
  268. let i = keys.length;
  269. let _key;
  270. while (i-- > 0) {
  271. _key = keys[i];
  272. if (key === _key.toLowerCase()) {
  273. return _key;
  274. }
  275. }
  276. return null;
  277. }
  278. const _global = (() => {
  279. /*eslint no-undef:0*/
  280. if (typeof globalThis !== "undefined") return globalThis;
  281. return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
  282. })();
  283. const isContextDefined = (context) => !isUndefined(context) && context !== _global;
  284. /**
  285. * Accepts varargs expecting each argument to be an object, then
  286. * immutably merges the properties of each object and returns result.
  287. *
  288. * When multiple objects contain the same key the later object in
  289. * the arguments list will take precedence.
  290. *
  291. * Example:
  292. *
  293. * ```js
  294. * var result = merge({foo: 123}, {foo: 456});
  295. * console.log(result.foo); // outputs 456
  296. * ```
  297. *
  298. * @param {Object} obj1 Object to merge
  299. *
  300. * @returns {Object} Result of all merge properties
  301. */
  302. function merge(/* obj1, obj2, obj3, ... */) {
  303. const {caseless, skipUndefined} = isContextDefined(this) && this || {};
  304. const result = {};
  305. const assignValue = (val, key) => {
  306. const targetKey = caseless && findKey(result, key) || key;
  307. if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
  308. result[targetKey] = merge(result[targetKey], val);
  309. } else if (isPlainObject(val)) {
  310. result[targetKey] = merge({}, val);
  311. } else if (isArray(val)) {
  312. result[targetKey] = val.slice();
  313. } else if (!skipUndefined || !isUndefined(val)) {
  314. result[targetKey] = val;
  315. }
  316. }
  317. for (let i = 0, l = arguments.length; i < l; i++) {
  318. arguments[i] && forEach(arguments[i], assignValue);
  319. }
  320. return result;
  321. }
  322. /**
  323. * Extends object a by mutably adding to it the properties of object b.
  324. *
  325. * @param {Object} a The object to be extended
  326. * @param {Object} b The object to copy properties from
  327. * @param {Object} thisArg The object to bind function to
  328. *
  329. * @param {Boolean} [allOwnKeys]
  330. * @returns {Object} The resulting value of object a
  331. */
  332. const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
  333. forEach(b, (val, key) => {
  334. if (thisArg && isFunction(val)) {
  335. a[key] = bind(val, thisArg);
  336. } else {
  337. a[key] = val;
  338. }
  339. }, {allOwnKeys});
  340. return a;
  341. }
  342. /**
  343. * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
  344. *
  345. * @param {string} content with BOM
  346. *
  347. * @returns {string} content value without BOM
  348. */
  349. const stripBOM = (content) => {
  350. if (content.charCodeAt(0) === 0xFEFF) {
  351. content = content.slice(1);
  352. }
  353. return content;
  354. }
  355. /**
  356. * Inherit the prototype methods from one constructor into another
  357. * @param {function} constructor
  358. * @param {function} superConstructor
  359. * @param {object} [props]
  360. * @param {object} [descriptors]
  361. *
  362. * @returns {void}
  363. */
  364. const inherits = (constructor, superConstructor, props, descriptors) => {
  365. constructor.prototype = Object.create(superConstructor.prototype, descriptors);
  366. constructor.prototype.constructor = constructor;
  367. Object.defineProperty(constructor, 'super', {
  368. value: superConstructor.prototype
  369. });
  370. props && Object.assign(constructor.prototype, props);
  371. }
  372. /**
  373. * Resolve object with deep prototype chain to a flat object
  374. * @param {Object} sourceObj source object
  375. * @param {Object} [destObj]
  376. * @param {Function|Boolean} [filter]
  377. * @param {Function} [propFilter]
  378. *
  379. * @returns {Object}
  380. */
  381. const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
  382. let props;
  383. let i;
  384. let prop;
  385. const merged = {};
  386. destObj = destObj || {};
  387. // eslint-disable-next-line no-eq-null,eqeqeq
  388. if (sourceObj == null) return destObj;
  389. do {
  390. props = Object.getOwnPropertyNames(sourceObj);
  391. i = props.length;
  392. while (i-- > 0) {
  393. prop = props[i];
  394. if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
  395. destObj[prop] = sourceObj[prop];
  396. merged[prop] = true;
  397. }
  398. }
  399. sourceObj = filter !== false && getPrototypeOf(sourceObj);
  400. } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
  401. return destObj;
  402. }
  403. /**
  404. * Determines whether a string ends with the characters of a specified string
  405. *
  406. * @param {String} str
  407. * @param {String} searchString
  408. * @param {Number} [position= 0]
  409. *
  410. * @returns {boolean}
  411. */
  412. const endsWith = (str, searchString, position) => {
  413. str = String(str);
  414. if (position === undefined || position > str.length) {
  415. position = str.length;
  416. }
  417. position -= searchString.length;
  418. const lastIndex = str.indexOf(searchString, position);
  419. return lastIndex !== -1 && lastIndex === position;
  420. }
  421. /**
  422. * Returns new array from array like object or null if failed
  423. *
  424. * @param {*} [thing]
  425. *
  426. * @returns {?Array}
  427. */
  428. const toArray = (thing) => {
  429. if (!thing) return null;
  430. if (isArray(thing)) return thing;
  431. let i = thing.length;
  432. if (!isNumber(i)) return null;
  433. const arr = new Array(i);
  434. while (i-- > 0) {
  435. arr[i] = thing[i];
  436. }
  437. return arr;
  438. }
  439. /**
  440. * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
  441. * thing passed in is an instance of Uint8Array
  442. *
  443. * @param {TypedArray}
  444. *
  445. * @returns {Array}
  446. */
  447. // eslint-disable-next-line func-names
  448. const isTypedArray = (TypedArray => {
  449. // eslint-disable-next-line func-names
  450. return thing => {
  451. return TypedArray && thing instanceof TypedArray;
  452. };
  453. })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
  454. /**
  455. * For each entry in the object, call the function with the key and value.
  456. *
  457. * @param {Object<any, any>} obj - The object to iterate over.
  458. * @param {Function} fn - The function to call for each entry.
  459. *
  460. * @returns {void}
  461. */
  462. const forEachEntry = (obj, fn) => {
  463. const generator = obj && obj[iterator];
  464. const _iterator = generator.call(obj);
  465. let result;
  466. while ((result = _iterator.next()) && !result.done) {
  467. const pair = result.value;
  468. fn.call(obj, pair[0], pair[1]);
  469. }
  470. }
  471. /**
  472. * It takes a regular expression and a string, and returns an array of all the matches
  473. *
  474. * @param {string} regExp - The regular expression to match against.
  475. * @param {string} str - The string to search.
  476. *
  477. * @returns {Array<boolean>}
  478. */
  479. const matchAll = (regExp, str) => {
  480. let matches;
  481. const arr = [];
  482. while ((matches = regExp.exec(str)) !== null) {
  483. arr.push(matches);
  484. }
  485. return arr;
  486. }
  487. /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
  488. const isHTMLForm = kindOfTest('HTMLFormElement');
  489. const toCamelCase = str => {
  490. return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
  491. function replacer(m, p1, p2) {
  492. return p1.toUpperCase() + p2;
  493. }
  494. );
  495. };
  496. /* Creating a function that will check if an object has a property. */
  497. const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
  498. /**
  499. * Determine if a value is a RegExp object
  500. *
  501. * @param {*} val The value to test
  502. *
  503. * @returns {boolean} True if value is a RegExp object, otherwise false
  504. */
  505. const isRegExp = kindOfTest('RegExp');
  506. const reduceDescriptors = (obj, reducer) => {
  507. const descriptors = Object.getOwnPropertyDescriptors(obj);
  508. const reducedDescriptors = {};
  509. forEach(descriptors, (descriptor, name) => {
  510. let ret;
  511. if ((ret = reducer(descriptor, name, obj)) !== false) {
  512. reducedDescriptors[name] = ret || descriptor;
  513. }
  514. });
  515. Object.defineProperties(obj, reducedDescriptors);
  516. }
  517. /**
  518. * Makes all methods read-only
  519. * @param {Object} obj
  520. */
  521. const freezeMethods = (obj) => {
  522. reduceDescriptors(obj, (descriptor, name) => {
  523. // skip restricted props in strict mode
  524. if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
  525. return false;
  526. }
  527. const value = obj[name];
  528. if (!isFunction(value)) return;
  529. descriptor.enumerable = false;
  530. if ('writable' in descriptor) {
  531. descriptor.writable = false;
  532. return;
  533. }
  534. if (!descriptor.set) {
  535. descriptor.set = () => {
  536. throw Error('Can not rewrite read-only method \'' + name + '\'');
  537. };
  538. }
  539. });
  540. }
  541. const toObjectSet = (arrayOrString, delimiter) => {
  542. const obj = {};
  543. const define = (arr) => {
  544. arr.forEach(value => {
  545. obj[value] = true;
  546. });
  547. }
  548. isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
  549. return obj;
  550. }
  551. const noop = () => {}
  552. const toFiniteNumber = (value, defaultValue) => {
  553. return value != null && Number.isFinite(value = +value) ? value : defaultValue;
  554. }
  555. /**
  556. * If the thing is a FormData object, return true, otherwise return false.
  557. *
  558. * @param {unknown} thing - The thing to check.
  559. *
  560. * @returns {boolean}
  561. */
  562. function isSpecCompliantForm(thing) {
  563. return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
  564. }
  565. const toJSONObject = (obj) => {
  566. const stack = new Array(10);
  567. const visit = (source, i) => {
  568. if (isObject(source)) {
  569. if (stack.indexOf(source) >= 0) {
  570. return;
  571. }
  572. //Buffer check
  573. if (isBuffer(source)) {
  574. return source;
  575. }
  576. if(!('toJSON' in source)) {
  577. stack[i] = source;
  578. const target = isArray(source) ? [] : {};
  579. forEach(source, (value, key) => {
  580. const reducedValue = visit(value, i + 1);
  581. !isUndefined(reducedValue) && (target[key] = reducedValue);
  582. });
  583. stack[i] = undefined;
  584. return target;
  585. }
  586. }
  587. return source;
  588. }
  589. return visit(obj, 0);
  590. }
  591. const isAsyncFn = kindOfTest('AsyncFunction');
  592. const isThenable = (thing) =>
  593. thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
  594. // original code
  595. // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
  596. const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
  597. if (setImmediateSupported) {
  598. return setImmediate;
  599. }
  600. return postMessageSupported ? ((token, callbacks) => {
  601. _global.addEventListener("message", ({source, data}) => {
  602. if (source === _global && data === token) {
  603. callbacks.length && callbacks.shift()();
  604. }
  605. }, false);
  606. return (cb) => {
  607. callbacks.push(cb);
  608. _global.postMessage(token, "*");
  609. }
  610. })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
  611. })(
  612. typeof setImmediate === 'function',
  613. isFunction(_global.postMessage)
  614. );
  615. const asap = typeof queueMicrotask !== 'undefined' ?
  616. queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
  617. // *********************
  618. const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
  619. export default {
  620. isArray,
  621. isArrayBuffer,
  622. isBuffer,
  623. isFormData,
  624. isArrayBufferView,
  625. isString,
  626. isNumber,
  627. isBoolean,
  628. isObject,
  629. isPlainObject,
  630. isEmptyObject,
  631. isReadableStream,
  632. isRequest,
  633. isResponse,
  634. isHeaders,
  635. isUndefined,
  636. isDate,
  637. isFile,
  638. isBlob,
  639. isRegExp,
  640. isFunction,
  641. isStream,
  642. isURLSearchParams,
  643. isTypedArray,
  644. isFileList,
  645. forEach,
  646. merge,
  647. extend,
  648. trim,
  649. stripBOM,
  650. inherits,
  651. toFlatObject,
  652. kindOf,
  653. kindOfTest,
  654. endsWith,
  655. toArray,
  656. forEachEntry,
  657. matchAll,
  658. isHTMLForm,
  659. hasOwnProperty,
  660. hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
  661. reduceDescriptors,
  662. freezeMethods,
  663. toObjectSet,
  664. toCamelCase,
  665. noop,
  666. toFiniteNumber,
  667. findKey,
  668. global: _global,
  669. isContextDefined,
  670. isSpecCompliantForm,
  671. toJSONObject,
  672. isAsyncFn,
  673. isThenable,
  674. setImmediate: _setImmediate,
  675. asap,
  676. isIterable
  677. };