# left-split

> Split string capture group retained on left

Latest version **1.0.0** (published 2016-03-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install left-split
pnpm add left-split
yarn add left-split
bun add left-split
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-03-24 |
| First published | 2016-03-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | James Ramsay |
| Maintainers | jramsay |
| Keywords | leftsplit, left, string, split, splitting |

## Links

- npm: https://www.npmjs.com/package/left-split
- Repository: git@github.com:jamesramsay/left-split
- Homepage: https://github.com/jamesramsay/left-split#readme
- Issues: https://github.com/jamesramsay/left-split/issues
- npm.io page: https://npm.io/package/left-split

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2016-03-24

## README

# left-split

Split string capture group is captured to the left hand array item.

[Capturing parenthesis](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split#Capturing_parentheses) return the separator as a distinct array element.
`left-split` puts it at the end of the left hand array item.

## Install

`npm install left-split`

## Usage

```javascript

leftsplit = require('left-split')

'foo bar'.split(/(\s)/)
// => ['foo', ' ', 'bar']

leftsplit('foo bar', /(\s)/)
// => ['foo ', 'bar']

'foo\nbar\n'.split(/(\r?\n)/)
// => ['foo', '\n', 'bar', '\n', '']

leftsplit('foo\nbar\n', /(\r?\n)/)
// => ['foo\n', 'bar\n', '']

```

---
_Source: https://npm.io/package/left-split · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
