Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 495 Bytes

readme.md

File metadata and controls

30 lines (23 loc) · 495 Bytes

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