type-plus 7.3.1 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +146 -183
- package/cjs/any/any_type.d.ts +8 -8
- package/cjs/any/any_type.d.ts.map +1 -1
- package/cjs/array/array.at.d.ts +3 -1
- package/cjs/array/array.at.d.ts.map +1 -1
- package/cjs/array/array.entries.d.ts +4 -3
- package/cjs/array/array.entries.d.ts.map +1 -1
- package/cjs/array/array.find_last.d.ts +3 -1
- package/cjs/array/array.find_last.d.ts.map +1 -1
- package/cjs/array/array.some.d.ts +1 -1
- package/cjs/array/array.some.d.ts.map +1 -1
- package/cjs/array/array_plus.common_prop_keys.d.ts +27 -0
- package/cjs/array/array_plus.common_prop_keys.d.ts.map +1 -0
- package/cjs/array/array_plus.common_prop_keys.js +3 -0
- package/cjs/array/array_plus.common_prop_keys.js.map +1 -0
- package/cjs/array/{array.concat.d.ts → array_plus.concat.d.ts} +4 -1
- package/cjs/array/array_plus.concat.d.ts.map +1 -0
- package/cjs/array/array_plus.concat.js +3 -0
- package/cjs/array/array_plus.concat.js.map +1 -0
- package/cjs/array/array_plus.d.ts +7 -3
- package/cjs/array/array_plus.d.ts.map +1 -1
- package/cjs/array/array_plus.drop_match.d.ts +4 -0
- package/cjs/array/array_plus.drop_match.d.ts.map +1 -0
- package/cjs/array/array_plus.drop_match.js +3 -0
- package/cjs/array/array_plus.drop_match.js.map +1 -0
- package/cjs/array/array_plus.element_match.d.ts +44 -0
- package/cjs/array/array_plus.element_match.d.ts.map +1 -0
- package/cjs/array/array_plus.element_match.js +3 -0
- package/cjs/array/array_plus.element_match.js.map +1 -0
- package/cjs/array/array_plus.filter.d.ts +2 -0
- package/cjs/array/array_plus.filter.d.ts.map +1 -0
- package/cjs/array/array_plus.filter.js +3 -0
- package/cjs/array/array_plus.filter.js.map +1 -0
- package/cjs/array/array_plus.find.d.ts +57 -0
- package/cjs/array/array_plus.find.d.ts.map +1 -0
- package/cjs/array/array_plus.find.js +3 -0
- package/cjs/array/array_plus.find.js.map +1 -0
- package/cjs/array/array_plus.pad_start.d.ts +5 -0
- package/cjs/array/array_plus.pad_start.d.ts.map +1 -0
- package/cjs/array/array_plus.pad_start.js +3 -0
- package/cjs/array/array_plus.pad_start.js.map +1 -0
- package/cjs/array/array_type.d.ts +30 -12
- package/cjs/array/array_type.d.ts.map +1 -1
- package/cjs/array/filter.d.ts +24 -4
- package/cjs/array/filter.d.ts.map +1 -1
- package/cjs/array/find_first.d.ts +62 -0
- package/cjs/array/find_first.d.ts.map +1 -0
- package/cjs/array/{array.find.js → find_first.js} +1 -1
- package/cjs/array/find_first.js.map +1 -0
- package/cjs/array/head.d.ts +30 -1
- package/cjs/array/head.d.ts.map +1 -1
- package/cjs/array/intersect_of_props.d.ts +5 -3
- package/cjs/array/intersect_of_props.d.ts.map +1 -1
- package/cjs/array/last.d.ts +27 -2
- package/cjs/array/last.d.ts.map +1 -1
- package/cjs/array/literal_array.d.ts +5 -0
- package/cjs/array/literal_array.d.ts.map +1 -1
- package/cjs/array/literal_array.js +5 -0
- package/cjs/array/literal_array.js.map +1 -1
- package/cjs/array/pad_start.d.ts +5 -5
- package/cjs/array/pad_start.d.ts.map +1 -1
- package/cjs/array/reduce_while.d.ts +6 -0
- package/cjs/array/reduce_while.d.ts.map +1 -1
- package/cjs/array/reduce_while.js +6 -0
- package/cjs/array/reduce_while.js.map +1 -1
- package/cjs/array/reverse.d.ts +5 -0
- package/cjs/array/reverse.d.ts.map +1 -1
- package/cjs/array/union_of_props.d.ts +1 -1
- package/cjs/array/union_of_props.d.ts.map +1 -1
- package/cjs/assertion/assert_type.d.ts +4 -1
- package/cjs/assertion/assert_type.d.ts.map +1 -1
- package/cjs/assertion/assert_type.js.map +1 -1
- package/cjs/functional/compose.d.ts +2 -1
- package/cjs/functional/compose.d.ts.map +1 -1
- package/cjs/functional/compose.js.map +1 -1
- package/cjs/functional/context.d.ts.map +1 -1
- package/cjs/index.d.ts +22 -3
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +9 -3
- package/cjs/index.js.map +1 -1
- package/cjs/math/numeric_struct.d.ts +1 -1
- package/cjs/math/numeric_struct.d.ts.map +1 -1
- package/cjs/mix_types/any_or_never_type.d.ts +1 -1
- package/cjs/never/never_type.d.ts +11 -0
- package/cjs/never/never_type.d.ts.map +1 -1
- package/cjs/nodejs/isNodeError.d.ts.map +1 -1
- package/cjs/nominal/brand.d.ts.map +1 -1
- package/cjs/nominal/flavor.d.ts.map +1 -1
- package/cjs/object/index.d.ts +0 -1
- package/cjs/object/index.d.ts.map +1 -1
- package/cjs/object/index.js.map +1 -1
- package/cjs/testing/test_type.d.ts +277 -233
- package/cjs/testing/test_type.d.ts.map +1 -1
- package/cjs/testing/test_type.js.map +1 -1
- package/cjs/tuple/common_prop_keys.d.ts +34 -0
- package/cjs/tuple/common_prop_keys.d.ts.map +1 -0
- package/cjs/tuple/common_prop_keys.js.map +1 -0
- package/cjs/tuple/create_tuple.d.ts.map +1 -1
- package/cjs/tuple/drop.d.ts +91 -0
- package/cjs/tuple/drop.d.ts.map +1 -0
- package/cjs/{array → tuple}/drop.js +3 -1
- package/cjs/tuple/drop.js.map +1 -0
- package/{esm/array → cjs/tuple}/tail.d.ts +1 -1
- package/cjs/{array → tuple}/tail.d.ts.map +1 -1
- package/cjs/{array → tuple}/tail.js.map +1 -1
- package/cjs/tuple/tuple_plus.common_prop_keys.d.ts +28 -0
- package/cjs/tuple/tuple_plus.common_prop_keys.d.ts.map +1 -0
- package/cjs/tuple/tuple_plus.common_prop_keys.js +3 -0
- package/cjs/tuple/tuple_plus.common_prop_keys.js.map +1 -0
- package/cjs/tuple/tuple_plus.d.ts +5 -1
- package/cjs/tuple/tuple_plus.d.ts.map +1 -1
- package/cjs/tuple/tuple_plus.drop_match.d.ts +6 -0
- package/cjs/tuple/tuple_plus.drop_match.d.ts.map +1 -0
- package/cjs/tuple/tuple_plus.drop_match.js +3 -0
- package/cjs/tuple/tuple_plus.drop_match.js.map +1 -0
- package/cjs/tuple/tuple_plus.filter.d.ts +13 -0
- package/cjs/tuple/tuple_plus.filter.d.ts.map +1 -0
- package/cjs/tuple/tuple_plus.filter.js +3 -0
- package/cjs/tuple/tuple_plus.filter.js.map +1 -0
- package/cjs/tuple/tuple_plus.find.d.ts +64 -0
- package/cjs/tuple/tuple_plus.find.d.ts.map +1 -0
- package/cjs/tuple/tuple_plus.find.js +3 -0
- package/cjs/tuple/tuple_plus.find.js.map +1 -0
- package/cjs/tuple/tuple_plus.js +0 -15
- package/cjs/tuple/tuple_plus.js.map +1 -1
- package/cjs/tuple/tuple_plus.pad_start.d.ts +11 -5
- package/cjs/tuple/tuple_plus.pad_start.d.ts.map +1 -1
- package/cjs/tuple/tuple_type.d.ts +41 -23
- package/cjs/tuple/tuple_type.d.ts.map +1 -1
- package/cjs/union/union.d.ts +33 -0
- package/cjs/union/union.d.ts.map +1 -0
- package/cjs/{array/array.concat.js → union/union.js} +1 -1
- package/cjs/union/union.js.map +1 -0
- package/cjs/unknown/unknown_type.d.ts +12 -0
- package/cjs/unknown/unknown_type.d.ts.map +1 -1
- package/cjs/utils/options.d.ts +10 -0
- package/cjs/utils/options.d.ts.map +1 -0
- package/cjs/utils/options.js +3 -0
- package/cjs/utils/options.js.map +1 -0
- package/esm/any/any_type.d.ts +8 -8
- package/esm/any/any_type.d.ts.map +1 -1
- package/esm/array/array.at.d.ts +3 -1
- package/esm/array/array.at.d.ts.map +1 -1
- package/esm/array/array.entries.d.ts +4 -3
- package/esm/array/array.entries.d.ts.map +1 -1
- package/esm/array/array.find_last.d.ts +3 -1
- package/esm/array/array.find_last.d.ts.map +1 -1
- package/esm/array/array.some.d.ts +1 -1
- package/esm/array/array.some.d.ts.map +1 -1
- package/esm/array/array_plus.common_prop_keys.d.ts +27 -0
- package/esm/array/array_plus.common_prop_keys.d.ts.map +1 -0
- package/esm/array/array_plus.common_prop_keys.js +2 -0
- package/esm/array/array_plus.common_prop_keys.js.map +1 -0
- package/esm/array/{array.concat.d.ts → array_plus.concat.d.ts} +4 -1
- package/esm/array/array_plus.concat.d.ts.map +1 -0
- package/esm/array/array_plus.concat.js +2 -0
- package/esm/array/array_plus.concat.js.map +1 -0
- package/esm/array/array_plus.d.ts +7 -3
- package/esm/array/array_plus.d.ts.map +1 -1
- package/esm/array/array_plus.drop_match.d.ts +4 -0
- package/esm/array/array_plus.drop_match.d.ts.map +1 -0
- package/esm/array/array_plus.drop_match.js +2 -0
- package/esm/array/array_plus.drop_match.js.map +1 -0
- package/esm/array/array_plus.element_match.d.ts +44 -0
- package/esm/array/array_plus.element_match.d.ts.map +1 -0
- package/esm/array/array_plus.element_match.js +2 -0
- package/esm/array/array_plus.element_match.js.map +1 -0
- package/esm/array/array_plus.filter.d.ts +2 -0
- package/esm/array/array_plus.filter.d.ts.map +1 -0
- package/esm/array/array_plus.filter.js +2 -0
- package/esm/array/array_plus.filter.js.map +1 -0
- package/esm/array/array_plus.find.d.ts +57 -0
- package/esm/array/array_plus.find.d.ts.map +1 -0
- package/esm/array/array_plus.find.js +2 -0
- package/esm/array/array_plus.find.js.map +1 -0
- package/esm/array/array_plus.pad_start.d.ts +5 -0
- package/esm/array/array_plus.pad_start.d.ts.map +1 -0
- package/esm/array/array_plus.pad_start.js +2 -0
- package/esm/array/array_plus.pad_start.js.map +1 -0
- package/esm/array/array_type.d.ts +30 -12
- package/esm/array/array_type.d.ts.map +1 -1
- package/esm/array/filter.d.ts +24 -4
- package/esm/array/filter.d.ts.map +1 -1
- package/esm/array/find_first.d.ts +62 -0
- package/esm/array/find_first.d.ts.map +1 -0
- package/esm/array/find_first.js +2 -0
- package/esm/array/find_first.js.map +1 -0
- package/esm/array/head.d.ts +30 -1
- package/esm/array/head.d.ts.map +1 -1
- package/esm/array/intersect_of_props.d.ts +5 -3
- package/esm/array/intersect_of_props.d.ts.map +1 -1
- package/esm/array/last.d.ts +27 -2
- package/esm/array/last.d.ts.map +1 -1
- package/esm/array/literal_array.d.ts +5 -0
- package/esm/array/literal_array.d.ts.map +1 -1
- package/esm/array/literal_array.js +5 -0
- package/esm/array/literal_array.js.map +1 -1
- package/esm/array/pad_start.d.ts +5 -5
- package/esm/array/pad_start.d.ts.map +1 -1
- package/esm/array/reduce_while.d.ts +6 -0
- package/esm/array/reduce_while.d.ts.map +1 -1
- package/esm/array/reduce_while.js +6 -0
- package/esm/array/reduce_while.js.map +1 -1
- package/esm/array/reverse.d.ts +5 -0
- package/esm/array/reverse.d.ts.map +1 -1
- package/esm/array/union_of_props.d.ts +1 -1
- package/esm/array/union_of_props.d.ts.map +1 -1
- package/esm/assertion/assert_type.d.ts +4 -1
- package/esm/assertion/assert_type.d.ts.map +1 -1
- package/esm/assertion/assert_type.js.map +1 -1
- package/esm/functional/compose.d.ts +2 -1
- package/esm/functional/compose.d.ts.map +1 -1
- package/esm/functional/compose.js.map +1 -1
- package/esm/functional/context.d.ts.map +1 -1
- package/esm/index.d.ts +22 -3
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +4 -2
- package/esm/index.js.map +1 -1
- package/esm/math/numeric_struct.d.ts +1 -1
- package/esm/math/numeric_struct.d.ts.map +1 -1
- package/esm/mix_types/any_or_never_type.d.ts +1 -1
- package/esm/never/never_type.d.ts +11 -0
- package/esm/never/never_type.d.ts.map +1 -1
- package/esm/nodejs/isNodeError.d.ts.map +1 -1
- package/esm/nominal/brand.d.ts.map +1 -1
- package/esm/nominal/flavor.d.ts.map +1 -1
- package/esm/object/index.d.ts +0 -1
- package/esm/object/index.d.ts.map +1 -1
- package/esm/object/index.js.map +1 -1
- package/esm/testing/test_type.d.ts +277 -233
- package/esm/testing/test_type.d.ts.map +1 -1
- package/esm/testing/test_type.js.map +1 -1
- package/esm/tuple/common_prop_keys.d.ts +34 -0
- package/esm/tuple/common_prop_keys.d.ts.map +1 -0
- package/esm/tuple/common_prop_keys.js.map +1 -0
- package/esm/tuple/create_tuple.d.ts.map +1 -1
- package/esm/tuple/drop.d.ts +91 -0
- package/esm/tuple/drop.d.ts.map +1 -0
- package/esm/tuple/drop.js +9 -0
- package/esm/tuple/drop.js.map +1 -0
- package/{cjs/array → esm/tuple}/tail.d.ts +1 -1
- package/esm/{array → tuple}/tail.d.ts.map +1 -1
- package/esm/{array → tuple}/tail.js.map +1 -1
- package/esm/tuple/tuple_plus.common_prop_keys.d.ts +28 -0
- package/esm/tuple/tuple_plus.common_prop_keys.d.ts.map +1 -0
- package/esm/tuple/tuple_plus.common_prop_keys.js +2 -0
- package/esm/tuple/tuple_plus.common_prop_keys.js.map +1 -0
- package/esm/tuple/tuple_plus.d.ts +5 -1
- package/esm/tuple/tuple_plus.d.ts.map +1 -1
- package/esm/tuple/tuple_plus.drop_match.d.ts +6 -0
- package/esm/tuple/tuple_plus.drop_match.d.ts.map +1 -0
- package/esm/tuple/tuple_plus.drop_match.js +2 -0
- package/esm/tuple/tuple_plus.drop_match.js.map +1 -0
- package/esm/tuple/tuple_plus.filter.d.ts +13 -0
- package/esm/tuple/tuple_plus.filter.d.ts.map +1 -0
- package/esm/tuple/tuple_plus.filter.js +2 -0
- package/esm/tuple/tuple_plus.filter.js.map +1 -0
- package/esm/tuple/tuple_plus.find.d.ts +64 -0
- package/esm/tuple/tuple_plus.find.d.ts.map +1 -0
- package/esm/tuple/tuple_plus.find.js +2 -0
- package/esm/tuple/tuple_plus.find.js.map +1 -0
- package/esm/tuple/tuple_plus.js +1 -1
- package/esm/tuple/tuple_plus.js.map +1 -1
- package/esm/tuple/tuple_plus.pad_start.d.ts +11 -5
- package/esm/tuple/tuple_plus.pad_start.d.ts.map +1 -1
- package/esm/tuple/tuple_type.d.ts +41 -23
- package/esm/tuple/tuple_type.d.ts.map +1 -1
- package/esm/union/union.d.ts +33 -0
- package/esm/union/union.d.ts.map +1 -0
- package/esm/union/union.js +2 -0
- package/esm/union/union.js.map +1 -0
- package/esm/unknown/unknown_type.d.ts +12 -0
- package/esm/unknown/unknown_type.d.ts.map +1 -1
- package/esm/utils/options.d.ts +10 -0
- package/esm/utils/options.d.ts.map +1 -0
- package/esm/utils/options.js +2 -0
- package/esm/utils/options.js.map +1 -0
- package/package.json +12 -9
- package/ts/any/any_type.ts +8 -9
- package/ts/any/readme.md +71 -4
- package/ts/array/array.at.ts +3 -1
- package/ts/array/array.entries.ts +4 -2
- package/ts/array/array.find_last.ts +3 -1
- package/ts/array/array.some.ts +1 -1
- package/ts/array/array_plus.common_prop_keys.ts +35 -0
- package/ts/array/{array.concat.ts → array_plus.concat.ts} +3 -0
- package/ts/array/array_plus.drop_match.ts +16 -0
- package/ts/array/array_plus.element_match.ts +61 -0
- package/ts/array/array_plus.filter.ts +5 -0
- package/ts/array/array_plus.find.ts +71 -0
- package/ts/array/array_plus.pad_start.ts +13 -0
- package/ts/array/array_plus.ts +7 -3
- package/ts/array/array_type.ts +30 -12
- package/ts/array/filter.ts +27 -22
- package/ts/array/find_first.ts +71 -0
- package/ts/array/head.ts +40 -1
- package/ts/array/intersect_of_props.ts +7 -3
- package/ts/array/last.ts +36 -2
- package/ts/array/literal_array.ts +5 -0
- package/ts/array/pad_start.ts +6 -10
- package/ts/array/readme.md +297 -32
- package/ts/array/reduce_while.ts +6 -0
- package/ts/array/reverse.ts +5 -0
- package/ts/array/union_of_props.ts +1 -1
- package/ts/assertion/assert_type.ts +4 -1
- package/ts/assertion/readme.md +4 -3
- package/ts/functional/compose.ts +2 -1
- package/ts/functional/context.ts +1 -1
- package/ts/index.ts +22 -3
- package/ts/math/numeric_struct.ts +9 -9
- package/ts/mix_types/any_or_never_type.ts +1 -1
- package/ts/mix_types/readme.md +7 -1
- package/ts/never/never_type.ts +13 -0
- package/ts/nodejs/isNodeError.ts +13 -13
- package/ts/nominal/brand.ts +1 -1
- package/ts/nominal/flavor.ts +1 -1
- package/ts/object/index.ts +0 -1
- package/ts/testing/readme.md +30 -0
- package/ts/testing/test_type.ts +279 -234
- package/ts/tuple/common_prop_keys.ts +41 -0
- package/ts/tuple/create_tuple.ts +9 -9
- package/ts/tuple/drop.ts +125 -0
- package/ts/tuple/readme.md +263 -9
- package/ts/{array → tuple}/tail.ts +1 -1
- package/ts/tuple/tuple_plus.common_prop_keys.ts +47 -0
- package/ts/tuple/tuple_plus.drop_match.ts +20 -0
- package/ts/tuple/tuple_plus.filter.ts +29 -0
- package/ts/tuple/tuple_plus.find.ts +88 -0
- package/ts/tuple/tuple_plus.pad_start.ts +37 -21
- package/ts/tuple/tuple_plus.ts +5 -1
- package/ts/tuple/tuple_type.ts +67 -25
- package/ts/union/readme.md +81 -0
- package/ts/union/union.ts +37 -0
- package/ts/unknown/unknown_type.ts +13 -0
- package/ts/utils/options.ts +10 -0
- package/cjs/array/array.concat.d.ts.map +0 -1
- package/cjs/array/array.concat.js.map +0 -1
- package/cjs/array/array.find.d.ts +0 -21
- package/cjs/array/array.find.d.ts.map +0 -1
- package/cjs/array/array.find.js.map +0 -1
- package/cjs/array/common_prop_keys.d.ts +0 -11
- package/cjs/array/common_prop_keys.d.ts.map +0 -1
- package/cjs/array/common_prop_keys.js.map +0 -1
- package/cjs/array/drop.d.ts +0 -19
- package/cjs/array/drop.d.ts.map +0 -1
- package/cjs/array/drop.js.map +0 -1
- package/cjs/array/index.d.ts +0 -17
- package/cjs/array/index.d.ts.map +0 -1
- package/cjs/array/index.js +0 -33
- package/cjs/array/index.js.map +0 -1
- package/esm/array/array.concat.d.ts.map +0 -1
- package/esm/array/array.concat.js +0 -2
- package/esm/array/array.concat.js.map +0 -1
- package/esm/array/array.find.d.ts +0 -21
- package/esm/array/array.find.d.ts.map +0 -1
- package/esm/array/array.find.js +0 -2
- package/esm/array/array.find.js.map +0 -1
- package/esm/array/common_prop_keys.d.ts +0 -11
- package/esm/array/common_prop_keys.d.ts.map +0 -1
- package/esm/array/common_prop_keys.js.map +0 -1
- package/esm/array/drop.d.ts +0 -19
- package/esm/array/drop.d.ts.map +0 -1
- package/esm/array/drop.js +0 -7
- package/esm/array/drop.js.map +0 -1
- package/esm/array/index.d.ts +0 -17
- package/esm/array/index.d.ts.map +0 -1
- package/esm/array/index.js +0 -17
- package/esm/array/index.js.map +0 -1
- package/ts/array/array.find.ts +0 -32
- package/ts/array/common_prop_keys.ts +0 -18
- package/ts/array/drop.ts +0 -71
- package/ts/array/index.ts +0 -16
- /package/cjs/{array → tuple}/common_prop_keys.js +0 -0
- /package/cjs/{array → tuple}/tail.js +0 -0
- /package/esm/{array → tuple}/common_prop_keys.js +0 -0
- /package/esm/{array → tuple}/tail.js +0 -0
package/ts/tuple/tuple_type.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import type { IsNever } from '../never/never_type.js'
|
|
1
|
+
import type { IsNever, NeverType } from '../never/never_type.js'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* 🌪️ *filter*
|
|
5
5
|
*
|
|
6
|
+
* Filter `T` to ensure it is a tuple, excluding array.
|
|
7
|
+
*
|
|
8
|
+
* @typeParam Cases['never'] Return type when `T` is `never`. Default to `Else`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
6
11
|
* ```ts
|
|
7
12
|
* type R = TupleType<[]> // []
|
|
8
13
|
* type R = TupleType<[1]> // [1]
|
|
@@ -13,52 +18,89 @@ import type { IsNever } from '../never/never_type.js'
|
|
|
13
18
|
* type R = TupleType<unknown> // never
|
|
14
19
|
* ```
|
|
15
20
|
*/
|
|
16
|
-
export type TupleType<
|
|
21
|
+
export type TupleType<
|
|
22
|
+
T,
|
|
23
|
+
Then = T,
|
|
24
|
+
Else = never,
|
|
25
|
+
Options extends TupleType.Options = TupleType.DefaultOptions<Else>
|
|
26
|
+
> = IsNever<
|
|
17
27
|
T,
|
|
18
|
-
|
|
28
|
+
Options['caseNever'],
|
|
19
29
|
[T] extends [any[]] ? (number extends T['length'] ? Else : Then) : Else
|
|
20
30
|
>
|
|
21
31
|
|
|
32
|
+
export namespace TupleType {
|
|
33
|
+
export interface Options extends NeverType.Options {
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface DefaultOptions<Else> {
|
|
37
|
+
caseNever: Else
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
22
42
|
/**
|
|
23
|
-
*
|
|
43
|
+
* 🎭 *validate*
|
|
44
|
+
*
|
|
45
|
+
* Validate that `T` is a tuple, excluding array.
|
|
24
46
|
*
|
|
25
47
|
* ```ts
|
|
26
|
-
* type R =
|
|
27
|
-
* type R = NotTupleType<[1]> // never
|
|
48
|
+
* type R = IsTuple<[]> // true
|
|
28
49
|
*
|
|
29
|
-
* type R =
|
|
30
|
-
* type R =
|
|
31
|
-
* type R =
|
|
32
|
-
* type R =
|
|
50
|
+
* type R = IsTuple<number[]> // false
|
|
51
|
+
* type R = IsTuple<string> // false
|
|
52
|
+
* type R = IsTuple<never> // false
|
|
53
|
+
* type R = IsTuple<unknown> // false
|
|
33
54
|
* ```
|
|
34
55
|
*/
|
|
35
|
-
export type
|
|
56
|
+
export type IsTuple<
|
|
57
|
+
T,
|
|
58
|
+
Then = true,
|
|
59
|
+
Else = false,
|
|
60
|
+
Options extends TupleType.Options = TupleType.DefaultOptions<Else>
|
|
61
|
+
> = TupleType<T, Then, Else, Options>
|
|
62
|
+
|
|
36
63
|
|
|
37
64
|
/**
|
|
38
|
-
*
|
|
65
|
+
* 🌪️ *filter*
|
|
66
|
+
*
|
|
67
|
+
* Filter `T` to ensure it is not an tuple, excluding array.
|
|
39
68
|
*
|
|
40
69
|
* ```ts
|
|
41
|
-
* type R =
|
|
70
|
+
* type R = NotTupleType<[]> // never
|
|
71
|
+
* type R = NotTupleType<[1]> // never
|
|
42
72
|
*
|
|
43
|
-
* type R =
|
|
44
|
-
* type R =
|
|
45
|
-
* type R =
|
|
46
|
-
* type R =
|
|
73
|
+
* type R = NotTupleType<number[]> // number[]
|
|
74
|
+
* type R = NotTupleType<string> // string
|
|
75
|
+
* type R = NotTupleType<never> // never
|
|
76
|
+
* type R = NotTupleType<unknown> // unknown
|
|
47
77
|
* ```
|
|
48
78
|
*/
|
|
49
|
-
export type
|
|
79
|
+
export type NotTupleType<
|
|
80
|
+
T,
|
|
81
|
+
Then = T,
|
|
82
|
+
Else = never,
|
|
83
|
+
Options extends TupleType.Options = TupleType.DefaultOptions<Then>
|
|
84
|
+
> = TupleType<T, Else, Then, Options>
|
|
50
85
|
|
|
51
86
|
/**
|
|
52
|
-
*
|
|
87
|
+
* 🎭 *validate*
|
|
88
|
+
*
|
|
89
|
+
* Validate that `T` is not a tuple, excluding array.
|
|
53
90
|
*
|
|
54
91
|
* ```ts
|
|
55
92
|
* type R = IsNotTuple<[]> // false
|
|
56
93
|
* type R = IsNotTuple<[1]> // false
|
|
57
94
|
*
|
|
58
|
-
* type R = IsNotTuple<number[]> //
|
|
59
|
-
* type R = IsNotTuple<string> //
|
|
60
|
-
* type R = IsNotTuple<never> //
|
|
61
|
-
* type R = IsNotTuple<unknown> //
|
|
95
|
+
* type R = IsNotTuple<number[]> // true
|
|
96
|
+
* type R = IsNotTuple<string> // true
|
|
97
|
+
* type R = IsNotTuple<never> // true
|
|
98
|
+
* type R = IsNotTuple<unknown> // true
|
|
62
99
|
* ```
|
|
63
100
|
*/
|
|
64
|
-
export type IsNotTuple<
|
|
101
|
+
export type IsNotTuple<
|
|
102
|
+
T,
|
|
103
|
+
Then = true,
|
|
104
|
+
Else = false,
|
|
105
|
+
Options extends TupleType.Options = TupleType.DefaultOptions<Then>
|
|
106
|
+
> = TupleType<T, Else, Then, Options>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# union
|
|
2
|
+
|
|
3
|
+
Union type is a type that combines multiple types as union.
|
|
4
|
+
|
|
5
|
+
A value belongs to a union type if it belongs to one (or more) of its member types.
|
|
6
|
+
|
|
7
|
+
For example:
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
type U1 = string | number
|
|
11
|
+
|
|
12
|
+
const u1: U1 = 'a'
|
|
13
|
+
const u2: U1 = 1
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
As a mental shortcut, you can think of it as an *or* operator.
|
|
17
|
+
But it is better to think of it as union of category instead.
|
|
18
|
+
|
|
19
|
+
## Union Members
|
|
20
|
+
|
|
21
|
+
Each member of a union type is referred to as the union's member.
|
|
22
|
+
|
|
23
|
+
It is useful to understand the relationship between members of a union type.
|
|
24
|
+
|
|
25
|
+
In this context, we are going to consider types as sets,
|
|
26
|
+
instead of categories, to make it easier to understand.
|
|
27
|
+
|
|
28
|
+
Given two union members of a union,
|
|
29
|
+
their relationship can be describe as "A x B" where "x" is:
|
|
30
|
+
|
|
31
|
+
- disjoint: there is no overlap between A and B (e.g. `number | string`).
|
|
32
|
+
- overlap: there are some overlap between A and B (e.g. `1 | 2` and `2 | 3` has overlap `2`)
|
|
33
|
+
- subset/superset: A is a subset of B (or B is a superset of A) when every element in A is also in B (e.g. `1 | 2` is a subset of `number`)
|
|
34
|
+
|
|
35
|
+
The union type will consider these relations when it is declared.
|
|
36
|
+
|
|
37
|
+
There are other relations between members of a union type,
|
|
38
|
+
which will affect how the union type behaves.
|
|
39
|
+
|
|
40
|
+
For example:
|
|
41
|
+
|
|
42
|
+
- property overlap: e.g. `{ a: 1 } | { a: 2 }`
|
|
43
|
+
- property overlap with extension: e.g. `{ a: 1, b?: 2 } | { a: 1, c?: 3 }`
|
|
44
|
+
|
|
45
|
+
The names of these relations are not properly defined and may change in the future.
|
|
46
|
+
|
|
47
|
+
## [UnionType](./union.ts#l13)
|
|
48
|
+
|
|
49
|
+
`UnionType<T, Then = T, Else = never>`
|
|
50
|
+
|
|
51
|
+
🌪️ *filter*
|
|
52
|
+
|
|
53
|
+
Filter the type `T` to ensure it is a union.
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import type { UnionType } from 'type-plus'
|
|
57
|
+
|
|
58
|
+
type R = UnionType<1 | 2> // 1 | 2
|
|
59
|
+
type R = UnionType<boolean> // boolean
|
|
60
|
+
type R = UnionType<number> // never
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## [IsUnion](./union.ts#l30)
|
|
64
|
+
|
|
65
|
+
🎭 *validate*
|
|
66
|
+
|
|
67
|
+
Validate that `T` is a union.
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import type { IsUnion } from 'type-plus'
|
|
71
|
+
|
|
72
|
+
type R = IsUnion<1 | 2> // true
|
|
73
|
+
type R = IsUnion<boolean> // true
|
|
74
|
+
type R = IsUnion<number> // false
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Reference
|
|
78
|
+
|
|
79
|
+
- [handbook]
|
|
80
|
+
|
|
81
|
+
[handbook]: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🌪️ *filter*
|
|
3
|
+
*
|
|
4
|
+
* Filter the type `T` to ensure it is a union.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* type R = IsUnion<'a' | 'b'> // 'a' | 'b'
|
|
9
|
+
* type R = IsUnion<boolean> // boolean
|
|
10
|
+
* type R = IsUnion<number> // never
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export type UnionType<T, Then = T, Else = never> = UnionType.Device<T, Then, Else>
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 🎭 *validate*
|
|
17
|
+
*
|
|
18
|
+
* Validate the type `T` is a union.
|
|
19
|
+
*
|
|
20
|
+
* @author Nurbol Alpysbayev
|
|
21
|
+
* @see https://stackoverflow.com/questions/53953814/typescript-check-if-a-type-is-a-union
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* type R = IsUnion<'a' | 'b'> // true
|
|
26
|
+
* type R = IsUnion<boolean> // true
|
|
27
|
+
* type R = IsUnion<number> // false
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export type IsUnion<T, Then = true, Else = false> = UnionType.Device<T, Then, Else>
|
|
31
|
+
|
|
32
|
+
export namespace UnionType {
|
|
33
|
+
export type Device<T, Then, Else, U = T> =
|
|
34
|
+
(T extends unknown ? (U extends T ? 1 : 2) : never) extends 1
|
|
35
|
+
? Else
|
|
36
|
+
: Then
|
|
37
|
+
}
|
|
@@ -53,3 +53,16 @@ export type NotUnknownType<T, Then = T, Else = never> = UnknownType<T, Else, The
|
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
55
|
export type IsNotUnknown<T, Then = true, Else = false> = UnknownType<T, Else, Then>
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 🌪️ *filter*
|
|
59
|
+
*
|
|
60
|
+
* Returns `T` if `T` is not `unknown`, otherwise `Else`.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* type R = NotUnknownOr<number, string> // number
|
|
65
|
+
* type R = NotUnknownOr<unknown, number> // number
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export type NotUnknownOr<T, Else> = UnknownType<T, Else, T>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.concat.d.ts","sourceRoot":"","sources":["../../ts/array/array.concat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.concat.js","sourceRoot":"","sources":["../../ts/array/array.concat.ts"],"names":[],"mappings":""}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { TupleType } from '../tuple/tuple_type.js';
|
|
2
|
-
/**
|
|
3
|
-
* Returns the first type in the array or tuple that matches the `Criteria`.
|
|
4
|
-
*
|
|
5
|
-
* If the `Criteria` is not met, it will return `never'.
|
|
6
|
-
*
|
|
7
|
-
* For `Array<T>`, it will return `T | undefined` if `T` satisfies `Criteria`.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* ArrayPlus.Find<Array<1 | 2 | 'x'>, number> // 1 | 2 | undefined
|
|
12
|
-
*
|
|
13
|
-
* ArrayPlus.Find<[true, 1, 'x', 3], string> // 'x'
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export type FindFirst<A extends unknown[], Criteria> = TupleType<A, A['length'] extends 0 ? never : A extends [infer Head, ...infer Tail] ? Head extends Criteria ? Head : FindFirst<Tail, Criteria> : never, A extends Array<infer T> ? (T extends Criteria ? T | undefined : never) : never>;
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated use FindFirst
|
|
19
|
-
*/
|
|
20
|
-
export type First<A extends any[], Criteria> = FindFirst<A, Criteria>;
|
|
21
|
-
//# sourceMappingURL=array.find.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.find.d.ts","sourceRoot":"","sources":["../../ts/array/array.find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAEvD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,QAAQ,IAAI,SAAS,CAC/D,CAAC,EACD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAClB,KAAK,GACL,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GACrC,IAAI,SAAS,QAAQ,GACpB,IAAI,GACJ,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,GAC1B,KAAK,EACR,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,QAAQ,GAAG,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC,GAAG,KAAK,CAC/E,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,QAAQ,IAAI,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.find.js","sourceRoot":"","sources":["../../ts/array/array.find.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Tail } from './tail.js';
|
|
2
|
-
/**
|
|
3
|
-
* Gets the common property keys of the elements in `A`.
|
|
4
|
-
*/
|
|
5
|
-
export type CommonPropKeys<A extends Record<string, unknown>[]> = A['length'] extends 0 ? never : A['length'] extends 1 ? keyof A[0] : A['length'] extends 2 ? keyof A[0] & keyof A[1] : keyof A[0] & keyof A[1] & CommonPropKeys<Tail<Tail<A>>>;
|
|
6
|
-
/**
|
|
7
|
-
* Gets the common property keys of the elements in `A`.
|
|
8
|
-
* @deprecated Please use CommonPropKeys instead.
|
|
9
|
-
*/
|
|
10
|
-
export type CommonKeys<A extends Record<string, any>[]> = CommonPropKeys<A>;
|
|
11
|
-
//# sourceMappingURL=common_prop_keys.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common_prop_keys.d.ts","sourceRoot":"","sources":["../../ts/array/common_prop_keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACpF,KAAK,GACL,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,MAAM,CAAC,CAAC,CAAC,CAAC,GACV,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GACvB,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAE1D;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,cAAc,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common_prop_keys.js","sourceRoot":"","sources":["../../ts/array/common_prop_keys.ts"],"names":[],"mappings":""}
|
package/cjs/array/drop.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { IsEqual } from '../equal/equal.js';
|
|
2
|
-
import type { NonNull, NonUndefined } from '../utils/index.js';
|
|
3
|
-
export type DropFirst<A extends any[]> = number extends A['length'] ? A : A['length'] extends 0 ? never[] : A['length'] extends 1 ? never[] : A extends [any, ...infer Tail] ? Tail : never;
|
|
4
|
-
export type DropLast<A extends any[]> = number extends A['length'] ? A : A['length'] extends 0 ? never[] : A['length'] extends 1 ? never[] : A extends [...infer Heads, any] ? Heads : never;
|
|
5
|
-
type ExcludeUnionOfEmptyTuple<A> = IsEqual<A, []> extends true ? A : Exclude<A, []>;
|
|
6
|
-
/**
|
|
7
|
-
* drops entries matching `Criteria` in array or tuple `A`.
|
|
8
|
-
*/
|
|
9
|
-
export type DropMatch<A extends Readonly<Array<any>>, Criteria> = number extends A['length'] ? A[0] extends Criteria ? never[] : undefined extends Criteria ? null extends Criteria ? Array<NonNullable<A[0]>> : Array<NonUndefined<A[0]>> : null extends Criteria ? Array<NonNull<A[0]>> : Criteria extends A[0] ? Array<Exclude<A[0], Criteria>> : A[0] extends Criteria ? A : Array<Exclude<A[0], Criteria>> : DropMatchTuple<A, Criteria>;
|
|
10
|
-
type DropMatchTuple<A extends Readonly<Array<any>>, Criteria> = A['length'] extends 0 ? A : A extends readonly [infer Head, ...infer Tail] ? Tail['length'] extends 0 ? undefined extends Criteria ? ExcludeUnionOfEmptyTuple<Head extends Criteria ? [] : [Head]> : ExcludeUnionOfEmptyTuple<Head extends Criteria ? [] : [Head]> : Exclude<Head, Criteria> extends never ? DropMatch<Tail, Criteria> : [Exclude<Head, Criteria>, ...DropMatch<Tail, Criteria>] : never[];
|
|
11
|
-
export type DropNull<A extends Array<any>> = DropMatch<A, null>;
|
|
12
|
-
export type DropNullable<A extends Array<any>> = DropMatch<A, null | undefined>;
|
|
13
|
-
export type DropUndefined<A extends Array<any>> = DropMatch<A, undefined>;
|
|
14
|
-
/**
|
|
15
|
-
* drop a particular value from an array
|
|
16
|
-
*/
|
|
17
|
-
export declare function drop<A extends Readonly<Array<any>>, C>(array: A, value: C): DropMatch<A, C>;
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=drop.d.ts.map
|
package/cjs/array/drop.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drop.d.ts","sourceRoot":"","sources":["../../ts/array/drop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAE9D,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GAChE,CAAC,GACD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,KAAK,EAAE,GACP,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,KAAK,EAAE,GACP,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,MAAM,IAAI,CAAC,GAC9B,IAAI,GACJ,KAAK,CAAA;AAER,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GAC/D,CAAC,GACD,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"version":3,"file":"drop.js","sourceRoot":"","sources":["../../ts/array/drop.ts"],"names":[],"mappings":";;;AAiEA;;GAEG;AACH,SAAgB,IAAI,CAAoC,KAAQ,EAAE,KAAQ;IACzE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,CAAoB,CAAA;AACzD,CAAC;AAFD,oBAEC"}
|
package/cjs/array/index.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from './common_prop_keys.js';
|
|
2
|
-
export * from './drop.js';
|
|
3
|
-
export * from './filter.js';
|
|
4
|
-
export * from './array.find.js';
|
|
5
|
-
export * from './array.find_last.js';
|
|
6
|
-
export * from './head.js';
|
|
7
|
-
export * from './intersect_of_props.js';
|
|
8
|
-
export * from './last.js';
|
|
9
|
-
export * from './literal_array.js';
|
|
10
|
-
export * from './pad_start.js';
|
|
11
|
-
export * from './reduce_while.js';
|
|
12
|
-
export * from './reverse.js';
|
|
13
|
-
export * from './array.some.js';
|
|
14
|
-
export * from './tail.js';
|
|
15
|
-
export * from './union_of_props.js';
|
|
16
|
-
export * from './union_of_values.js';
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
package/cjs/array/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/array/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,WAAW,CAAA;AACzB,cAAc,yBAAyB,CAAA;AACvC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA"}
|
package/cjs/array/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./common_prop_keys.js"), exports);
|
|
18
|
-
__exportStar(require("./drop.js"), exports);
|
|
19
|
-
__exportStar(require("./filter.js"), exports);
|
|
20
|
-
__exportStar(require("./array.find.js"), exports);
|
|
21
|
-
__exportStar(require("./array.find_last.js"), exports);
|
|
22
|
-
__exportStar(require("./head.js"), exports);
|
|
23
|
-
__exportStar(require("./intersect_of_props.js"), exports);
|
|
24
|
-
__exportStar(require("./last.js"), exports);
|
|
25
|
-
__exportStar(require("./literal_array.js"), exports);
|
|
26
|
-
__exportStar(require("./pad_start.js"), exports);
|
|
27
|
-
__exportStar(require("./reduce_while.js"), exports);
|
|
28
|
-
__exportStar(require("./reverse.js"), exports);
|
|
29
|
-
__exportStar(require("./array.some.js"), exports);
|
|
30
|
-
__exportStar(require("./tail.js"), exports);
|
|
31
|
-
__exportStar(require("./union_of_props.js"), exports);
|
|
32
|
-
__exportStar(require("./union_of_values.js"), exports);
|
|
33
|
-
//# sourceMappingURL=index.js.map
|
package/cjs/array/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/array/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC;AACrC,4CAAyB;AACzB,8CAA2B;AAC3B,kDAA+B;AAC/B,uDAAoC;AACpC,4CAAyB;AACzB,0DAAuC;AACvC,4CAAyB;AACzB,qDAAkC;AAClC,iDAA8B;AAC9B,oDAAiC;AACjC,+CAA4B;AAC5B,kDAA+B;AAC/B,4CAAyB;AACzB,sDAAmC;AACnC,uDAAoC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.concat.d.ts","sourceRoot":"","sources":["../../ts/array/array.concat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.concat.js","sourceRoot":"","sources":["../../ts/array/array.concat.ts"],"names":[],"mappings":""}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { TupleType } from '../tuple/tuple_type.js';
|
|
2
|
-
/**
|
|
3
|
-
* Returns the first type in the array or tuple that matches the `Criteria`.
|
|
4
|
-
*
|
|
5
|
-
* If the `Criteria` is not met, it will return `never'.
|
|
6
|
-
*
|
|
7
|
-
* For `Array<T>`, it will return `T | undefined` if `T` satisfies `Criteria`.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* ArrayPlus.Find<Array<1 | 2 | 'x'>, number> // 1 | 2 | undefined
|
|
12
|
-
*
|
|
13
|
-
* ArrayPlus.Find<[true, 1, 'x', 3], string> // 'x'
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export type FindFirst<A extends unknown[], Criteria> = TupleType<A, A['length'] extends 0 ? never : A extends [infer Head, ...infer Tail] ? Head extends Criteria ? Head : FindFirst<Tail, Criteria> : never, A extends Array<infer T> ? (T extends Criteria ? T | undefined : never) : never>;
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated use FindFirst
|
|
19
|
-
*/
|
|
20
|
-
export type First<A extends any[], Criteria> = FindFirst<A, Criteria>;
|
|
21
|
-
//# sourceMappingURL=array.find.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.find.d.ts","sourceRoot":"","sources":["../../ts/array/array.find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAEvD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,QAAQ,IAAI,SAAS,CAC/D,CAAC,EACD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAClB,KAAK,GACL,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GACrC,IAAI,SAAS,QAAQ,GACpB,IAAI,GACJ,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,GAC1B,KAAK,EACR,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,QAAQ,GAAG,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC,GAAG,KAAK,CAC/E,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,QAAQ,IAAI,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA"}
|
package/esm/array/array.find.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.find.js","sourceRoot":"","sources":["../../ts/array/array.find.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Tail } from './tail.js';
|
|
2
|
-
/**
|
|
3
|
-
* Gets the common property keys of the elements in `A`.
|
|
4
|
-
*/
|
|
5
|
-
export type CommonPropKeys<A extends Record<string, unknown>[]> = A['length'] extends 0 ? never : A['length'] extends 1 ? keyof A[0] : A['length'] extends 2 ? keyof A[0] & keyof A[1] : keyof A[0] & keyof A[1] & CommonPropKeys<Tail<Tail<A>>>;
|
|
6
|
-
/**
|
|
7
|
-
* Gets the common property keys of the elements in `A`.
|
|
8
|
-
* @deprecated Please use CommonPropKeys instead.
|
|
9
|
-
*/
|
|
10
|
-
export type CommonKeys<A extends Record<string, any>[]> = CommonPropKeys<A>;
|
|
11
|
-
//# sourceMappingURL=common_prop_keys.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common_prop_keys.d.ts","sourceRoot":"","sources":["../../ts/array/common_prop_keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACpF,KAAK,GACL,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,MAAM,CAAC,CAAC,CAAC,CAAC,GACV,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GACvB,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAE1D;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,cAAc,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common_prop_keys.js","sourceRoot":"","sources":["../../ts/array/common_prop_keys.ts"],"names":[],"mappings":""}
|
package/esm/array/drop.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { IsEqual } from '../equal/equal.js';
|
|
2
|
-
import type { NonNull, NonUndefined } from '../utils/index.js';
|
|
3
|
-
export type DropFirst<A extends any[]> = number extends A['length'] ? A : A['length'] extends 0 ? never[] : A['length'] extends 1 ? never[] : A extends [any, ...infer Tail] ? Tail : never;
|
|
4
|
-
export type DropLast<A extends any[]> = number extends A['length'] ? A : A['length'] extends 0 ? never[] : A['length'] extends 1 ? never[] : A extends [...infer Heads, any] ? Heads : never;
|
|
5
|
-
type ExcludeUnionOfEmptyTuple<A> = IsEqual<A, []> extends true ? A : Exclude<A, []>;
|
|
6
|
-
/**
|
|
7
|
-
* drops entries matching `Criteria` in array or tuple `A`.
|
|
8
|
-
*/
|
|
9
|
-
export type DropMatch<A extends Readonly<Array<any>>, Criteria> = number extends A['length'] ? A[0] extends Criteria ? never[] : undefined extends Criteria ? null extends Criteria ? Array<NonNullable<A[0]>> : Array<NonUndefined<A[0]>> : null extends Criteria ? Array<NonNull<A[0]>> : Criteria extends A[0] ? Array<Exclude<A[0], Criteria>> : A[0] extends Criteria ? A : Array<Exclude<A[0], Criteria>> : DropMatchTuple<A, Criteria>;
|
|
10
|
-
type DropMatchTuple<A extends Readonly<Array<any>>, Criteria> = A['length'] extends 0 ? A : A extends readonly [infer Head, ...infer Tail] ? Tail['length'] extends 0 ? undefined extends Criteria ? ExcludeUnionOfEmptyTuple<Head extends Criteria ? [] : [Head]> : ExcludeUnionOfEmptyTuple<Head extends Criteria ? [] : [Head]> : Exclude<Head, Criteria> extends never ? DropMatch<Tail, Criteria> : [Exclude<Head, Criteria>, ...DropMatch<Tail, Criteria>] : never[];
|
|
11
|
-
export type DropNull<A extends Array<any>> = DropMatch<A, null>;
|
|
12
|
-
export type DropNullable<A extends Array<any>> = DropMatch<A, null | undefined>;
|
|
13
|
-
export type DropUndefined<A extends Array<any>> = DropMatch<A, undefined>;
|
|
14
|
-
/**
|
|
15
|
-
* drop a particular value from an array
|
|
16
|
-
*/
|
|
17
|
-
export declare function drop<A extends Readonly<Array<any>>, C>(array: A, value: C): DropMatch<A, C>;
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=drop.d.ts.map
|
package/esm/array/drop.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drop.d.ts","sourceRoot":"","sources":["../../ts/array/drop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAE9D,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GAChE,CAAC,GACD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,KAAK,EAAE,GACP,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,KAAK,EAAE,GACP,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,MAAM,IAAI,CAAC,GAC9B,IAAI,GACJ,KAAK,CAAA;AAER,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GAC/D,CAAC,GACD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,KAAK,EAAE,GACP,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,KAAK,EAAE,GACP,CAAC,SAAS,CAAC,GAAG,MAAM,KAAK,EAA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AAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,CAAoB,CAAA;AACzD,CAAC"}
|
package/esm/array/index.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from './common_prop_keys.js';
|
|
2
|
-
export * from './drop.js';
|
|
3
|
-
export * from './filter.js';
|
|
4
|
-
export * from './array.find.js';
|
|
5
|
-
export * from './array.find_last.js';
|
|
6
|
-
export * from './head.js';
|
|
7
|
-
export * from './intersect_of_props.js';
|
|
8
|
-
export * from './last.js';
|
|
9
|
-
export * from './literal_array.js';
|
|
10
|
-
export * from './pad_start.js';
|
|
11
|
-
export * from './reduce_while.js';
|
|
12
|
-
export * from './reverse.js';
|
|
13
|
-
export * from './array.some.js';
|
|
14
|
-
export * from './tail.js';
|
|
15
|
-
export * from './union_of_props.js';
|
|
16
|
-
export * from './union_of_values.js';
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
package/esm/array/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/array/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,WAAW,CAAA;AACzB,cAAc,yBAAyB,CAAA;AACvC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA"}
|
package/esm/array/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from './common_prop_keys.js';
|
|
2
|
-
export * from './drop.js';
|
|
3
|
-
export * from './filter.js';
|
|
4
|
-
export * from './array.find.js';
|
|
5
|
-
export * from './array.find_last.js';
|
|
6
|
-
export * from './head.js';
|
|
7
|
-
export * from './intersect_of_props.js';
|
|
8
|
-
export * from './last.js';
|
|
9
|
-
export * from './literal_array.js';
|
|
10
|
-
export * from './pad_start.js';
|
|
11
|
-
export * from './reduce_while.js';
|
|
12
|
-
export * from './reverse.js';
|
|
13
|
-
export * from './array.some.js';
|
|
14
|
-
export * from './tail.js';
|
|
15
|
-
export * from './union_of_props.js';
|
|
16
|
-
export * from './union_of_values.js';
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
package/esm/array/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/array/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,WAAW,CAAA;AACzB,cAAc,yBAAyB,CAAA;AACvC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA"}
|
package/ts/array/array.find.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { TupleType } from '../tuple/tuple_type.js'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns the first type in the array or tuple that matches the `Criteria`.
|
|
5
|
-
*
|
|
6
|
-
* If the `Criteria` is not met, it will return `never'.
|
|
7
|
-
*
|
|
8
|
-
* For `Array<T>`, it will return `T | undefined` if `T` satisfies `Criteria`.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* ArrayPlus.Find<Array<1 | 2 | 'x'>, number> // 1 | 2 | undefined
|
|
13
|
-
*
|
|
14
|
-
* ArrayPlus.Find<[true, 1, 'x', 3], string> // 'x'
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export type FindFirst<A extends unknown[], Criteria> = TupleType<
|
|
18
|
-
A,
|
|
19
|
-
A['length'] extends 0
|
|
20
|
-
? never
|
|
21
|
-
: A extends [infer Head, ...infer Tail]
|
|
22
|
-
? Head extends Criteria
|
|
23
|
-
? Head
|
|
24
|
-
: FindFirst<Tail, Criteria>
|
|
25
|
-
: never,
|
|
26
|
-
A extends Array<infer T> ? (T extends Criteria ? T | undefined : never) : never
|
|
27
|
-
>
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated use FindFirst
|
|
31
|
-
*/
|
|
32
|
-
export type First<A extends any[], Criteria> = FindFirst<A, Criteria>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Tail } from './tail.js'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Gets the common property keys of the elements in `A`.
|
|
5
|
-
*/
|
|
6
|
-
export type CommonPropKeys<A extends Record<string, unknown>[]> = A['length'] extends 0
|
|
7
|
-
? never
|
|
8
|
-
: A['length'] extends 1
|
|
9
|
-
? keyof A[0]
|
|
10
|
-
: A['length'] extends 2
|
|
11
|
-
? keyof A[0] & keyof A[1]
|
|
12
|
-
: keyof A[0] & keyof A[1] & CommonPropKeys<Tail<Tail<A>>>
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Gets the common property keys of the elements in `A`.
|
|
16
|
-
* @deprecated Please use CommonPropKeys instead.
|
|
17
|
-
*/
|
|
18
|
-
export type CommonKeys<A extends Record<string, any>[]> = CommonPropKeys<A>
|