diff options
Diffstat (limited to 'tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/SetCache.js')
-rw-r--r-- | tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/SetCache.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/SetCache.js b/tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/SetCache.js new file mode 100644 index 0000000000..ed3dc6b0fc --- /dev/null +++ b/tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/SetCache.js @@ -0,0 +1,29 @@ +var cachePush = require('./cachePush'), + isNative = require('../lang/isNative'); + +/** Native method references. */ +var Set = isNative(Set = global.Set) && Set; + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate; + +/** + * + * Creates a cache object to store unique values. + * + * @private + * @param {Array} [values] The values to cache. + */ +function SetCache(values) { + var length = values ? values.length : 0; + + this.data = { 'hash': nativeCreate(null), 'set': new Set }; + while (length--) { + this.push(values[length]); + } +} + +// Add functions to the `Set` cache. +SetCache.prototype.push = cachePush; + +module.exports = SetCache; |