https://github.com/josephdavis/weak-split
Split a string, discarding empty leading and trailing elements in the output.
https://github.com/josephdavis/weak-split
Last synced: about 1 year ago
JSON representation
Split a string, discarding empty leading and trailing elements in the output.
- Host: GitHub
- URL: https://github.com/josephdavis/weak-split
- Owner: JosephDavis
- License: mit
- Created: 2016-02-04T04:17:33.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-04T04:30:31.000Z (over 10 years ago)
- Last Synced: 2025-02-08T06:34:31.506Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Weak Split
Split a string, discarding empty leading and trailing elements in the output.
## Example
```js
const string = 'Banana, Orange, Apple,';
string.split(/,\s?/); // ['Banana', 'Orange', 'Apple', '']
const weakSplit = require('weak-split');
weakSplit(string, /,\s?/); // ['Banana', 'Orange', 'Apple']
```
## Install
```sh
npm install weak-split --save
```