replace-require-regex
regex based require/import replacements for js files
Install
yarn add replace-require-regex
Usage
const replaceRequireRegex = ; ;//=> `require('new')` ;//=> `import a from 'new'`
API
replaceRequireRegex(content, from, to)
Arguments
Name | Description | Type | Default |
---|---|---|---|
content | Could be an entire file content | string |
None |
from | old string to replace | string |
None |
to | new string to replace old with | string |
None |
Returns
Type: string
License
MIT © Dawson Botsford