Changeset 0c6b92a for imaps-frontend/node_modules/es-to-primitive/es5.js
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/es-to-primitive/es5.js
rd565449 r0c6b92a 7 7 var isCallable = require('is-callable'); 8 8 9 /** @type {{ [k in `[[${string}]]`]: (O: { toString?: unknown, valueOf?: unknown }, actualHint?: StringConstructor | NumberConstructor) => null | undefined | string | symbol | number | boolean | bigint; }} */ 9 10 // http://ecma-international.org/ecma-262/5.1/#sec-8.12.8 10 11 var ES5internalSlots = { … … 18 19 19 20 if (actualHint === String || actualHint === Number) { 21 /** @type {('toString' | 'valueOf')[]} */ 20 22 var methods = actualHint === String ? ['toString', 'valueOf'] : ['valueOf', 'toString']; 21 23 var value, i; 22 24 for (i = 0; i < methods.length; ++i) { 23 if (isCallable(O[methods[i]])) { 24 value = O[methods[i]](); 25 var method = methods[i]; 26 if (isCallable(O[method])) { 27 // eslint-disable-next-line no-extra-parens 28 value = /** @type {Function} */ (O[method])(); 25 29 if (isPrimitive(value)) { 26 30 return value; … … 34 38 }; 35 39 40 /** @type {import('./es5')} */ 36 41 // http://ecma-international.org/ecma-262/5.1/#sec-9.1 37 42 module.exports = function ToPrimitive(input) { … … 40 45 } 41 46 if (arguments.length > 1) { 42 return ES5internalSlots['[[DefaultValue]]'](input, arguments[1]); 47 // eslint-disable-next-line no-extra-parens 48 return ES5internalSlots['[[DefaultValue]]'](/** @type {object} */ (input), arguments[1]); 43 49 } 44 return ES5internalSlots['[[DefaultValue]]'](input); 50 // eslint-disable-next-line no-extra-parens 51 return ES5internalSlots['[[DefaultValue]]'](/** @type {object} */ (input)); 45 52 };
Note:
See TracChangeset
for help on using the changeset viewer.