JSPM

alter

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 271782
  • Score
    100M100P100Q159355F
  • License MIT

alters a string by replacing multiple range fragments in one fast pass

Package Exports

  • alter

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (alter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

alter.js

Alters a string by replacing multiple range fragments in one fast pass. Works in node and browsers.

Usage

    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
var alter = require("alter");

Browser

Clone the repo and include it in a script tag

git clone https://github.com/olov/alter.git
<script src="alter/alter.js"></script>