This repository has been archived by the owner on Jul 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* build: update dependencies * chore: update version * ci: enable provenance of npm * feat: create SplitElementsIntoSubArrayLength Splits an array into subarrays of a specified length. * docs: update JSDoc for SplitElementsIntoArrayLength * ci: create tests with ava * ci: transform eslint.yml * ci: make eslint job is required to run ava job
- Loading branch information
1 parent
26afe14
commit 1a04897
Showing
6 changed files
with
135 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import test from 'ava' | ||
import { SplitElementsIntoArrayLength, SplitElementsIntoSubArrayLength } from '../sources/index.js' | ||
|
||
test('SplitElementsIntoArrayLength 16 elements with 4 counts', T => { | ||
const ArrayPara = [ | ||
'washable', 'kindness', 'sprain', 'undrafted', | ||
'turbulent', 'unjustly', 'spiritual', 'playroom', | ||
'subscribe', 'snowplow', 'pruning', 'upriver', | ||
'stew', 'overstep', 'motocross', 'ambiance' | ||
] | ||
const Options = { Count: 4 } | ||
const Result = SplitElementsIntoArrayLength(ArrayPara, Options) | ||
T.deepEqual(Result, [ | ||
['washable', 'kindness', 'sprain', 'undrafted'], | ||
['turbulent', 'unjustly', 'spiritual', 'playroom'], | ||
[ 'subscribe', 'snowplow', 'pruning', 'upriver'], | ||
['stew', 'overstep', 'motocross', 'ambiance'] | ||
]) | ||
}) | ||
|
||
test('SplitElementsIntoArrayLength 19 elements with 4 counts', T => { | ||
const ArrayPara = [ | ||
'washable', 'kindness', 'sprain', 'undrafted', | ||
'turbulent', 'unjustly', 'spiritual', 'playroom', | ||
'subscribe', 'snowplow', 'pruning', 'upriver', | ||
'stew', 'overstep', 'motocross', 'ambiance', | ||
'duchess', 'fancied', 'ladybug' | ||
] | ||
const Options = { Count: 4 } | ||
const Result = SplitElementsIntoArrayLength(ArrayPara, Options) | ||
T.deepEqual(Result, [ | ||
[ 'washable', 'kindness', 'sprain', 'undrafted', 'duchess' ], | ||
[ 'turbulent', 'unjustly', 'spiritual', 'playroom', 'fancied' ], | ||
[ 'subscribe', 'snowplow', 'pruning', 'upriver', 'ladybug' ], | ||
[ 'stew', 'overstep', 'motocross', 'ambiance' ] | ||
]) | ||
}) | ||
|
||
test('SplitElementsIntoSubArrayLength 16 elements with 5 counts', T => { | ||
const ArrayPara = [ | ||
'washable', 'kindness', 'sprain', 'undrafted', | ||
'turbulent', 'unjustly', 'spiritual', 'playroom', | ||
'subscribe', 'snowplow', 'pruning', 'upriver', | ||
'stew', 'overstep', 'motocross', 'ambiance' | ||
] | ||
const Options = { Count: 5 } | ||
const Result = SplitElementsIntoSubArrayLength(ArrayPara, Options) | ||
T.deepEqual(Result, [ | ||
['washable', 'kindness', 'sprain', 'undrafted', 'turbulent'], | ||
['unjustly', 'spiritual', 'playroom', 'subscribe', 'snowplow'], | ||
['pruning', 'upriver', 'stew', 'overstep', 'motocross'], | ||
['ambiance'] | ||
]) | ||
}) | ||
|
||
test('SplitElementsIntoSubArrayLength 15 elements with 5 counts', T => { | ||
const ArrayPara = [ | ||
'washable', 'kindness', 'sprain', 'undrafted', | ||
'turbulent', 'unjustly', 'spiritual', 'playroom', | ||
'subscribe', 'snowplow', 'pruning', 'upriver', | ||
'stew', 'overstep', 'motocross' | ||
] | ||
const Options = { Count: 5 } | ||
const Result = SplitElementsIntoSubArrayLength(ArrayPara, Options) | ||
T.deepEqual(Result, [ | ||
['washable', 'kindness', 'sprain', 'undrafted', 'turbulent'], | ||
['unjustly', 'spiritual', 'playroom', 'subscribe', 'snowplow'], | ||
['pruning', 'upriver', 'stew', 'overstep', 'motocross'] | ||
]) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
}, | ||
"include": [ | ||
"sources/**/*.ts", | ||
"tests/**/*.ts", | ||
".eslintrc.js" | ||
] | ||
} |