cachePush.js 379 B

1234567891011121314151617181920
  1. var isObject = require('../lang/isObject');
  2. /**
  3. * Adds `value` to the cache.
  4. *
  5. * @private
  6. * @name push
  7. * @memberOf SetCache
  8. * @param {*} value The value to cache.
  9. */
  10. function cachePush(value) {
  11. var data = this.data;
  12. if (typeof value == 'string' || isObject(value)) {
  13. data.set.add(value);
  14. } else {
  15. data.hash[value] = true;
  16. }
  17. }
  18. module.exports = cachePush;