first commit
This commit is contained in:
73
build/node_modules/to-string-x/lib/to-string-x.js
generated
vendored
Normal file
73
build/node_modules/to-string-x/lib/to-string-x.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.returnExports = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
||||
/**
|
||||
* @file ES6-compliant shim for ToString.
|
||||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-tostring|7.1.12 ToString ( argument )}
|
||||
* @version 1.4.2
|
||||
* @author Xotic750 <Xotic750@gmail.com>
|
||||
* @copyright Xotic750
|
||||
* @license {@link <https://opensource.org/licenses/MIT> MIT}
|
||||
* @module to-string-x
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var castString = ''.constructor;
|
||||
var isSymbol = _dereq_('is-symbol');
|
||||
|
||||
/**
|
||||
* The abstract operation ToString converts argument to a value of type String.
|
||||
*
|
||||
* @param {*} value - The value to convert to a string.
|
||||
* @throws {TypeError} If `value` is a Symbol.
|
||||
* @returns {string} The converted value.
|
||||
* @example
|
||||
* var $toString = require('to-string-x');
|
||||
*
|
||||
* $toString(); // 'undefined'
|
||||
* $toString(null); // 'null'
|
||||
* $toString('abc'); // 'abc'
|
||||
* $toString(true); // 'true'
|
||||
* $toString(Symbol('foo')); // TypeError
|
||||
* $toString(Symbol.iterator); // TypeError
|
||||
* $toString(Object(Symbol.iterator)); // TypeError
|
||||
* $toString(Object.create(null)); // TypeError
|
||||
*/
|
||||
module.exports = function ToString(value) {
|
||||
if (isSymbol(value)) {
|
||||
throw new TypeError('Cannot convert a Symbol value to a string');
|
||||
}
|
||||
|
||||
return castString(value);
|
||||
};
|
||||
|
||||
},{"is-symbol":2}],2:[function(_dereq_,module,exports){
|
||||
'use strict';
|
||||
|
||||
var toStr = Object.prototype.toString;
|
||||
var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol';
|
||||
|
||||
if (hasSymbols) {
|
||||
var symToStr = Symbol.prototype.toString;
|
||||
var symStringRegex = /^Symbol\(.*\)$/;
|
||||
var isSymbolObject = function isSymbolObject(value) {
|
||||
if (typeof value.valueOf() !== 'symbol') { return false; }
|
||||
return symStringRegex.test(symToStr.call(value));
|
||||
};
|
||||
module.exports = function isSymbol(value) {
|
||||
if (typeof value === 'symbol') { return true; }
|
||||
if (toStr.call(value) !== '[object Symbol]') { return false; }
|
||||
try {
|
||||
return isSymbolObject(value);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
module.exports = function isSymbol(value) {
|
||||
// this environment does not support Symbols.
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
},{}]},{},[1])(1)
|
||||
});
|
||||
Reference in New Issue
Block a user