Complete wrapper modules removal for setToString (c6854fa).

This commit is contained in:
Michał Lipiński
2017-05-09 21:02:12 +02:00
parent f6827f482d
commit 0b31164008
2 changed files with 8 additions and 22 deletions

View File

@@ -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

View File

@@ -1,6 +1,3 @@
import baseSetToString from './baseSetToString.js'
import shortOut from './shortOut.js'
/**
* Sets the `toString` method of `func` to return `string`.
*
@@ -9,6 +6,13 @@ import shortOut from './shortOut.js'
* @param {Function} string The `toString` result.
* @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