structured-outputs 0.1.0-beta.2 → 0.1.0-beta.21
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +77 -6
- package/esm/ResponseFormat.d.ts +18 -11
- package/esm/ResponseFormat.d.ts.map +1 -1
- package/esm/ResponseFormat.js +57 -5
- package/esm/ResponseFormat.js.map +1 -1
- package/esm/Tool.d.ts +13 -0
- package/esm/Tool.d.ts.map +1 -0
- package/esm/Tool.js +17 -0
- package/esm/Tool.js.map +1 -0
- package/esm/_dnt.polyfills.d.ts +12 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -0
- package/esm/_dnt.polyfills.js +16 -0
- package/esm/_dnt.polyfills.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/_utils.d.ts +6 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/_utils.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/_utils.js +19 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/_utils.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.d.ts +41 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.js +51 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/associate_by.d.ts +37 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/associate_by.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/associate_by.js +45 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/associate_by.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/associate_with.d.ts +33 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/associate_with.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/associate_with.js +41 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/associate_with.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/chunk.d.ts +38 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/chunk.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/chunk.js +51 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/chunk.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/deep_merge.d.ts +322 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/deep_merge.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/deep_merge.js +96 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/deep_merge.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/distinct.d.ts +23 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/distinct.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/distinct.js +28 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/distinct.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/distinct_by.d.ts +26 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/distinct_by.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/distinct_by.js +39 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/distinct_by.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/drop_last_while.d.ts +26 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/drop_last_while.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/drop_last_while.js +33 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/drop_last_while.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/drop_while.d.ts +25 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/drop_while.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/drop_while.js +34 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/drop_while.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_entries.d.ts +32 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_entries.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_entries.js +43 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_entries.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_keys.d.ts +36 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_keys.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_keys.js +46 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_keys.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_values.d.ts +35 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_values.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_values.js +46 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_values.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/find_single.d.ts +31 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/find_single.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/find_single.js +45 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/find_single.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.d.ts +32 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.js +42 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/includes_value.d.ts +29 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/includes_value.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/includes_value.js +39 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/includes_value.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/intersect.d.ts +25 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/intersect.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/intersect.js +36 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/intersect.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/invert.d.ts +29 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/invert.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/invert.js +29 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/invert.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/invert_by.d.ts +34 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/invert_by.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/invert_by.js +46 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/invert_by.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/join_to_string.d.ts +75 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/join_to_string.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/join_to_string.js +59 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/join_to_string.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_entries.d.ts +37 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_entries.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_entries.js +47 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_entries.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_keys.d.ts +33 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_keys.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_keys.js +42 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_keys.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.d.ts +32 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.js +43 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_values.d.ts +71 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_values.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_values.js +13 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_values.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_by.d.ts +117 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_by.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_by.js +15 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_by.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_of.d.ts +61 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_of.js +17 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_of.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_with.d.ts +29 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_with.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_with.js +41 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_with.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_by.d.ts +115 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_by.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_by.js +15 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_by.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_of.d.ts +61 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_of.js +17 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_of.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_with.d.ts +25 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_with.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_with.js +37 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_with.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/mod.d.ts +73 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/mod.js +75 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/mod.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/omit.d.ts +24 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/omit.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/omit.js +29 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/omit.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/partition.d.ts +60 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/partition.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/partition.js +16 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/partition.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/partition_entries.d.ts +39 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/partition_entries.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/partition_entries.js +54 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/partition_entries.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/permutations.d.ts +27 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/permutations.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/permutations.js +58 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/permutations.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/pick.d.ts +25 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/pick.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/pick.js +33 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/pick.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/reduce_groups.d.ts +35 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/reduce_groups.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/reduce_groups.js +40 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/reduce_groups.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/running_reduce.d.ts +27 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/running_reduce.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/running_reduce.js +32 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/running_reduce.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sample.d.ts +24 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sample.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sample.js +35 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sample.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sliding_windows.d.ts +66 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sliding_windows.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sliding_windows.js +57 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sliding_windows.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sort_by.d.ts +161 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sort_by.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sort_by.js +30 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sort_by.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sum_of.d.ts +29 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sum_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sum_of.js +37 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sum_of.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/take_last_while.d.ts +27 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/take_last_while.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/take_last_while.js +34 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/take_last_while.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/take_while.d.ts +30 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/take_while.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/take_while.js +39 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/take_while.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/union.d.ts +24 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/union.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/union.js +34 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/union.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/unzip.d.ts +32 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/unzip.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/unzip.js +46 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/unzip.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/without_all.d.ts +23 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/without_all.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/without_all.js +28 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/without_all.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/zip.d.ts +34 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/zip.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/zip.js +43 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/zip.js.map +1 -0
- package/esm/mod.d.ts +3 -14
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +3 -10
- package/esm/mod.js.map +1 -1
- package/esm/oai.d.ts +5 -0
- package/esm/oai.d.ts.map +1 -0
- package/esm/oai.js +2 -0
- package/esm/oai.js.map +1 -0
- package/esm/types/Ref.d.ts +4 -0
- package/esm/types/Ref.d.ts.map +1 -0
- package/esm/types/Ref.js +11 -0
- package/esm/types/Ref.js.map +1 -0
- package/esm/types/RootTy.d.ts +8 -0
- package/esm/types/RootTy.d.ts.map +1 -0
- package/esm/types/RootTy.js +19 -0
- package/esm/types/RootTy.js.map +1 -0
- package/esm/types/Ty.d.ts +27 -0
- package/esm/types/Ty.d.ts.map +1 -0
- package/esm/types/Ty.js +17 -0
- package/esm/types/Ty.js.map +1 -0
- package/esm/types/array.d.ts +3 -0
- package/esm/types/array.d.ts.map +1 -0
- package/esm/types/array.js +9 -0
- package/esm/types/array.js.map +1 -0
- package/esm/types/constant.d.ts +3 -0
- package/esm/types/constant.d.ts.map +1 -0
- package/esm/types/constant.js +8 -0
- package/esm/types/constant.js.map +1 -0
- package/esm/types/constantUnion.d.ts +3 -0
- package/esm/types/constantUnion.d.ts.map +1 -0
- package/esm/types/constantUnion.js +25 -0
- package/esm/types/constantUnion.js.map +1 -0
- package/esm/types/leaves.d.ts +6 -0
- package/esm/types/leaves.d.ts.map +1 -0
- package/esm/types/leaves.js +18 -0
- package/esm/types/leaves.js.map +1 -0
- package/esm/types/mod.d.ts +11 -0
- package/esm/types/mod.d.ts.map +1 -0
- package/esm/types/mod.js +11 -0
- package/esm/types/mod.js.map +1 -0
- package/esm/types/object.d.ts +6 -0
- package/esm/types/object.d.ts.map +1 -0
- package/esm/{object.js → types/object.js} +4 -4
- package/esm/types/object.js.map +1 -0
- package/esm/types/std/Option.d.ts +7 -0
- package/esm/types/std/Option.d.ts.map +1 -0
- package/esm/types/std/Option.js +9 -0
- package/esm/types/std/Option.js.map +1 -0
- package/esm/types/std/Wrapper.d.ts +7 -0
- package/esm/types/std/Wrapper.d.ts.map +1 -0
- package/esm/types/std/Wrapper.js +5 -0
- package/esm/types/std/Wrapper.js.map +1 -0
- package/esm/types/std/mod.d.ts +3 -0
- package/esm/types/std/mod.d.ts.map +1 -0
- package/esm/types/std/mod.js +3 -0
- package/esm/types/std/mod.js.map +1 -0
- package/esm/types/taggedUnion.d.ts +8 -0
- package/esm/types/taggedUnion.d.ts.map +1 -0
- package/esm/types/taggedUnion.js +20 -0
- package/esm/types/taggedUnion.js.map +1 -0
- package/esm/util/phantoms.d.ts +2 -0
- package/esm/util/phantoms.d.ts.map +1 -0
- package/esm/util/phantoms.js +4 -0
- package/esm/util/phantoms.js.map +1 -0
- package/esm/util/recombineTaggedTemplateArgs.d.ts +2 -0
- package/esm/util/recombineTaggedTemplateArgs.d.ts.map +1 -0
- package/esm/util/recombineTaggedTemplateArgs.js +4 -0
- package/esm/util/recombineTaggedTemplateArgs.js.map +1 -0
- package/package.json +7 -9
- package/src/ResponseFormat.ts +80 -22
- package/src/Tool.ts +38 -0
- package/src/_dnt.polyfills.ts +27 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/_utils.ts +26 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.ts +62 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/associate_by.ts +50 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/associate_with.ts +46 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/chunk.ts +56 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/deep_merge.ts +578 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/distinct.ts +29 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/distinct_by.ts +42 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/drop_last_while.ts +36 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/drop_while.ts +39 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/filter_entries.ts +48 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/filter_keys.ts +51 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/filter_values.ts +51 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/find_single.ts +48 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.ts +47 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/includes_value.ts +45 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/intersect.ts +35 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/invert.ts +38 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/invert_by.ts +56 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/join_to_string.ts +109 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/map_entries.ts +53 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/map_keys.ts +47 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.ts +49 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/map_values.ts +96 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/max_by.ts +153 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/max_of.ts +90 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/max_with.ts +46 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/min_by.ts +151 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/min_of.ts +90 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/min_with.ts +42 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/mod.ts +76 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/omit.ts +34 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/partition.ts +85 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/partition_entries.ts +58 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/permutations.ts +66 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/pick.ts +34 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/reduce_groups.ts +45 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/running_reduce.ts +38 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/sample.ts +36 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/sliding_windows.ts +86 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/sort_by.ts +219 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/sum_of.ts +42 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/take_last_while.ts +37 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/take_while.ts +44 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/union.ts +36 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/unzip.ts +50 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/without_all.ts +28 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/zip.ts +49 -0
- package/src/mod.ts +3 -18
- package/src/oai.ts +5 -0
- package/src/types/Ref.ts +16 -0
- package/src/types/RootTy.ts +40 -0
- package/src/types/Ty.ts +57 -0
- package/src/types/array.ts +9 -0
- package/src/types/constant.ts +8 -0
- package/src/types/constantUnion.ts +27 -0
- package/src/types/leaves.ts +21 -0
- package/src/types/mod.ts +10 -0
- package/src/types/object.ts +15 -0
- package/src/types/std/Option.ts +15 -0
- package/src/types/std/Wrapper.ts +8 -0
- package/src/types/std/mod.ts +2 -0
- package/src/types/taggedUnion.ts +28 -0
- package/src/util/phantoms.ts +3 -0
- package/src/util/recombineTaggedTemplateArgs.ts +6 -0
- package/esm/F.d.ts +0 -13
- package/esm/F.d.ts.map +0 -1
- package/esm/F.js +0 -10
- package/esm/F.js.map +0 -1
- package/esm/_base.d.ts +0 -13
- package/esm/_base.d.ts.map +0 -1
- package/esm/_base.js +0 -40
- package/esm/_base.js.map +0 -1
- package/esm/array.d.ts +0 -4
- package/esm/array.d.ts.map +0 -1
- package/esm/array.js +0 -9
- package/esm/array.js.map +0 -1
- package/esm/common.d.ts +0 -6
- package/esm/common.d.ts.map +0 -1
- package/esm/common.js +0 -2
- package/esm/common.js.map +0 -1
- package/esm/literal.d.ts +0 -4
- package/esm/literal.d.ts.map +0 -1
- package/esm/literal.js +0 -8
- package/esm/literal.js.map +0 -1
- package/esm/number.d.ts +0 -4
- package/esm/number.d.ts.map +0 -1
- package/esm/number.js +0 -8
- package/esm/number.js.map +0 -1
- package/esm/object.d.ts +0 -7
- package/esm/object.d.ts.map +0 -1
- package/esm/object.js.map +0 -1
- package/esm/schema.d.ts +0 -4
- package/esm/schema.d.ts.map +0 -1
- package/esm/schema.js +0 -9
- package/esm/schema.js.map +0 -1
- package/esm/string.d.ts +0 -4
- package/esm/string.d.ts.map +0 -1
- package/esm/string.js +0 -8
- package/esm/string.js.map +0 -1
- package/esm/union.d.ts +0 -6
- package/esm/union.d.ts.map +0 -1
- package/esm/union.js +0 -8
- package/esm/union.js.map +0 -1
- package/src/F.ts +0 -27
- package/src/_base.ts +0 -25
- package/src/array.ts +0 -11
- package/src/common.ts +0 -6
- package/src/literal.ts +0 -10
- package/src/number.ts +0 -10
- package/src/object.ts +0 -17
- package/src/schema.ts +0 -10
- package/src/string.ts +0 -10
- package/src/union.ts +0 -12
@@ -0,0 +1,51 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
/**
|
4
|
+
* Splits the given array into chunks of the given size and returns them.
|
5
|
+
*
|
6
|
+
* @typeParam T Type of the elements in the input array.
|
7
|
+
*
|
8
|
+
* @param array The array to split into chunks.
|
9
|
+
* @param size The size of the chunks. This must be a positive integer.
|
10
|
+
*
|
11
|
+
* @returns An array of chunks of the given size.
|
12
|
+
*
|
13
|
+
* @example Basic usage
|
14
|
+
* ```ts
|
15
|
+
* import { chunk } from "@std/collections/chunk";
|
16
|
+
* import { assertEquals } from "@std/assert";
|
17
|
+
*
|
18
|
+
* const words = [
|
19
|
+
* "lorem",
|
20
|
+
* "ipsum",
|
21
|
+
* "dolor",
|
22
|
+
* "sit",
|
23
|
+
* "amet",
|
24
|
+
* "consetetur",
|
25
|
+
* "sadipscing",
|
26
|
+
* ];
|
27
|
+
* const chunks = chunk(words, 3);
|
28
|
+
*
|
29
|
+
* assertEquals(
|
30
|
+
* chunks,
|
31
|
+
* [
|
32
|
+
* ["lorem", "ipsum", "dolor"],
|
33
|
+
* ["sit", "amet", "consetetur"],
|
34
|
+
* ["sadipscing"],
|
35
|
+
* ],
|
36
|
+
* );
|
37
|
+
* ```
|
38
|
+
*/
|
39
|
+
export function chunk(array, size) {
|
40
|
+
if (size <= 0 || !Number.isInteger(size)) {
|
41
|
+
throw new RangeError(`Expected size to be an integer greater than 0 but found ${size}`);
|
42
|
+
}
|
43
|
+
const result = [];
|
44
|
+
let index = 0;
|
45
|
+
while (index < array.length) {
|
46
|
+
result.push(array.slice(index, index + size));
|
47
|
+
index += size;
|
48
|
+
}
|
49
|
+
return result;
|
50
|
+
}
|
51
|
+
//# sourceMappingURL=chunk.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"chunk.js","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/collections/1.0.9/chunk.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qCAAqC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,UAAU,KAAK,CAAI,KAAmB,EAAE,IAAY;IACxD,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,UAAU,CAClB,2DAA2D,IAAI,EAAE,CAClE,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAU,EAAE,CAAC;IACzB,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;QAC9C,KAAK,IAAI,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
@@ -0,0 +1,322 @@
|
|
1
|
+
/**
|
2
|
+
* Merges the two given records, recursively merging any nested records with the
|
3
|
+
* second collection overriding the first in case of conflict.
|
4
|
+
*
|
5
|
+
* For arrays, maps and sets, a merging strategy can be specified to either
|
6
|
+
* `replace` values, or `merge` them instead.
|
7
|
+
*
|
8
|
+
* @typeParam T Type of the first record
|
9
|
+
*
|
10
|
+
* @param record First record to merge.
|
11
|
+
* @param other Second record to merge.
|
12
|
+
* @param options Merging options.
|
13
|
+
*
|
14
|
+
* @returns A new record with the merged values.
|
15
|
+
*
|
16
|
+
* @example Merge objects
|
17
|
+
* ```ts
|
18
|
+
* import { deepMerge } from "@std/collections/deep-merge";
|
19
|
+
* import { assertEquals } from "@std/assert";
|
20
|
+
*
|
21
|
+
* const a = { foo: true };
|
22
|
+
* const b = { foo: { bar: true } };
|
23
|
+
*
|
24
|
+
* const result = deepMerge(a, b);
|
25
|
+
*
|
26
|
+
* const expected = { foo: { bar: true } };
|
27
|
+
*
|
28
|
+
* assertEquals(result, expected);
|
29
|
+
* ```
|
30
|
+
*
|
31
|
+
* @example Merge arrays
|
32
|
+
* ```ts
|
33
|
+
* import { deepMerge } from "@std/collections/deep-merge";
|
34
|
+
* import { assertEquals } from "@std/assert";
|
35
|
+
*
|
36
|
+
* const a = { foo: [1, 2] };
|
37
|
+
* const b = { foo: [3, 4] };
|
38
|
+
*
|
39
|
+
* const result = deepMerge(a, b);
|
40
|
+
*
|
41
|
+
* const expected = { foo: [1, 2, 3, 4] };
|
42
|
+
*
|
43
|
+
* assertEquals(result, expected);
|
44
|
+
* ```
|
45
|
+
*
|
46
|
+
* @example Merge maps
|
47
|
+
* ```ts
|
48
|
+
* import { deepMerge } from "@std/collections/deep-merge";
|
49
|
+
* import { assertEquals } from "@std/assert";
|
50
|
+
*
|
51
|
+
* const a = { foo: new Map([["a", 1]]) };
|
52
|
+
* const b = { foo: new Map([["b", 2]]) };
|
53
|
+
*
|
54
|
+
* const result = deepMerge(a, b);
|
55
|
+
*
|
56
|
+
* const expected = { foo: new Map([["a", 1], ["b", 2]]) };
|
57
|
+
*
|
58
|
+
* assertEquals(result, expected);
|
59
|
+
* ```
|
60
|
+
*
|
61
|
+
* @example Merge sets
|
62
|
+
* ```ts
|
63
|
+
* import { deepMerge } from "@std/collections/deep-merge";
|
64
|
+
* import { assertEquals } from "@std/assert";
|
65
|
+
*
|
66
|
+
* const a = { foo: new Set([1]) };
|
67
|
+
* const b = { foo: new Set([2]) };
|
68
|
+
*
|
69
|
+
* const result = deepMerge(a, b);
|
70
|
+
*
|
71
|
+
* const expected = { foo: new Set([1, 2]) };
|
72
|
+
*
|
73
|
+
* assertEquals(result, expected);
|
74
|
+
* ```
|
75
|
+
*
|
76
|
+
* @example Merge with custom options
|
77
|
+
* ```ts
|
78
|
+
* import { deepMerge } from "@std/collections/deep-merge";
|
79
|
+
* import { assertEquals } from "@std/assert";
|
80
|
+
*
|
81
|
+
* const a = { foo: [1, 2] };
|
82
|
+
* const b = { foo: [3, 4] };
|
83
|
+
*
|
84
|
+
* const result = deepMerge(a, b, { arrays: "replace" });
|
85
|
+
*
|
86
|
+
* const expected = { foo: [3, 4] };
|
87
|
+
*
|
88
|
+
* assertEquals(result, expected);
|
89
|
+
* ```
|
90
|
+
*/
|
91
|
+
export declare function deepMerge<T extends Record<PropertyKey, unknown>>(record: Partial<Readonly<T>>, other: Partial<Readonly<T>>, options?: Readonly<DeepMergeOptions>): T;
|
92
|
+
/**
|
93
|
+
* Merges the two given records, recursively merging any nested records with the
|
94
|
+
* second collection overriding the first in case of conflict.
|
95
|
+
*
|
96
|
+
* For arrays, maps and sets, a merging strategy can be specified to either
|
97
|
+
* `replace` values, or `merge` them instead.
|
98
|
+
*
|
99
|
+
* @typeParam T Type of the first record
|
100
|
+
* @typeParam U Type of the second record
|
101
|
+
* @typeParam Options Merging options
|
102
|
+
*
|
103
|
+
* @param record First record to merge.
|
104
|
+
* @param other Second record to merge.
|
105
|
+
* @param options Merging options.
|
106
|
+
*
|
107
|
+
* @returns A new record with the merged values.
|
108
|
+
*
|
109
|
+
* @example Merge objects
|
110
|
+
* ```ts
|
111
|
+
* import { deepMerge } from "@std/collections/deep-merge";
|
112
|
+
* import { assertEquals } from "@std/assert";
|
113
|
+
*
|
114
|
+
* const a = { foo: true };
|
115
|
+
* const b = { foo: { bar: true } };
|
116
|
+
*
|
117
|
+
* const result = deepMerge(a, b);
|
118
|
+
*
|
119
|
+
* const expected = { foo: { bar: true } };
|
120
|
+
*
|
121
|
+
* assertEquals(result, expected);
|
122
|
+
* ```
|
123
|
+
*
|
124
|
+
* @example Merge arrays
|
125
|
+
* ```ts
|
126
|
+
* import { deepMerge } from "@std/collections/deep-merge";
|
127
|
+
* import { assertEquals } from "@std/assert";
|
128
|
+
*
|
129
|
+
* const a = { foo: [1, 2] };
|
130
|
+
* const b = { foo: [3, 4] };
|
131
|
+
*
|
132
|
+
* const result = deepMerge(a, b);
|
133
|
+
*
|
134
|
+
* const expected = { foo: [1, 2, 3, 4] };
|
135
|
+
*
|
136
|
+
* assertEquals(result, expected);
|
137
|
+
* ```
|
138
|
+
*
|
139
|
+
* @example Merge maps
|
140
|
+
* ```ts
|
141
|
+
* import { deepMerge } from "@std/collections/deep-merge";
|
142
|
+
* import { assertEquals } from "@std/assert";
|
143
|
+
*
|
144
|
+
* const a = { foo: new Map([["a", 1]]) };
|
145
|
+
* const b = { foo: new Map([["b", 2]]) };
|
146
|
+
*
|
147
|
+
* const result = deepMerge(a, b);
|
148
|
+
*
|
149
|
+
* const expected = { foo: new Map([["a", 1], ["b", 2]]) };
|
150
|
+
*
|
151
|
+
* assertEquals(result, expected);
|
152
|
+
* ```
|
153
|
+
*
|
154
|
+
* @example Merge sets
|
155
|
+
* ```ts
|
156
|
+
* import { deepMerge } from "@std/collections/deep-merge";
|
157
|
+
* import { assertEquals } from "@std/assert";
|
158
|
+
*
|
159
|
+
* const a = { foo: new Set([1]) };
|
160
|
+
* const b = { foo: new Set([2]) };
|
161
|
+
*
|
162
|
+
* const result = deepMerge(a, b);
|
163
|
+
*
|
164
|
+
* const expected = { foo: new Set([1, 2]) };
|
165
|
+
*
|
166
|
+
* assertEquals(result, expected);
|
167
|
+
* ```
|
168
|
+
*
|
169
|
+
* @example Merge with custom options
|
170
|
+
* ```ts
|
171
|
+
* import { deepMerge } from "@std/collections/deep-merge";
|
172
|
+
* import { assertEquals } from "@std/assert";
|
173
|
+
*
|
174
|
+
* const a = { foo: [1, 2] };
|
175
|
+
* const b = { foo: [3, 4] };
|
176
|
+
*
|
177
|
+
* const result = deepMerge(a, b, { arrays: "replace" });
|
178
|
+
*
|
179
|
+
* const expected = { foo: [3, 4] };
|
180
|
+
*
|
181
|
+
* assertEquals(result, expected);
|
182
|
+
* ```
|
183
|
+
*/
|
184
|
+
export declare function deepMerge<T extends Record<PropertyKey, unknown>, U extends Record<PropertyKey, unknown>, Options extends DeepMergeOptions>(record: Readonly<T>, other: Readonly<U>, options?: Readonly<Options>): DeepMerge<T, U, Options>;
|
185
|
+
/** Merging strategy */
|
186
|
+
export type MergingStrategy = "replace" | "merge";
|
187
|
+
/** Options for {@linkcode deepMerge}. */
|
188
|
+
export type DeepMergeOptions = {
|
189
|
+
/**
|
190
|
+
* Merging strategy for arrays
|
191
|
+
*
|
192
|
+
* @default {"merge"}
|
193
|
+
*/
|
194
|
+
arrays?: MergingStrategy;
|
195
|
+
/**
|
196
|
+
* Merging strategy for maps.
|
197
|
+
*
|
198
|
+
* @default {"merge"}
|
199
|
+
*/
|
200
|
+
maps?: MergingStrategy;
|
201
|
+
/**
|
202
|
+
* Merging strategy for sets.
|
203
|
+
*
|
204
|
+
* @default {"merge"}
|
205
|
+
*/
|
206
|
+
sets?: MergingStrategy;
|
207
|
+
};
|
208
|
+
/**
|
209
|
+
* How does recursive typing works ?
|
210
|
+
*
|
211
|
+
* Deep merging process is handled through `DeepMerge<T, U, Options>` type.
|
212
|
+
* If both T and U are Records, we recursively merge them,
|
213
|
+
* else we treat them as primitives.
|
214
|
+
*
|
215
|
+
* Merging process is handled through `Merge<T, U>` type, in which
|
216
|
+
* we remove all maps, sets, arrays and records so we can handle them
|
217
|
+
* separately depending on merging strategy:
|
218
|
+
*
|
219
|
+
* Merge<
|
220
|
+
* {foo: string},
|
221
|
+
* {bar: string, baz: Set<unknown>},
|
222
|
+
* > // "foo" and "bar" will be handled with `MergeRightOmitComplexes`
|
223
|
+
* // "baz" will be handled with `MergeAll*` type
|
224
|
+
*
|
225
|
+
* `MergeRightOmitComplexes<T, U>` will do the above: all T's
|
226
|
+
* exclusive keys will be kept, though common ones with U will have their
|
227
|
+
* typing overridden instead:
|
228
|
+
*
|
229
|
+
* MergeRightOmitComplexes<
|
230
|
+
* {foo: string, baz: number},
|
231
|
+
* {foo: boolean, bar: string}
|
232
|
+
* > // {baz: number, foo: boolean, bar: string}
|
233
|
+
* // "baz" was kept from T
|
234
|
+
* // "foo" was overridden by U's typing
|
235
|
+
* // "bar" was added from U
|
236
|
+
*
|
237
|
+
* For Maps, Arrays, Sets and Records, we use `MergeAll*<T, U>` utility
|
238
|
+
* types. They will extract relevant data structure from both T and U
|
239
|
+
* (providing that both have same data data structure, except for typing).
|
240
|
+
*
|
241
|
+
* From these, `*ValueType<T>` will extract values (and keys) types to be
|
242
|
+
* able to create a new data structure with an union typing from both
|
243
|
+
* data structure of T and U:
|
244
|
+
*
|
245
|
+
* MergeAllSets<
|
246
|
+
* {foo: Set<number>},
|
247
|
+
* {foo: Set<string>}
|
248
|
+
* > // `SetValueType` will extract "number" for T
|
249
|
+
* // `SetValueType` will extract "string" for U
|
250
|
+
* // `MergeAllSets` will infer type as Set<number|string>
|
251
|
+
* // Process is similar for Maps, Arrays, and Sets
|
252
|
+
*
|
253
|
+
* `DeepMerge<T, U, Options>` is taking a third argument to be handle to
|
254
|
+
* infer final typing depending on merging strategy:
|
255
|
+
*
|
256
|
+
* & (Options extends { sets: "replace" } ? PartialByType<U, Set<unknown>>
|
257
|
+
* : MergeAllSets<T, U>)
|
258
|
+
*
|
259
|
+
* In the above line, if "Options" have its merging strategy for Sets set to
|
260
|
+
* "replace", instead of performing merging of Sets type, it will take the
|
261
|
+
* typing from right operand (U) instead, effectively replacing the typing.
|
262
|
+
*
|
263
|
+
* An additional note, we use `ExpandRecursively<T>` utility type to expand
|
264
|
+
* the resulting typing and hide all the typing logic of deep merging so it is
|
265
|
+
* more user friendly.
|
266
|
+
*/
|
267
|
+
/** Force intellisense to expand the typing to hide merging typings */
|
268
|
+
export type ExpandRecursively<T> = T extends Record<PropertyKey, unknown> ? T extends infer O ? {
|
269
|
+
[K in keyof O]: ExpandRecursively<O[K]>;
|
270
|
+
} : never : T;
|
271
|
+
/** Filter of keys matching a given type */
|
272
|
+
export type PartialByType<T, U> = {
|
273
|
+
[K in keyof T as T[K] extends U ? K : never]: T[K];
|
274
|
+
};
|
275
|
+
/** Get set values type */
|
276
|
+
export type SetValueType<T> = T extends Set<infer V> ? V : never;
|
277
|
+
/** Merge all sets types definitions from keys present in both objects */
|
278
|
+
export type MergeAllSets<T, U, X = PartialByType<T, Set<unknown>>, Y = PartialByType<U, Set<unknown>>, Z = {
|
279
|
+
[K in keyof X & keyof Y]: Set<SetValueType<X[K]> | SetValueType<Y[K]>>;
|
280
|
+
}> = Z;
|
281
|
+
/** Get array values type */
|
282
|
+
export type ArrayValueType<T> = T extends Array<infer V> ? V : never;
|
283
|
+
/** Merge all sets types definitions from keys present in both objects */
|
284
|
+
export type MergeAllArrays<T, U, X = PartialByType<T, Array<unknown>>, Y = PartialByType<U, Array<unknown>>, Z = {
|
285
|
+
[K in keyof X & keyof Y]: Array<ArrayValueType<X[K]> | ArrayValueType<Y[K]>>;
|
286
|
+
}> = Z;
|
287
|
+
/** Get map values types */
|
288
|
+
export type MapKeyType<T> = T extends Map<infer K, unknown> ? K : never;
|
289
|
+
/** Get map values types */
|
290
|
+
export type MapValueType<T> = T extends Map<unknown, infer V> ? V : never;
|
291
|
+
/** Merge all sets types definitions from keys present in both objects */
|
292
|
+
export type MergeAllMaps<T, U, X = PartialByType<T, Map<unknown, unknown>>, Y = PartialByType<U, Map<unknown, unknown>>, Z = {
|
293
|
+
[K in keyof X & keyof Y]: Map<MapKeyType<X[K]> | MapKeyType<Y[K]>, MapValueType<X[K]> | MapValueType<Y[K]>>;
|
294
|
+
}> = Z;
|
295
|
+
/** Merge all records types definitions from keys present in both objects */
|
296
|
+
export type MergeAllRecords<T, U, Options, X = PartialByType<T, Record<PropertyKey, unknown>>, Y = PartialByType<U, Record<PropertyKey, unknown>>, Z = {
|
297
|
+
[K in keyof X & keyof Y]: DeepMerge<X[K], Y[K], Options>;
|
298
|
+
}> = Z;
|
299
|
+
/** Exclude map, sets and array from type */
|
300
|
+
export type OmitComplexes<T> = Omit<T, keyof PartialByType<T, Map<unknown, unknown> | Set<unknown> | Array<unknown> | Record<PropertyKey, unknown>>>;
|
301
|
+
/** Object with keys in either T or U but not in both */
|
302
|
+
export type ObjectXorKeys<T, U, X = Omit<T, keyof U> & Omit<U, keyof T>, Y = {
|
303
|
+
[K in keyof X]: X[K];
|
304
|
+
}> = Y;
|
305
|
+
/** Merge two objects, with left precedence */
|
306
|
+
export type MergeRightOmitComplexes<T, U, X = ObjectXorKeys<T, U> & OmitComplexes<{
|
307
|
+
[K in keyof U]: U[K];
|
308
|
+
}>> = X;
|
309
|
+
/** Merge two objects */
|
310
|
+
export type Merge<T, U, Options, X = MergeRightOmitComplexes<T, U> & MergeAllRecords<T, U, Options> & (Options extends {
|
311
|
+
sets: "replace";
|
312
|
+
} ? PartialByType<U, Set<unknown>> : MergeAllSets<T, U>) & (Options extends {
|
313
|
+
arrays: "replace";
|
314
|
+
} ? PartialByType<U, Array<unknown>> : MergeAllArrays<T, U>) & (Options extends {
|
315
|
+
maps: "replace";
|
316
|
+
} ? PartialByType<U, Map<unknown, unknown>> : MergeAllMaps<T, U>)> = ExpandRecursively<X>;
|
317
|
+
/** Merge deeply two objects */
|
318
|
+
export type DeepMerge<T, U, Options = Record<string, MergingStrategy>> = [
|
319
|
+
T,
|
320
|
+
U
|
321
|
+
] extends [Record<PropertyKey, unknown>, Record<PropertyKey, unknown>] ? Merge<T, U, Options> : T | U;
|
322
|
+
//# sourceMappingURL=deep_merge.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"deep_merge.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/collections/1.0.9/deep_merge.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AACH,wBAAgB,SAAS,CACvB,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,EAEtC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAC5B,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAC3B,OAAO,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GACnC,CAAC,CAAC;AACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FG;AACH,wBAAgB,SAAS,CACvB,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,EACtC,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,EACtC,OAAO,SAAS,gBAAgB,EAEhC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EACnB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAClB,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,GAC1B,SAAS,CAAC,C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,CAAC,GACvE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,GAEpB,CAAC,GAAG,CAAC,CAAC"}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
import { filterInPlace } from "./_utils.js";
|
4
|
+
export function deepMerge(record, other, options) {
|
5
|
+
return deepMergeInternal(record, other, new Set(), options);
|
6
|
+
}
|
7
|
+
function deepMergeInternal(record, other, seen, options) {
|
8
|
+
const result = {};
|
9
|
+
const keys = new Set([
|
10
|
+
...getKeys(record),
|
11
|
+
...getKeys(other),
|
12
|
+
]);
|
13
|
+
// Iterate through each key of other object and use correct merging strategy
|
14
|
+
for (const key of keys) {
|
15
|
+
// Skip to prevent Object.prototype.__proto__ accessor property calls on non-Deno platforms
|
16
|
+
if (key === "__proto__") {
|
17
|
+
continue;
|
18
|
+
}
|
19
|
+
const a = record[key];
|
20
|
+
if (!Object.hasOwn(other, key)) {
|
21
|
+
result[key] = a;
|
22
|
+
continue;
|
23
|
+
}
|
24
|
+
const b = other[key];
|
25
|
+
if (isNonNullObject(a) && isNonNullObject(b) && !seen.has(a) && !seen.has(b)) {
|
26
|
+
seen.add(a);
|
27
|
+
seen.add(b);
|
28
|
+
result[key] = mergeObjects(a, b, seen, options);
|
29
|
+
continue;
|
30
|
+
}
|
31
|
+
// Override value
|
32
|
+
result[key] = b;
|
33
|
+
}
|
34
|
+
return result;
|
35
|
+
}
|
36
|
+
function mergeObjects(left, right, seen, options = {
|
37
|
+
arrays: "merge",
|
38
|
+
sets: "merge",
|
39
|
+
maps: "merge",
|
40
|
+
}) {
|
41
|
+
// Recursively merge mergeable objects
|
42
|
+
if (isMergeable(left) && isMergeable(right)) {
|
43
|
+
return deepMergeInternal(left, right, seen, options);
|
44
|
+
}
|
45
|
+
if (isIterable(left) && isIterable(right)) {
|
46
|
+
// Handle arrays
|
47
|
+
if ((Array.isArray(left)) && (Array.isArray(right))) {
|
48
|
+
if (options.arrays === "merge") {
|
49
|
+
return left.concat(right);
|
50
|
+
}
|
51
|
+
return right;
|
52
|
+
}
|
53
|
+
// Handle maps
|
54
|
+
if ((left instanceof Map) && (right instanceof Map)) {
|
55
|
+
if (options.maps === "merge") {
|
56
|
+
return new Map([
|
57
|
+
...left,
|
58
|
+
...right,
|
59
|
+
]);
|
60
|
+
}
|
61
|
+
return right;
|
62
|
+
}
|
63
|
+
// Handle sets
|
64
|
+
if ((left instanceof Set) && (right instanceof Set)) {
|
65
|
+
if (options.sets === "merge") {
|
66
|
+
return new Set([
|
67
|
+
...left,
|
68
|
+
...right,
|
69
|
+
]);
|
70
|
+
}
|
71
|
+
return right;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
return right;
|
75
|
+
}
|
76
|
+
/**
|
77
|
+
* Test whether a value is mergeable or not
|
78
|
+
* Builtins that look like objects, null and user defined classes
|
79
|
+
* are not considered mergeable (it means that reference will be copied)
|
80
|
+
*/
|
81
|
+
function isMergeable(value) {
|
82
|
+
return Object.getPrototypeOf(value) === Object.prototype;
|
83
|
+
}
|
84
|
+
function isIterable(value) {
|
85
|
+
return typeof value[Symbol.iterator] === "function";
|
86
|
+
}
|
87
|
+
function isNonNullObject(value) {
|
88
|
+
return value !== null && typeof value === "object";
|
89
|
+
}
|
90
|
+
function getKeys(record) {
|
91
|
+
const result = Object.getOwnPropertySymbols(record);
|
92
|
+
filterInPlace(result, (key) => Object.prototype.propertyIsEnumerable.call(record, key));
|
93
|
+
result.push(...Object.keys(record));
|
94
|
+
return result;
|
95
|
+
}
|
96
|
+
//# sourceMappingURL=deep_merge.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"deep_merge.js","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/collections/1.0.9/deep_merge.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qCAAqC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC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AO,EAAE,CAAC;gBAC7B,OAAO,IAAI,GAAG,CAAC;oBACb,GAAG,IAAI;oBACP,GAAG,KAAK;iBACT,CAAC,CAAC;YACL,CAAC;YAED,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,SAAS,WAAW,CAClB,KAA2B;IAE3B,OAAO,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,SAAS,CAAC;AAC3D,CAAC;AAED,SAAS,UAAU,CACjB,KAA2B;IAE3B,OAAO,OAAQ,KAA2B,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,UAAU,CAAC;AAC7E,CAAC;AAED,SAAS,eAAe,CACtB,KAAc;IAEd,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;AACrD,CAAC;AAED,SAAS,OAAO,CAAoC,MAAS;IAC3D,MAAM,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAmB,CAAC;IACtE,aAAa,CACX,MAAM,EACN,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CACjE,CAAC;IACF,MAAM,CAAC,IAAI,CAAC,GAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAoB,CAAC,CAAC;IAExD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/**
|
2
|
+
* Returns all distinct elements in the given array, preserving order by first
|
3
|
+
* occurrence.
|
4
|
+
*
|
5
|
+
* @typeParam T The type of the elements in the input array.
|
6
|
+
*
|
7
|
+
* @param array The array to filter for distinct elements.
|
8
|
+
*
|
9
|
+
* @returns An array of distinct elements in the input array.
|
10
|
+
*
|
11
|
+
* @example Basic usage
|
12
|
+
* ```ts
|
13
|
+
* import { distinct } from "@std/collections/distinct";
|
14
|
+
* import { assertEquals } from "@std/assert";
|
15
|
+
*
|
16
|
+
* const numbers = [3, 2, 5, 2, 5];
|
17
|
+
* const distinctNumbers = distinct(numbers);
|
18
|
+
*
|
19
|
+
* assertEquals(distinctNumbers, [3, 2, 5]);
|
20
|
+
* ```
|
21
|
+
*/
|
22
|
+
export declare function distinct<T>(array: Iterable<T>): T[];
|
23
|
+
//# sourceMappingURL=distinct.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"distinct.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/collections/1.0.9/distinct.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAInD"}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
/**
|
4
|
+
* Returns all distinct elements in the given array, preserving order by first
|
5
|
+
* occurrence.
|
6
|
+
*
|
7
|
+
* @typeParam T The type of the elements in the input array.
|
8
|
+
*
|
9
|
+
* @param array The array to filter for distinct elements.
|
10
|
+
*
|
11
|
+
* @returns An array of distinct elements in the input array.
|
12
|
+
*
|
13
|
+
* @example Basic usage
|
14
|
+
* ```ts
|
15
|
+
* import { distinct } from "@std/collections/distinct";
|
16
|
+
* import { assertEquals } from "@std/assert";
|
17
|
+
*
|
18
|
+
* const numbers = [3, 2, 5, 2, 5];
|
19
|
+
* const distinctNumbers = distinct(numbers);
|
20
|
+
*
|
21
|
+
* assertEquals(distinctNumbers, [3, 2, 5]);
|
22
|
+
* ```
|
23
|
+
*/
|
24
|
+
export function distinct(array) {
|
25
|
+
const set = new Set(array);
|
26
|
+
return Array.from(set);
|
27
|
+
}
|
28
|
+
//# sourceMappingURL=distinct.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"distinct.js","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/collections/1.0.9/distinct.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qCAAqC;AAErC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,QAAQ,CAAI,KAAkB;IAC5C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAE3B,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/**
|
2
|
+
* Returns all elements in the given array that produce a distinct value using
|
3
|
+
* the given selector, preserving order by first occurrence.
|
4
|
+
*
|
5
|
+
* @typeParam T The type of the elements in the input array.
|
6
|
+
* @typeParam D The type of the values produced by the selector function.
|
7
|
+
*
|
8
|
+
* @param array The array to filter for distinct elements.
|
9
|
+
* @param selector The function to extract the value to compare for
|
10
|
+
* distinctness.
|
11
|
+
*
|
12
|
+
* @returns An array of distinct elements in the input array.
|
13
|
+
*
|
14
|
+
* @example Basic usage
|
15
|
+
* ```ts
|
16
|
+
* import { distinctBy } from "@std/collections/distinct-by";
|
17
|
+
* import { assertEquals } from "@std/assert";
|
18
|
+
*
|
19
|
+
* const names = ["Anna", "Kim", "Arnold", "Kate"];
|
20
|
+
* const exampleNamesByFirstLetter = distinctBy(names, (name) => name.charAt(0));
|
21
|
+
*
|
22
|
+
* assertEquals(exampleNamesByFirstLetter, ["Anna", "Kim"]);
|
23
|
+
* ```
|
24
|
+
*/
|
25
|
+
export declare function distinctBy<T, D>(array: Iterable<T>, selector: (el: T) => D): T[];
|
26
|
+
//# sourceMappingURL=distinct_by.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"distinct_by.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/collections/1.0.9/distinct_by.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,EAC7B,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAClB,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GACrB,CAAC,EAAE,CAWL"}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
/**
|
4
|
+
* Returns all elements in the given array that produce a distinct value using
|
5
|
+
* the given selector, preserving order by first occurrence.
|
6
|
+
*
|
7
|
+
* @typeParam T The type of the elements in the input array.
|
8
|
+
* @typeParam D The type of the values produced by the selector function.
|
9
|
+
*
|
10
|
+
* @param array The array to filter for distinct elements.
|
11
|
+
* @param selector The function to extract the value to compare for
|
12
|
+
* distinctness.
|
13
|
+
*
|
14
|
+
* @returns An array of distinct elements in the input array.
|
15
|
+
*
|
16
|
+
* @example Basic usage
|
17
|
+
* ```ts
|
18
|
+
* import { distinctBy } from "@std/collections/distinct-by";
|
19
|
+
* import { assertEquals } from "@std/assert";
|
20
|
+
*
|
21
|
+
* const names = ["Anna", "Kim", "Arnold", "Kate"];
|
22
|
+
* const exampleNamesByFirstLetter = distinctBy(names, (name) => name.charAt(0));
|
23
|
+
*
|
24
|
+
* assertEquals(exampleNamesByFirstLetter, ["Anna", "Kim"]);
|
25
|
+
* ```
|
26
|
+
*/
|
27
|
+
export function distinctBy(array, selector) {
|
28
|
+
const selectedValues = new Set();
|
29
|
+
const result = [];
|
30
|
+
for (const element of array) {
|
31
|
+
const selected = selector(element);
|
32
|
+
if (!selectedValues.has(selected)) {
|
33
|
+
selectedValues.add(selected);
|
34
|
+
result.push(element);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
return result;
|
38
|
+
}
|
39
|
+
//# sourceMappingURL=distinct_by.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"distinct_by.js","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/collections/1.0.9/distinct_by.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qCAAqC;AAErC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,UAAU,CACxB,KAAkB,EAClB,QAAsB;IAEtB,MAAM,cAAc,GAAG,IAAI,GAAG,EAAK,CAAC;IACpC,MAAM,MAAM,GAAQ,EAAE,CAAC;IACvB,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC7B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/**
|
2
|
+
* Returns a new array that drops all elements in the given collection until the
|
3
|
+
* last element that does not match the given predicate.
|
4
|
+
*
|
5
|
+
* @typeParam T The type of the elements in the input array.
|
6
|
+
*
|
7
|
+
* @param array The array to drop elements from.
|
8
|
+
* @param predicate The function to test each element for a condition.
|
9
|
+
*
|
10
|
+
* @returns A new array that drops all elements until the last element that does
|
11
|
+
* not match the given predicate.
|
12
|
+
*
|
13
|
+
* @example Basic usage
|
14
|
+
* ```ts
|
15
|
+
* import { dropLastWhile } from "@std/collections/drop-last-while";
|
16
|
+
* import { assertEquals } from "@std/assert";
|
17
|
+
*
|
18
|
+
* const numbers = [11, 42, 55, 20, 33, 44];
|
19
|
+
*
|
20
|
+
* const notFortyFour = dropLastWhile(numbers, (number) => number > 30);
|
21
|
+
*
|
22
|
+
* assertEquals(notFortyFour, [11, 42, 55, 20]);
|
23
|
+
* ```
|
24
|
+
*/
|
25
|
+
export declare function dropLastWhile<T>(array: readonly T[], predicate: (el: T) => boolean): T[];
|
26
|
+
//# sourceMappingURL=drop_last_while.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"drop_last_while.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/collections/1.0.9/drop_last_while.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,OAAO,GAC5B,CAAC,EAAE,CAKL"}
|