2.2.11 • Published 4 years ago

@extra-set/flat v2.2.11

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

Flattens nested set to given depth. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Alternatives: flat, flatMap.

This is part of package extra-set.

set.flat(x, [n], [fm], [ft]);
// x:  a nested set
// n:  maximum depth (-1 => all)
// fm: map function (v, v, x)
// ft: test function (v, v, x)
const set = require("extra-set");

var x = new Set([
  new Set([1, 2]),
  new Set([3, new Set([4, new Set([5])])])
]);
set.flat(x);
// Set(5) { 1, 2, 3, 4, 5 }

set.flat(x, 1);
// Set(4) { 1, 2, 3, Set(2) { 4, Set(1) { 5 } } }

set.flat(x, 2);
// Set(5) { 1, 2, 3, 4, Set(1) { 5 } }

References

2.2.11

4 years ago

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.1

5 years ago

2.2.0

5 years ago

2.1.63

5 years ago

2.1.61

5 years ago

2.1.62

5 years ago

2.1.58

5 years ago

2.1.59

5 years ago

2.1.60

5 years ago

2.1.57

5 years ago

2.1.56

5 years ago

2.1.55

5 years ago

2.1.54

5 years ago

2.1.52

5 years ago

2.1.53

5 years ago

2.1.50

5 years ago

2.1.51

5 years ago

2.1.49

5 years ago

2.1.47

5 years ago

2.1.48

5 years ago

2.1.46

5 years ago

2.1.45

5 years ago

2.1.44

5 years ago

2.1.43

5 years ago

2.1.42

5 years ago