Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-search-and-replace

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-search-and-replace - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

CHANGELOG.md

13

package.json
{
"name": "babel-plugin-search-and-replace",
"version": "1.1.0",
"version": "1.1.1",
"main": "lib/index.js",

@@ -8,10 +8,11 @@ "repository": "https://github.com/the-smaug/babel-plugin-search-and-replace",

"license": "MIT",
"devDependencies": {
"@babel/core": "7.18.2",
"@changesets/cli": "^2.22.0",
"jest": "28.1.0"
},
"scripts": {
"test": "jest",
"tdd": "jest --watch"
},
"devDependencies": {
"@babel/core": "7.6.4",
"jest": "24.9.0"
}
}
}
# babel-plugin-search-and-replace
## What it does ?
## What it does
It replace string you choosed during babel runtime
It replaces specified string literals
## How to use it ?
## Install
- `yarn add babel-plugin-search-and-replace -DE` or `npm i babel-plugin-search-and-replace --save-dev --exact`
- `yarn add babel-plugin-search-and-replace`
- `npm i babel-plugin-search-and-replace`
- `pnpm add babel-plugin-search-and-replace`
- Add the following lines in your .babelrc
## How to use it
Add the following lines in your .babelrc.
```json

@@ -36,2 +40,30 @@ {

If the `search` key is a string it will search exactly this string.
For example with this config
```json
"rules": [{
"search": "foo",
"replace": "baz",
}]
```
`str1` will be replaced but not str 2
```
const str1 = "foo"
const str2 = "foo don't match"
```
If you want `str2` to be replaced, use the regex syntax
```json
"rules": [{
"search": /foo/,
"replace": "baz",
}]
```
## Babel < 7
For Babel < 7 use babel-plugin-search-and-replace@0.3.0 (does not support template strings)

@@ -58,7 +90,1 @@

```
- Enjoy
- And, that's all
- Really that's all ;)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc