Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120297204
README.md
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jul 3, 09:21
Size
699 B
Mime Type
text/html
Expires
Sat, Jul 5, 09:21 (2 d)
Engine
blob
Format
Raw Data
Handle
27072267
Attached To
R8244 Eawag_Swing_Weight_Elicitation
README.md
View Options
# alter.js
Alters a string by replacing multiple range fragments in one fast pass.
Works in node and browsers.
## Usage
```javascript
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`
## Installation
### Node
Install using npm
npm install alter
```javascript
var alter = require("alter");
```
### Browser
Clone the repo and include it in a script tag
git clone https://github.com/olov/alter.git
```html
<script src="alter/alter.js"></script>
```
Event Timeline
Log In to Comment