mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
24 lines
729 B
JavaScript
24 lines
729 B
JavaScript
import SetCache from './SetCache';
|
|
import constant from '../utility/constant';
|
|
import getNative from './getNative';
|
|
import root from './root';
|
|
|
|
/** Native method references. */
|
|
var Set = getNative(root, '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`.
|
|
*/
|
|
var createCache = !(nativeCreate && Set) ? constant(null) : function(values) {
|
|
return new SetCache(values);
|
|
};
|
|
|
|
export default createCache;
|