_baseSetData.js 456 B

1234567891011121314151617
  1. var identity = require('./identity'),
  2. metaMap = require('./_metaMap');
  3. /**
  4. * The base implementation of `setData` without support for hot loop shorting.
  5. *
  6. * @private
  7. * @param {Function} func The function to associate metadata with.
  8. * @param {*} data The metadata.
  9. * @returns {Function} Returns `func`.
  10. */
  11. var baseSetData = !metaMap ? identity : function(func, data) {
  12. metaMap.set(func, data);
  13. return func;
  14. };
  15. module.exports = baseSetData;