Files
lodash/_baseSetToString.js
2017-01-08 23:37:20 -08:00

21 lines
612 B
JavaScript

import constant from './constant.js';
import defineProperty from './_defineProperty.js';
import identity from './identity.js';
/**
* The base implementation of `setToString` without support for hot loop shorting.
*
* @private
* @param {Function} func The function to modify.
* @param {Function} string The `toString` result.
* @returns {Function} Returns `func`.
*/
const baseSetToString = !defineProperty ? identity : (func, string) => defineProperty(func, 'toString', {
'configurable': true,
'enumerable': false,
'value': constant(string),
'writable': true
});
export default baseSetToString;