blob: 89eaca38dfe8ce696ee55bafc60ef699ceb90737 [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001var constant = require('./constant'),
2 defineProperty = require('./_defineProperty'),
3 identity = require('./identity');
4
5/**
6 * The base implementation of `setToString` without support for hot loop shorting.
7 *
8 * @private
9 * @param {Function} func The function to modify.
10 * @param {Function} string The `toString` result.
11 * @returns {Function} Returns `func`.
12 */
13var baseSetToString = !defineProperty ? identity : function(func, string) {
14 return defineProperty(func, 'toString', {
15 'configurable': true,
16 'enumerable': false,
17 'value': constant(string),
18 'writable': true
19 });
20};
21
22module.exports = baseSetToString;