add-remove-replace

0.1.4 • Public • Published

add-remove-replace

Build Status

Simple library to add, remove or replace content inside strings.

Usage

Install it with npm install add-remove-replace.

Import it with

import addRemoveReplace from 'add-remove-replace';
 
addRemoveReplace.add('123', 'String'); // 123String

Or import directly add, remove or replace:

import { add, remove, replace } from 'add-remove-replace';
 
add('123', 'String'); // 123String

Functions

add

add(content: string, target: ?string, atBeginning: boolean = true)
// add 123 at the beginning
add('123', 'String'); // '123String'
 
// add 123 to the end
add('123', 'String', false); // 'String123'

remove

remove(content: string, target: ?string)
// remove all 123
remove('123', '123String'); // 'String'

replace

replace(content: string, newContent: string, target: ?string)
// replace all 123
replace('123', '_', '123String'); // '_String'

Package Sidebar

Install

npm i add-remove-replace

Weekly Downloads

1

Version

0.1.4

License

MIT

Last publish

Collaborators

  • duartealexf
  • adsonwl
  • rehnancarolino
  • tonietto