{"name":"replace-string","version":"3.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":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["replace","string","text","all","many","multiple","global","match","matches","replacement","replacer","modify","substring","sub-string","needle","search"],"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"b873ad85607c736834e728bf5e452f1c926432f3","bugs":{"url":"https://github.com/sindresorhus/replace-string/issues"},"homepage":"https://github.com/sindresorhus/replace-string#readme","_id":"replace-string@3.0.0","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-jE5X/k3p2v8p6+wxhM1Ti0Oj9lYtwPbMj0ty8iSFpAFIihkiNpl6uHgYW1De/r9DG3vA7HGIgIBMjlwJZXL02w==","shasum":"49deafb57839fa3bab9c11ad449b006e0d436e69","tarball":"http://registry-npm.ywwl.com/replace-string/download/replace-string-3.0.0.tgz","fileCount":5,"unpackedSize":5614,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcwqjvCRA9TVsSAnZWagAAMtMP/AmahjVJ/OsIYobdAO4O\npkEP/+vn/WMzIQ0w2SZvGBE2YJMMUjeVDP3W+NqCGMiOwxCb4/yfkFhk6Eza\nQoMkJqJI69JDMxlzCFYt/+07pTYPhlXMQALnhVQia6TzBvFXfjfhnds7sSU7\nAzDZrMp4hHent1Pjdyzl6yJk4yLmJkCVnpPD2yuUTPEjQtrin6/I8zlSFHMc\nFgzOLSAvxt6G7e9/tKzSKqBRDTNOwQXGOv1TNWuQAEq21QieyRs6ffl9iWaz\nOr6Bu6GOHkyQ6mmkSkCRw4dt7aM+5lkFqceLWSadjroWZ54k7/kI8u7gk0Fv\nlWeH9GBvnM2lBiD68j8q9KGhaQYiM22jglP1PG53zft7ayInXX15UXkJ/20d\n+74m+G5jS5jol5oItjt9Se+yLV7qFJglTSLr98/IarAOoRIAICnrrJtPb8xw\nW6OVmsWk+cXz8ZgeYvGkfTMzVXOKrPzjoKmqNC78KfcQMQ+9XTRv0zjXdwYf\nglIKN1XaELwGA+9bTjRFePXJhdR9JfmxJeOFF0CepMVXJWHJ8HXJ6viVus11\niKY8XMFBlQpxG1M+FZk16qlc+VtFs2uxMwpm6rle5972QDR828aLcsM6iE/m\nn2HtO0Jw63MhE26KSrulydFO2z8BX9BC77mx1LXcCq518pANjeXkWT96QMvc\n/CBT\r\n=tFfn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDZaf9QPM+2o5LHdbYJzQfi3t+ok/YEOtdJW/dJHwWbbAIgNzSa4RK8j2yaT8dicawKAjU0ztwNFVpsrz1Qbu7iPto="}],"size":2522,"noattachment":false,"key":"/replace-string/-/replace-string-3.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/replace-string_3.0.0_1556261103138_0.06110468490332632"},"_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":1556261103292,"_cnpm_publish_time":1556261103292,"dist-tags":{"latest":"4.0.0"}}