Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
feat(split): Add module split
Browse files Browse the repository at this point in the history
Split a string with give separator returning an array of strings
  • Loading branch information
adambrgmn committed Jan 16, 2018
1 parent 8d744db commit cb09378
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/__tests__/split.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import split from '../split';

describe('Core.split', () => {
test('split a string into an array', () => {
expect(split('', 'hello')).toEqual(['h', 'e', 'l', 'l', 'o']);
expect(split('ll', 'hello')).toEqual(['he', 'o']);
});
});
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import remove from './remove';
import reverse from './reverse';
import slice from './slice';
import sort from './sort';
import split from './split';
import subtract from './subtract';
import sum from './sum';
import T from './T';
Expand Down Expand Up @@ -137,6 +138,7 @@ export {
reverse,
slice,
sort,
split,
subtract,
sum,
T,
Expand Down
3 changes: 3 additions & 0 deletions src/split.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const split = (separator, str) => str.split(separator);

export { split as default };

0 comments on commit cb09378

Please sign in to comment.