mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-13 12:27:49 +00:00
Complete wrapper modules removal for setToString (c6854fa).
This commit is contained in:
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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`.
|
|
||||||
*/
|
|
||||||
function baseSetToString(func, string) {
|
|
||||||
return Object.defineProperty(func, 'toString', {
|
|
||||||
'configurable': true,
|
|
||||||
'enumerable': false,
|
|
||||||
'value': () => string,
|
|
||||||
'writable': true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseSetToString
|
|
||||||
@@ -1,6 +1,3 @@
|
|||||||
import baseSetToString from './baseSetToString.js'
|
|
||||||
import shortOut from './shortOut.js'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the `toString` method of `func` to return `string`.
|
* Sets the `toString` method of `func` to return `string`.
|
||||||
*
|
*
|
||||||
@@ -9,6 +6,13 @@ import shortOut from './shortOut.js'
|
|||||||
* @param {Function} string The `toString` result.
|
* @param {Function} string The `toString` result.
|
||||||
* @returns {Function} Returns `func`.
|
* @returns {Function} Returns `func`.
|
||||||
*/
|
*/
|
||||||
const setToString = shortOut(baseSetToString)
|
function setToString(func, string) {
|
||||||
|
return Object.defineProperty(func, 'toString', {
|
||||||
|
'configurable': true,
|
||||||
|
'enumerable': false,
|
||||||
|
'value': () => string,
|
||||||
|
'writable': true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export default setToString
|
export default setToString
|
||||||
|
|||||||
Reference in New Issue
Block a user