Repository URL to install this package:
|
Version:
6.0.4 ▾
|
import funcToString from '../native/functionToString'
import hasOwnProperty from '../native/objectHasOwnProperty'
export default RegExp(
`^${funcToString
// Take an example native function source for comparison
.call(hasOwnProperty)
// Strip regex characters so we can use it for regex
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
// Remove hasOwnProperty from the template to make it generic
.replace(
/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,
'$1.*?'
)}$`
)