mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
Remove toString coercion method use.
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import toString from './toString.js'
|
||||
|
||||
/**
|
||||
* Replaces matches for `pattern` in `string` with `replacement`.
|
||||
*
|
||||
@@ -19,8 +17,7 @@ import toString from './toString.js'
|
||||
* // => 'Hi Barney'
|
||||
*/
|
||||
function replace(...args) {
|
||||
const string = toString(args[0])
|
||||
|
||||
const string = `${ args[0] }`
|
||||
return args.length < 3 ? string : string.replace(args[1], args[2])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user