An open API service indexing awesome lists of open source software.

https://github.com/jaid/insert-string-before

Inserts a string before a needle's start in a haystack.
https://github.com/jaid/insert-string-before

insert insert-string insert-string-before lib library string strings util utility

Last synced: 8 months ago
JSON representation

Inserts a string before a needle's start in a haystack.

Awesome Lists containing this project

README

          

# insert-string-before

License Sponsor insert-string-before
Build status Commits since v1.0.1 Last commit Issues
Latest version on npm Dependents Downloads

**Inserts a string before a needle's start in a haystack.**

## Installation

insert-string-before on npm

```bash
npm install --save insert-string-before@^1.0.1
```

insert-string-before on Yarn

```bash
yarn add insert-string-before@^1.0.1
```

@jaid/insert-string-before on GitHub Packages
(if [configured properly](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-npm-for-use-with-github-packages))

```bash
npm install --save @jaid/insert-string-before@^1.0.1
```

## Example

```javascript
import insertStringBefore from "insert-string-before"

const result = insertStringBefore("I am the Hedgehog!", "the", "Sanic ")
```

Variable `result` will be:

```javascript
"I am Sanic the Hedgehog!"
```

## Development

Setting up:
```bash
git clone git@github.com:jaid/insert-string-before.git
cd insert-string-before
npm install
```
Testing:
```bash
npm run test:dev
```
Testing in production environment:
```bash
npm run test
```

## License
[MIT License](https://raw.githubusercontent.com/jaid/insert-string-before/master/license.txt)
Copyright © 2020, Jaid \ (github.com/jaid)