jack e1a2621c78 update | пре 2 година | |
---|---|---|
.. | ||
test | пре 2 година | |
LICENSE | пре 2 година | |
README.md | пре 2 година | |
alter.js | пре 2 година | |
package.json | пре 2 година |
Alters a string by replacing multiple range fragments in one fast pass. Works in node and browsers.
var alter = require("alter");
alter("0123456789", [
{start: 1, end: 3, str: "first"},
{start: 5, end: 9, str: "second"},
]); // => "0first34second9"
The fragments does not need to be sorted but must not overlap. More examples in test/alter-tests.js
Install using npm
npm install alter
var alter = require("alter");
Clone the repo and include it in a script tag
git clone https://github.com/olov/alter.git
<script src="alter/alter.js"></script>