e12d9fd7920d87dafd899b91d7e22fcad6627844
[platform/framework/web/crosswalk-tizen.git] /
1 var SetCache = require('./SetCache'),
2     constant = require('../utility/constant'),
3     isNative = require('../lang/isNative');
4
5 /** Native method references. */
6 var Set = isNative(Set = global.Set) && Set;
7
8 /* Native method references for those with the same name as other `lodash` methods. */
9 var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate;
10
11 /**
12  * Creates a `Set` cache object to optimize linear searches of large arrays.
13  *
14  * @private
15  * @param {Array} [values] The values to cache.
16  * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.
17  */
18 var createCache = !(nativeCreate && Set) ? constant(null) : function(values) {
19   return new SetCache(values);
20 };
21
22 module.exports = createCache;