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.
- Host: GitHub
- URL: https://github.com/jaid/insert-string-before
- Owner: Jaid
- License: mit
- Created: 2019-12-30T14:48:53.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2023-03-03T18:16:46.000Z (almost 3 years ago)
- Last Synced: 2025-04-22T17:24:38.514Z (8 months ago)
- Topics: insert, insert-string, insert-string-before, lib, library, string, strings, util, utility
- Language: JavaScript
- Homepage: https://github.com/Jaid/insert-string-before
- Size: 1.83 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license.txt
Awesome Lists containing this project
README
# insert-string-before
**Inserts a string before a needle's start in a haystack.**
## Installation
```bash
npm install --save insert-string-before@^1.0.1
```
```bash
yarn add insert-string-before@^1.0.1
```
(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)