You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_baseSetToString.js 641B

12345678910111213141516171819202122
  1. var constant = require('./constant'),
  2. defineProperty = require('./_defineProperty'),
  3. identity = require('./identity');
  4. /**
  5. * The base implementation of `setToString` without support for hot loop shorting.
  6. *
  7. * @private
  8. * @param {Function} func The function to modify.
  9. * @param {Function} string The `toString` result.
  10. * @returns {Function} Returns `func`.
  11. */
  12. var baseSetToString = !defineProperty ? identity : function(func, string) {
  13. return defineProperty(func, 'toString', {
  14. 'configurable': true,
  15. 'enumerable': false,
  16. 'value': constant(string),
  17. 'writable': true
  18. });
  19. };
  20. module.exports = baseSetToString;