X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=node_modules%2Funcss%2Fnode_modules%2Flodash%2Finternal%2FgetTag.js;fp=node_modules%2Funcss%2Fnode_modules%2Flodash%2Finternal%2FgetTag.js;h=c0a08e98681de139a5efffc8c409e83736b2668d;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/node_modules/uncss/node_modules/lodash/internal/getTag.js b/node_modules/uncss/node_modules/lodash/internal/getTag.js new file mode 100644 index 000000000..c0a08e986 --- /dev/null +++ b/node_modules/uncss/node_modules/lodash/internal/getTag.js @@ -0,0 +1,55 @@ +var Map = require('./Map'), + Set = require('./Set'); + +/** `Object#toString` result references. */ +var mapTag = '[object Map]', + objectTag = '[object Object]', + setTag = '[object Set]'; + +/** Used for built-in method references. */ +var objectProto = global.Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = global.Function.prototype.toString; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Used to detect maps and sets. */ +var mapCtorString = Map ? funcToString.call(Map) : '', + setCtorString = Set ? funcToString.call(Set) : ''; + +/** + * Gets the `toStringTag` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +function getTag(value) { + return objectToString.call(value); +} + +// Fallback for IE 11 providing `toStringTag` values for maps and sets. +if ((Map && getTag(new Map) != mapTag) || (Set && getTag(new Set) != setTag)) { + getTag = function(value) { + var result = objectToString.call(value), + Ctor = result == objectTag ? value.constructor : null, + ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : ''; + + if (ctorString) { + if (ctorString == mapCtorString) { + return mapTag; + } + if (ctorString == setCtorString) { + return setTag; + } + } + return result; + }; +} + +module.exports = getTag;