xs typed as BoundedLengthTuple<Min, Max, Xs[number]> & Xs.
const selection = Arr.asBoundedLengthTuple(1, 5, [1, 2, 3]);
// curried version
const asSelection = Arr.asBoundedLengthTuple(1, 5);
assert.deepStrictEqual(selection, [1, 2, 3]);
assert.deepStrictEqual(asSelection([4, 5]), [4, 5]);
assert.throws(() => Arr.asBoundedLengthTuple(1, 2, [1, 2, 3]), TypeError);
Casts an array to BoundedLengthTuple<Min, Max, E> after checking that its
length is within the inclusive range [min, max].
This is the structural counterpart of asBoundedLengthArray; see
asFixedLengthTuple for when to prefer which.
xs typed as BoundedLengthTuple<Min, Max, Xs[number]> & Xs.
const selection = Arr.asBoundedLengthTuple(1, 5, [1, 2, 3]);
// curried version
const asSelection = Arr.asBoundedLengthTuple(1, 5);
assert.deepStrictEqual(selection, [1, 2, 3]);
assert.deepStrictEqual(asSelection([4, 5]), [4, 5]);
assert.throws(() => Arr.asBoundedLengthTuple(1, 2, [1, 2, 3]), TypeError);
Casts an array to
BoundedLengthTuple<Min, Max, E>after checking that its length is within the inclusive range[min, max].This is the structural counterpart of
asBoundedLengthArray; see asFixedLengthTuple for when to prefer which.