mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
650 B
21 lines
650 B
var SetCache = require('./SetCache'),
|
|
getNative = require('./getNative');
|
|
|
|
/** Native method references. */
|
|
var Set = getNative(global, 'Set');
|
|
|
|
/* Native method references for those with the same name as other `lodash` methods. */
|
|
var nativeCreate = getNative(Object, 'create');
|
|
|
|
/**
|
|
* Creates a `Set` cache object to optimize linear searches of large arrays.
|
|
*
|
|
* @private
|
|
* @param {Array} [values] The values to cache.
|
|
* @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.
|
|
*/
|
|
function createCache(values) {
|
|
return (nativeCreate && Set) ? new SetCache(values) : null;
|
|
}
|
|
|
|
module.exports = createCache;
|
|
|