Files
lodash/internal/createCache.js
John-David Dalton 81e41ca0c8 Bump to v3.9.0.
2015-12-16 17:50:42 -08:00

22 lines
731 B
JavaScript

define(['./SetCache', '../utility/constant', './getNative', './root'], function(SetCache, constant, getNative, 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);
};
return createCache;
});