Socket
Socket
Sign inDemoInstall

alter

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    alter

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


Version published
Weekly downloads
151K
decreased by-15.51%
Maintainers
1
Install size
14.6 kB
Created
Weekly downloads
 

Readme

Source

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>

Keywords

FAQs

Last updated on 08 Sep 2013

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc