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.
22 lines
650 B
22 lines
650 B
10 years ago
|
var SetCache = require('./SetCache'),
|
||
10 years ago
|
getNative = require('./getNative');
|
||
10 years ago
|
|
||
|
/** Native method references. */
|
||
10 years ago
|
var Set = getNative(global, 'Set');
|
||
10 years ago
|
|
||
|
/* Native method references for those with the same name as other `lodash` methods. */
|
||
10 years ago
|
var nativeCreate = getNative(Object, 'create');
|
||
10 years ago
|
|
||
|
/**
|
||
|
* 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`.
|
||
|
*/
|
||
9 years ago
|
function createCache(values) {
|
||
|
return (nativeCreate && Set) ? new SetCache(values) : null;
|
||
|
}
|
||
10 years ago
|
|
||
|
module.exports = createCache;
|