mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Bump to v3.0.0.
This commit is contained in:
23
internal/createCache.js
Normal file
23
internal/createCache.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import SetCache from './SetCache';
|
||||
import constant from '../utility/constant';
|
||||
import isNative from '../lang/isNative';
|
||||
import root from './root';
|
||||
|
||||
/** Native method references. */
|
||||
var Set = isNative(Set = root.Set) && Set;
|
||||
|
||||
/* Native method references for those with the same name as other `lodash` methods. */
|
||||
var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
Reference in New Issue
Block a user