1.0.2 • Published 6 years ago

better-replace v1.0.2

Weekly downloads
4
License
WTFPL
Repository
github
Last release
6 years ago

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