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

replace-in-file

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

replace-in-file - npm Package Compare versions

Comparing version 2.6.3 to 2.6.4

2

package.json
{
"name": "replace-in-file",
"version": "2.6.3",
"version": "2.6.4",
"description": "A simple utility to quickly replace text in one or more files.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/adamreisnz/replace-in-file#readme",

@@ -76,2 +76,13 @@ # Replace in file

### Using callbacks for `to`
As the `to` parameter is passed straight to the native [String replace method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace), you can also specify a callback. The following example uses a callback to convert matching strings to lowercase:
```js
const options = {
files: 'path/to/file',
from: /SomePattern[A-Za-z-]+/g,
to: (match) => match.toLowerCase(),
};
```
### Asynchronous replacement with promises

@@ -78,0 +89,0 @@

Sorry, the diff of this file is not supported yet

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