New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

replace-with-dictionary

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

replace-with-dictionary

Replace words with dictionary.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Replace with dictionary

Replace text in a file using a dictionary. You can replace in not only a single file but also multiple files at once using a list of file paths.

Install

$ npm install replace-with-dictionary

Usage(CLI)

Replace text in a single file

$ replace-with-dictionary -d <path_to_dictionary>/<your_dictionary>.js -f <path_to_your_target_file>

Replace text in multiple files (using a list of file paths)

$ replace-with-dictionary -d <path_to_dictionary>/<your_dictionary>.js -l <path_to_filelist>/<your_filelist>.txt

Options

-d, --dict     Defines a dictionary file
-f, --file     Defines a target file for replacement
-l, --list     Defines a list of target files for replacement

Files

Dictionary

JavaScript file. You write a pair of words with array for replacement. You can use a regular expression.

module.exports = [
  ['foo', 'bar'],
  ['<li(.*)>foo</li>', '<li$1>bar</li>'],
  ['(<h\\d{1}.*>)見出し(</h(\\d{1})>)', '$1heading$2'],
];

List

Text file. You write a file path each lines.

/Users/foo/1.html
/Users/foo/2.html
/Users/foo/3.html

Keywords

replace

FAQs

Package last updated on 09 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts