X7ROOT File Manager
Current Path:
/lib/node_modules/npm/node_modules/es-to-primitive
lib
/
node_modules
/
npm
/
node_modules
/
es-to-primitive
/
??
..
??
.editorconfig
(286 B)
??
.jscs.json
(4.03 KB)
??
.travis.yml
(7.03 KB)
??
CHANGELOG.md
(1.63 KB)
??
LICENSE
(1.06 KB)
??
Makefile
(3.74 KB)
??
README.md
(2.07 KB)
??
es2015.js
(2.09 KB)
??
es5.js
(1.17 KB)
??
es6.js
(53 B)
??
helpers
??
index.js
(454 B)
??
package.json
(1.97 KB)
Editing: es5.js
'use strict'; var toStr = Object.prototype.toString; var isPrimitive = require('./helpers/isPrimitive'); var isCallable = require('is-callable'); // http://ecma-international.org/ecma-262/5.1/#sec-8.12.8 var ES5internalSlots = { '[[DefaultValue]]': function (O) { var actualHint; if (arguments.length > 1) { actualHint = arguments[1]; } else { actualHint = toStr.call(O) === '[object Date]' ? String : Number; } if (actualHint === String || actualHint === Number) { var methods = actualHint === String ? ['toString', 'valueOf'] : ['valueOf', 'toString']; var value, i; for (i = 0; i < methods.length; ++i) { if (isCallable(O[methods[i]])) { value = O[methods[i]](); if (isPrimitive(value)) { return value; } } } throw new TypeError('No default value'); } throw new TypeError('invalid [[DefaultValue]] hint supplied'); } }; // http://ecma-international.org/ecma-262/5.1/#sec-9.1 module.exports = function ToPrimitive(input) { if (isPrimitive(input)) { return input; } if (arguments.length > 1) { return ES5internalSlots['[[DefaultValue]]'](input, arguments[1]); } return ES5internalSlots['[[DefaultValue]]'](input); };
Upload File
Create Folder