🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

better-replace

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

better-replace

Use regular expressions to replace things in strings!

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
6
-25%
Maintainers
1
Weekly downloads
 
Created
Source

better-replace

  • No need to remember to add g every time
  • Less junk passed to the replacer function
npm i better-replace
betterReplace(
	/'(\w)/,
	char => `'${char}${char}${char}`,
	`How's it going y'all?  What's the haps`
) // => `How'sss it going y'aaall?  What'sss the haps`

betterReplace(
	/(\d):(\d)/g,
	(first, second) => `${second}-${first}`,
	'1:2 3:4'
) // => '2-1 4-3'

License

WTFPL

Keywords

regex

FAQs

Package last updated on 19 Dec 2017

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