2.2.10 • Published 4 years ago

@extra-lists/partition.min v2.2.10

Weekly downloads
19
License
MIT
Repository
github
Last release
4 years ago

Segregates values by test result. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Alternatives: partition, partitionAs.

This is part of package extra-lists.

This is browserified, minified version of @extra-lists/partition. It is exported as global variable lists_partition. CDN: unpkg, jsDelivr.

lists.partition(x, ft);
// x:  lists
// ft: test function (v, k, x)
// → [satisfies, doesnt]
const lists = require('extra-lists');

var x = [['a', 'b', 'c', 'd'], [1, 2, 3, 4]];
lists.partition(x, v => v % 2 == 0).map(x => [...x]);
// [ [ [ 'b', 'd' ], [ 2, 4 ] ], [ [ 'a', 'c' ], [ 1, 3 ] ] ]

var x = [['a', 'b', 'c', 'd', 'e'], [1, 2, 3, 4, 5]];
lists.partition(x, v => v % 2 == 1).map(x => [...x]);
// [ [ [ 'a', 'c', 'e' ], [ 1, 3, 5 ] ], [ [ 'b', 'd' ], [ 2, 4 ] ] ]

References

2.2.10

4 years ago

2.2.9

4 years ago

2.2.8

4 years ago

2.2.7

4 years ago

2.2.5

5 years ago

2.2.4

5 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.0

5 years ago

2.1.3

5 years ago

2.1.6

5 years ago

2.1.5

5 years ago

2.1.8

5 years ago

2.1.7

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.0.89

5 years ago

2.0.91

5 years ago

2.1.0

5 years ago

2.0.90

5 years ago

2.0.88

5 years ago