{"name":"replace-string","version":"2.0.0","description":"Replace all substring matches in a string","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/replace-string.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava"},"keywords":["replace","string","text","all","many","multiple","global","match","matches","replacement","replacer","modify","substring","sub-string","needle","search"],"devDependencies":{"ava":"^0.25.0","xo":"^0.23.0"},"gitHead":"4b67554beff2fde0938028cf20ead68dce87205f","bugs":{"url":"https://github.com/sindresorhus/replace-string/issues"},"homepage":"https://github.com/sindresorhus/replace-string#readme","_id":"replace-string@2.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-e6cHLIPJeIReWRcKFXdGC2bVR9dC4Bdwf2LIhzefHNPNR5ob90LtopHVGisQmaYEVfEtB945lmTA8B+e2lMJvQ==","shasum":"2ba068708a4a88672e93b83acdb9f865f9e323ef","tarball":"http://registry-npm.ywwl.com/replace-string/download/replace-string-2.0.0.tgz","fileCount":4,"unpackedSize":4475,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbxapXCRA9TVsSAnZWagAAIikP/0Rqh8HF2A3q1oGAre4g\nfC1Q7pSFS8AK2Y7aD9PpIpOTcilVWC5Tg2HpzwxVVzKZlDIs+BKJ8NvwXdqj\n7Cp4OrMXfIwD8JfMSMsneziR/9Wv4ACH+kaOa8221qenJHbTGRrbdvsPBX0J\ncguCuynWtDvEbVCZfWE+D6ij0hSDwIzqtI9pGRmTIv6B4qiZlz7iYXcwtfzh\n+gVRzCAGVSYQrwWQcBR/b9xrP1IkyY0u6ZMpepurccpQGOZdYmCgYDSvdR3c\nwD3zU8tKJtaUBWBUzenCSpis1i+1Jq9Wr/9dLbe5bO/XV4geGacORNDuvEB9\nLY/m7xo6hliC16rfajBNdL3JK7QXA25dz0gPcVKni6zJmXJ/7skvFMm9t5/0\nat+3AUpMGq0IXhiL0mNSZeMrn2TJxOGBIwGoXZZSjzyqe6r7czv6FPaVP/kc\niENVWd1gBmGIHDrh1OCzXUnFsIflyy5pwwUqcH0BbrjwwteeUPIGdQCU5Nxi\ncdS4DFHJ8fX271fvpeE15EkOYSYOSIMoQzQhNLIEmo/acFYJzd800tVSzvqN\nKLX/gwtfCVl9venug3hOBB7CIL3KbM1CG6s3NqlDC7lwQX3Z1P8yvwAQLs66\nBjZVbtrCUF3FZgE2HwMIE/5XNs72ZLtYjxFPv794dhwcPOpkHWvkDudg2E1H\nHez2\r\n=wUlx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCCIdOiFu+CDta++/O1DgxodDoniRZ7tE/hhWY9wQps9gIhAJMmz3Qj/jRys+kuoA73Msn3UhLp12ymQkqCaPVNq0Zj"}],"size":2239,"noattachment":false,"key":"/replace-string/-/replace-string-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/replace-string_2.0.0_1539680854758_0.9229143704817409"},"_hasShrinkwrap":false,"readme":"# replace-string\n\n> Replace all substring matches in a string\n\nSimilar to `String#replace()`, but supports replacing multiple matches. You could achieve something similar by putting the string in a `RegExp` constructor with the global flag and passing it to `String#replace()`, but you would then have to first escape the string anyways.\n\n*With [Node.js 16](https://medium.com/@nodejs/node-js-v15-0-0-is-here-deb00750f278), this package is partly moot as there is now a [`String#replaceAll`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll) method. However, it does not have a `caseInsensitive` option.*\n\n## Install\n\n```\n$ npm install replace-string\n```\n\n## Usage\n\n```js\nimport replaceString from 'replace-string';\n\nconst string = 'My friend has a 🐑. I want a 🐑 too!';\n\nreplaceString(string, '🐑', '🦄');\n//=> 'My friend has a 🦄. I want a 🦄 too!'\n```\n\n## API\n\n### replaceString(string, needle, replacement, options?)\n\nReturns a new string with all `needle` matches replaced with `replacement`.\n\n#### string\n\nType: `string`\n\nThe string to work on.\n\n#### needle\n\nType: `string`\n\nThe string to match in `input`.\n\n#### replacement\n\nType: `string | Function`\n\nThe replacement for `needle` matches.\n\nIf a function, it receives the matched substring, the match count, the original input, and the index in which the match happened (as measured from the original input):\n\n```js\nimport replaceString from 'replace-string';\n\nreplaceString('Foo 🐑 Bar', '🐑', (matchedSubstring, matchCount, input, matchIndex) => `${matchedSubstring}❤️`);\n//=> 'Foo 🐑❤️ Bar'\n```\n\n#### options\n\nType: `object`\n\n##### fromIndex\n\nType: `number`\\\nDefault: `0`\n\nIndex at which to start replacing.\n\n##### caseInsensitive\n\nType: `boolean`\\\nDefault: `false`\n\nWhether or not substring matching should be case-insensitive.\n\n## Related\n\n- [execall](https://github.com/sindresorhus/execall) - Find multiple `RegExp` matches in a string\n","publish_time":1539680854897,"_cnpm_publish_time":1539680854897,"dist-tags":{"latest":"4.0.0"}}