ctx-core 2.1.0 → 2.2.1
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/all/LessThan/index.d.ts +10 -0
- package/all/LessThan/index.js +1 -0
- package/all/MAX_INT/index.d.ts +1 -0
- package/all/MAX_INT/index.js +1 -0
- package/all/MIN_INT/index.d.ts +1 -0
- package/all/MIN_INT/index.js +1 -0
- package/all/Map__object/index.d.ts +5 -0
- package/all/Map__object/index.js +9 -0
- package/all/Map__object/index.test.ts +7 -0
- package/all/NoRepetition/index.d.ts +6 -0
- package/all/NoRepetition/index.js +1 -0
- package/all/NumericRange/index.d.ts +8 -0
- package/all/NumericRange/index.js +1 -0
- package/all/NumericUnit/index.d.ts +4 -0
- package/all/NumericUnit/index.js +1 -0
- package/all/PHI/index.d.ts +1 -0
- package/all/PHI/index.js +2 -0
- package/all/Request/index.d.ts +2 -0
- package/all/Request/index.js +2 -0
- package/all/Response/index.d.ts +1 -0
- package/all/Response/index.js +2 -0
- package/all/TagType/index.d.ts +2 -0
- package/all/TagType/index.js +1 -0
- package/all/Timeout/index.d.ts +1 -0
- package/all/Timeout/index.js +1 -0
- package/all/UnorderedTuple/index.d.ts +4 -0
- package/all/UnorderedTuple/index.js +1 -0
- package/all/a/index.d.ts +1 -0
- package/all/a/index.js +3 -0
- package/all/a_assign/index.d.ts +7 -0
- package/all/a_assign/index.js +12 -0
- package/all/a_in_idx_a_map/index.d.ts +12 -0
- package/all/a_in_idx_a_map/index.js +13 -0
- package/all/a_item/index.d.ts +12 -0
- package/all/a_item/index.js +1 -0
- package/all/a_length/index.d.ts +18 -0
- package/all/a_length/index.js +21 -0
- package/all/a_nowrap/index.d.ts +7 -0
- package/all/a_nowrap/index.js +1 -0
- package/all/a_present/index.d.ts +19 -0
- package/all/a_present/index.js +24 -0
- package/all/a_some/index.d.ts +13 -0
- package/all/a_some/index.js +20 -0
- package/all/abbrev_month_a/index.d.ts +2 -0
- package/all/abbrev_month_a/index.js +15 -0
- package/all/abbreviate_number_str/index.d.ts +10 -0
- package/all/abbreviate_number_str/index.js +28 -0
- package/all/acronym/index.d.ts +2 -0
- package/all/acronym/index.js +8 -0
- package/all/add/index.d.ts +11 -0
- package/all/add/index.js +24 -0
- package/all/add/index.test.ts +14 -0
- package/all/all_union_a/index.d.ts +10 -0
- package/all/all_union_a/index.js +8 -0
- package/all/and/index.d.ts +29 -0
- package/all/and/index.js +45 -0
- package/all/and/index.test.ts +10 -0
- package/all/and_call/index.d.ts +16 -0
- package/all/and_call/index.js +20 -0
- package/all/andand/index.d.ts +14 -0
- package/all/andand/index.js +19 -0
- package/all/andand_or/index.d.ts +13 -0
- package/all/andand_or/index.js +14 -0
- package/all/andandfn/index.d.ts +26 -0
- package/all/andandfn/index.js +39 -0
- package/all/apply/index.d.ts +14 -0
- package/all/apply/index.js +14 -0
- package/all/arg_i0_a/index.d.ts +11 -0
- package/all/arg_i0_a/index.js +11 -0
- package/all/array_types/index.d.ts +134 -0
- package/all/array_types/index.js +1 -0
- package/all/assign/index.d.ts +4 -0
- package/all/assign/index.js +5 -0
- package/all/assign_fn_key_a/index.d.ts +15 -0
- package/all/assign_fn_key_a/index.js +24 -0
- package/all/assign_unless_null/index.d.ts +7 -0
- package/all/assign_unless_null/index.js +11 -0
- package/all/async_gen_a/index.d.ts +3 -0
- package/all/async_gen_a/index.js +9 -0
- package/all/async_gen_a/index.test.ts +12 -0
- package/all/at_date/index.d.ts +1 -0
- package/all/at_date/index.js +9 -0
- package/all/atob/index.d.ts +3 -0
- package/all/atob/index.js +16 -0
- package/all/atob_Uint32Array/index.d.ts +5 -0
- package/all/atob_Uint32Array/index.js +16 -0
- package/all/bad_credentials/index.d.ts +30 -0
- package/all/bad_credentials/index.js +44 -0
- package/all/bad_gateway/index.d.ts +20 -0
- package/all/bad_gateway/index.js +45 -0
- package/all/bad_request/index.d.ts +20 -0
- package/all/bad_request/index.js +45 -0
- package/all/base16_random/index.d.ts +2 -0
- package/all/base16_random/index.js +14 -0
- package/all/base64__buffer/index.d.ts +6 -0
- package/all/base64__buffer/index.js +15 -0
- package/all/batch_queue/index.d.ts +5 -0
- package/all/batch_queue/index.js +44 -0
- package/all/batch_queue/index.test.ts +149 -0
- package/all/be/index.d.ts +5 -0
- package/all/be/index.js +11 -0
- package/all/be_/index.d.ts +124 -0
- package/all/be_/index.js +272 -0
- package/all/be_/index.test.ts +251 -0
- package/all/be_arg_triple/index.d.ts +21 -0
- package/all/be_arg_triple/index.js +41 -0
- package/all/be_prop_pair/index.d.ts +36 -0
- package/all/be_prop_pair/index.js +54 -0
- package/all/be_prop_pair/index.test.ts +137 -0
- package/all/binary_sort_rank/index.d.ts +12 -0
- package/all/binary_sort_rank/index.js +30 -0
- package/all/bind_apply/index.d.ts +17 -0
- package/all/bind_apply/index.js +18 -0
- package/all/bind_call/index.d.ts +21 -0
- package/all/bind_call/index.js +18 -0
- package/all/bind_map_apply/index.d.ts +17 -0
- package/all/bind_map_apply/index.js +19 -0
- package/all/bind_map_call/index.d.ts +18 -0
- package/all/bind_map_call/index.js +21 -0
- package/all/btoa/index.d.ts +3 -0
- package/all/btoa/index.js +18 -0
- package/all/btoa/index.test.ts +7 -0
- package/all/btoa_Uint32Array/index.d.ts +8 -0
- package/all/btoa_Uint32Array/index.js +20 -0
- package/all/buffer__base64/index.d.ts +6 -0
- package/all/buffer__base64/index.js +22 -0
- package/all/buffer__hex/index.d.ts +1 -0
- package/all/buffer__hex/index.js +14 -0
- package/all/call/index.d.ts +22 -0
- package/all/call/index.js +23 -0
- package/all/call_assign/index.d.ts +13 -0
- package/all/call_assign/index.js +18 -0
- package/all/call_fn_a/index.d.ts +7 -0
- package/all/call_fn_a/index.js +14 -0
- package/all/call_or_fn/index.d.ts +13 -0
- package/all/call_or_fn/index.js +20 -0
- package/all/case_insensitive_eql/index.d.ts +1 -0
- package/all/case_insensitive_eql/index.js +14 -0
- package/all/chain/index.d.ts +22 -0
- package/all/chain/index.js +48 -0
- package/all/chunk_aa/index.d.ts +35 -0
- package/all/chunk_aa/index.js +20 -0
- package/all/chunk_aa/index.test.ts +11 -0
- package/all/circular_idx/index.d.ts +10 -0
- package/all/circular_idx/index.js +13 -0
- package/all/clear_ctx/index.d.ts +10 -0
- package/all/clear_ctx/index.js +19 -0
- package/all/clone/index.d.ts +6 -0
- package/all/clone/index.js +9 -0
- package/all/clone_assign_fn_key_a/index.d.ts +14 -0
- package/all/clone_assign_fn_key_a/index.js +18 -0
- package/all/color_hex_rgb__comma_delim_str/index.d.ts +11 -0
- package/all/color_hex_rgb__comma_delim_str/index.js +16 -0
- package/all/color_hsv/index.d.ts +18 -0
- package/all/color_hsv/index.js +36 -0
- package/all/color_hsv_phi_rgb_a/index.d.ts +19 -0
- package/all/color_hsv_phi_rgb_a/index.js +32 -0
- package/all/color_invert_rgb_a/index.d.ts +12 -0
- package/all/color_invert_rgb_a/index.js +18 -0
- package/all/color_rgb/index.d.ts +7 -0
- package/all/color_rgb/index.js +22 -0
- package/all/color_rgb/index.test.ts +12 -0
- package/all/columns_nansum_matrix/index.d.ts +4 -0
- package/all/columns_nansum_matrix/index.js +17 -0
- package/all/combinators/index.d.ts +52 -0
- package/all/combinators/index.js +48 -0
- package/all/combinators/index.test.ts +8 -0
- package/all/comma_number_str/index.d.ts +2 -0
- package/all/comma_number_str/index.js +8 -0
- package/all/compact/index.d.ts +15 -0
- package/all/compact/index.js +27 -0
- package/all/compact_a_ctx/index.d.ts +11 -0
- package/all/compact_a_ctx/index.js +21 -0
- package/all/compare/index.d.ts +23 -0
- package/all/compare/index.js +32 -0
- package/all/compose/index.d.ts +9 -0
- package/all/compose/index.js +17 -0
- package/all/concat/index.d.ts +9 -0
- package/all/concat/index.js +17 -0
- package/all/concat_truthy_a/index.d.ts +15 -0
- package/all/concat_truthy_a/index.js +19 -0
- package/all/console__error/index.d.ts +7 -0
- package/all/console__error/index.js +18 -0
- package/all/crypto/index.d.ts +1 -0
- package/all/crypto/index.js +11 -0
- package/all/crypto__sign/index.d.ts +13 -0
- package/all/crypto__sign/index.js +18 -0
- package/all/ctx/index.d.ts +4 -0
- package/all/ctx/index.js +25 -0
- package/all/ctx/index.test.ts +16 -0
- package/all/currencies/index.d.ts +3 -0
- package/all/currencies/index.js +120 -0
- package/all/currency_code/index.d.ts +4 -0
- package/all/currency_code/index.js +1 -0
- package/all/currency_str/index.d.ts +23 -0
- package/all/currency_str/index.js +38 -0
- package/all/currency_symbol/index.d.ts +8 -0
- package/all/currency_symbol/index.js +19 -0
- package/all/curry/index.d.ts +14 -0
- package/all/curry/index.js +32 -0
- package/all/date/index.d.ts +15 -0
- package/all/date/index.js +5 -0
- package/all/date_append_local_tz/index.d.ts +2 -0
- package/all/date_append_local_tz/index.js +9 -0
- package/all/day/index.d.ts +7 -0
- package/all/day/index.js +8 -0
- package/all/day_seconds/index.d.ts +2 -0
- package/all/day_seconds/index.js +2 -0
- package/all/debounce/index.d.ts +22 -0
- package/all/debounce/index.js +44 -0
- package/all/debounce_mapreduce/index.d.ts +6 -0
- package/all/debounce_mapreduce/index.js +18 -0
- package/all/debounce_mapreduce/index.test.ts +26 -0
- package/all/deep_clone/index.d.ts +5 -0
- package/all/deep_clone/index.js +10 -0
- package/all/defaults/index.d.ts +6 -0
- package/all/defaults/index.js +14 -0
- package/all/deg_rad/index.d.ts +5 -0
- package/all/deg_rad/index.js +7 -0
- package/all/diff_date/index.d.ts +1 -0
- package/all/diff_date/index.js +9 -0
- package/all/difference_a/index.d.ts +12 -0
- package/all/difference_a/index.js +15 -0
- package/all/difference_by/index.d.ts +9 -0
- package/all/difference_by/index.js +30 -0
- package/all/difference_set/index.d.ts +13 -0
- package/all/difference_set/index.js +23 -0
- package/all/digest__algorithm/index.d.ts +1 -0
- package/all/digest__algorithm/index.js +1 -0
- package/all/distribution_random_float/index.d.ts +4 -0
- package/all/distribution_random_float/index.js +12 -0
- package/all/distribution_random_int/index.d.ts +4 -0
- package/all/distribution_random_int/index.js +12 -0
- package/all/div/index.d.ts +4 -0
- package/all/div/index.js +10 -0
- package/all/each/index.d.ts +14 -0
- package/all/each/index.js +23 -0
- package/all/ensure/index.d.ts +11 -0
- package/all/ensure/index.js +26 -0
- package/all/ensure__refresh/index.d.ts +20 -0
- package/all/ensure__refresh/index.js +23 -0
- package/all/entries_gen/index.d.ts +5 -0
- package/all/entries_gen/index.js +12 -0
- package/all/entries_gen/index.test.ts +20 -0
- package/all/eq/index.d.ts +21 -0
- package/all/eq/index.js +28 -0
- package/all/eql/index.d.ts +23 -0
- package/all/eql/index.js +37 -0
- package/all/eql_a/index.d.ts +11 -0
- package/all/eql_a/index.js +20 -0
- package/all/eql_fn_a/index.d.ts +16 -0
- package/all/eql_fn_a/index.js +22 -0
- package/all/equidistant_segment_point_a/index.d.ts +14 -0
- package/all/equidistant_segment_point_a/index.js +25 -0
- package/all/error__print/index.d.ts +5 -0
- package/all/error__print/index.js +18 -0
- package/all/error_o/index.d.ts +27 -0
- package/all/error_o/index.js +25 -0
- package/all/every/index.d.ts +33 -0
- package/all/every/index.js +43 -0
- package/all/every_arg/index.d.ts +15 -0
- package/all/every_arg/index.js +15 -0
- package/all/every_arg/index.test.ts +37 -0
- package/all/exclude/index.d.ts +7 -0
- package/all/exclude/index.js +17 -0
- package/all/extract/index.d.ts +14 -0
- package/all/extract/index.js +24 -0
- package/all/extract/index.test.ts +18 -0
- package/all/falsy/index.d.ts +7 -0
- package/all/falsy/index.js +1 -0
- package/all/falsy__none/index.d.ts +9 -0
- package/all/falsy__none/index.js +23 -0
- package/all/falsy__none/index.test.ts +58 -0
- package/all/falsy_async_guard/index.d.ts +7 -0
- package/all/falsy_async_guard/index.js +13 -0
- package/all/falsy_guard/index.d.ts +5 -0
- package/all/falsy_guard/index.js +13 -0
- package/all/fetch/index.d.ts +5 -0
- package/all/fetch/index.js +2 -0
- package/all/fetch__template_pair/index.d.ts +40 -0
- package/all/fetch__template_pair/index.js +20 -0
- package/all/fetch__template_pair/index.test.ts +46 -0
- package/all/fetch_method/index.d.ts +5 -0
- package/all/fetch_method/index.js +8 -0
- package/all/fetch_response__throw/index.d.ts +7 -0
- package/all/fetch_response__throw/index.js +15 -0
- package/all/fetch_response__throw/index.test.ts +19 -0
- package/all/fetch_response_pair/index.d.ts +5 -0
- package/all/fetch_response_pair/index.js +13 -0
- package/all/fibonacci_number/index.d.ts +5 -0
- package/all/fibonacci_number/index.js +11 -0
- package/all/filter/index.d.ts +35 -0
- package/all/filter/index.js +55 -0
- package/all/filter_o/index.d.ts +31 -0
- package/all/filter_o/index.js +39 -0
- package/all/find/index.d.ts +30 -0
- package/all/find/index.js +51 -0
- package/all/first/index.d.ts +17 -0
- package/all/first/index.js +23 -0
- package/all/flatten/index.d.ts +14 -0
- package/all/flatten/index.js +28 -0
- package/all/flip/index.d.ts +5 -0
- package/all/flip/index.js +10 -0
- package/all/float_isNaN/index.d.ts +2 -0
- package/all/float_isNaN/index.js +9 -0
- package/all/fn_mean/index.d.ts +13 -0
- package/all/fn_mean/index.js +21 -0
- package/all/fn_mean/index.test.ts +13 -0
- package/all/fn_pipe/index.d.ts +70 -0
- package/all/fn_pipe/index.js +11 -0
- package/all/fn_pipe/index.test.ts +18 -0
- package/all/fn_sum/index.d.ts +12 -0
- package/all/fn_sum/index.js +17 -0
- package/all/fn_sum/index.test.ts +13 -0
- package/all/format_date_prose/index.d.ts +1 -0
- package/all/format_date_prose/index.js +10 -0
- package/all/format_utc_date_prose/index.d.ts +1 -0
- package/all/format_utc_date_prose/index.js +10 -0
- package/all/globalThis__prop__ensure/index.d.ts +4 -0
- package/all/globalThis__prop__ensure/index.js +10 -0
- package/all/globalThis__prop__ensure/index.test.ts +22 -0
- package/all/gte_0_a/index.d.ts +11 -0
- package/all/gte_0_a/index.js +21 -0
- package/all/hasOwnProperty_pick/index.d.ts +9 -0
- package/all/hasOwnProperty_pick/index.js +17 -0
- package/all/has_key/index.d.ts +15 -0
- package/all/has_key/index.js +38 -0
- package/all/has_multiple/index.d.ts +9 -0
- package/all/has_multiple/index.js +14 -0
- package/all/has_some_key/index.d.ts +5 -0
- package/all/has_some_key/index.js +12 -0
- package/all/head_arg_a/index.d.ts +12 -0
- package/all/head_arg_a/index.js +15 -0
- package/all/headers/index.d.ts +2 -0
- package/all/headers/index.js +10 -0
- package/all/hex__digest/index.d.ts +5 -0
- package/all/hex__digest/index.js +24 -0
- package/all/hex_int/index.d.ts +5 -0
- package/all/hex_int/index.js +7 -0
- package/all/hmac/index.d.ts +6 -0
- package/all/hmac/index.js +32 -0
- package/all/hmac_key/index.d.ts +5 -0
- package/all/hmac_key/index.js +30 -0
- package/all/hostname/index.d.ts +2 -0
- package/all/hostname/index.js +9 -0
- package/all/hour/index.d.ts +7 -0
- package/all/hour/index.js +8 -0
- package/all/hour_seconds/index.d.ts +2 -0
- package/all/hour_seconds/index.js +2 -0
- package/all/http_error/index.d.ts +20 -0
- package/all/http_error/index.js +35 -0
- package/all/idx/index.d.ts +11 -0
- package/all/idx/index.js +17 -0
- package/all/idx_a/index.d.ts +9 -0
- package/all/idx_a/index.js +20 -0
- package/all/idx_a/index.test.ts +9 -0
- package/all/idx_filter/index.d.ts +32 -0
- package/all/idx_filter/index.js +57 -0
- package/all/idx_key_r/index.d.ts +49 -0
- package/all/idx_key_r/index.js +78 -0
- package/all/idx_reject/index.d.ts +30 -0
- package/all/idx_reject/index.js +45 -0
- package/all/idx_sort_a/index.d.ts +23 -0
- package/all/idx_sort_a/index.js +39 -0
- package/all/idx_sort_a__sort_idx_o/index.d.ts +16 -0
- package/all/idx_sort_a__sort_idx_o/index.js +21 -0
- package/all/idx_sort_r_a/index.d.ts +7 -0
- package/all/idx_sort_r_a/index.js +14 -0
- package/all/if_null_set_false/index.d.ts +7 -0
- package/all/if_null_set_false/index.js +14 -0
- package/all/ifelse/index.d.ts +6 -0
- package/all/ifelse/index.js +10 -0
- package/all/iife/index.d.ts +6 -0
- package/all/iife/index.js +9 -0
- package/all/indendation/index.d.ts +9 -0
- package/all/indendation/index.js +23 -0
- package/all/index.d.ts +408 -0
- package/all/index.js +408 -0
- package/all/indexOf/index.d.ts +6 -0
- package/all/indexOf/index.js +9 -0
- package/all/insert/index.d.ts +6 -0
- package/all/insert/index.js +10 -0
- package/all/int_hex/index.d.ts +5 -0
- package/all/int_hex/index.js +7 -0
- package/all/intersection_a/index.d.ts +15 -0
- package/all/intersection_a/index.js +15 -0
- package/all/intersection_by/index.d.ts +10 -0
- package/all/intersection_by/index.js +44 -0
- package/all/intersection_set/index.d.ts +14 -0
- package/all/intersection_set/index.js +25 -0
- package/all/invalid_argument/index.d.ts +30 -0
- package/all/invalid_argument/index.js +43 -0
- package/all/invalid_state/index.d.ts +32 -0
- package/all/invalid_state/index.js +44 -0
- package/all/invert/index.d.ts +4 -0
- package/all/invert/index.js +8 -0
- package/all/invert_idx_a/index.d.ts +12 -0
- package/all/invert_idx_a/index.js +20 -0
- package/all/invert_idx_a/index.test.ts +7 -0
- package/all/isArray/index.d.ts +5 -0
- package/all/isArray/index.js +9 -0
- package/all/isFloat/index.d.ts +1 -0
- package/all/isFloat/index.js +4 -0
- package/all/isFloat_andor/index.d.ts +3 -0
- package/all/isFloat_andor/index.js +9 -0
- package/all/isFloat_or/index.d.ts +1 -0
- package/all/isFloat_or/index.js +5 -0
- package/all/isLowerCase/index.d.ts +1 -0
- package/all/isLowerCase/index.js +7 -0
- package/all/isNumber/index.d.ts +5 -0
- package/all/isNumber/index.js +5 -0
- package/all/isNumber_andor/index.d.ts +3 -0
- package/all/isNumber_andor/index.js +8 -0
- package/all/isNumber_or/index.d.ts +1 -0
- package/all/isNumber_or/index.js +5 -0
- package/all/isObject/index.d.ts +8 -0
- package/all/isObject/index.js +12 -0
- package/all/isPromise/index.d.ts +1 -0
- package/all/isPromise/index.js +7 -0
- package/all/isString/index.d.ts +1 -0
- package/all/isString/index.js +7 -0
- package/all/isUpperCase/index.d.ts +1 -0
- package/all/isUpperCase/index.js +7 -0
- package/all/item_r_idx/index.d.ts +27 -0
- package/all/item_r_idx/index.js +38 -0
- package/all/json/index.d.ts +2 -0
- package/all/json/index.js +1 -0
- package/all/key_compare/index.d.ts +14 -0
- package/all/key_compare/index.js +19 -0
- package/all/key_r/index.d.ts +48 -0
- package/all/key_r/index.js +63 -0
- package/all/key_r_a/index.d.ts +15 -0
- package/all/key_r_a/index.js +26 -0
- package/all/keyof/index.d.ts +1 -0
- package/all/keyof/index.js +1 -0
- package/all/keys/index.d.ts +4 -0
- package/all/keys/index.js +5 -0
- package/all/lPad/index.d.ts +1 -0
- package/all/lPad/index.js +11 -0
- package/all/last/index.d.ts +18 -0
- package/all/last/index.js +22 -0
- package/all/left_and/index.d.ts +12 -0
- package/all/left_and/index.js +14 -0
- package/all/left_or/index.d.ts +11 -0
- package/all/left_or/index.js +14 -0
- package/all/line__parse/index.d.ts +18 -0
- package/all/line__parse/index.js +97 -0
- package/all/line__parse/index.test.ts +96 -0
- package/all/line__transform_stream/index.d.ts +8 -0
- package/all/line__transform_stream/index.js +53 -0
- package/all/line__transform_stream/index.test.ts +47 -0
- package/all/lte_0_a/index.d.ts +11 -0
- package/all/lte_0_a/index.js +20 -0
- package/all/m_m_yyyy/index.d.ts +8 -0
- package/all/m_m_yyyy/index.js +24 -0
- package/all/m_yy/index.d.ts +2 -0
- package/all/m_yy/index.js +9 -0
- package/all/m_yyyy/index.d.ts +2 -0
- package/all/m_yyyy/index.js +10 -0
- package/all/many_andand/index.d.ts +11 -0
- package/all/many_andand/index.js +12 -0
- package/all/many_andand_or/index.d.ts +17 -0
- package/all/many_andand_or/index.js +14 -0
- package/all/map/index.d.ts +42 -0
- package/all/map/index.js +45 -0
- package/all/map_andand/index.d.ts +30 -0
- package/all/map_andand/index.js +34 -0
- package/all/map_andand_or/index.d.ts +13 -0
- package/all/map_andand_or/index.js +13 -0
- package/all/map_andandfn/index.d.ts +28 -0
- package/all/map_andandfn/index.js +29 -0
- package/all/map_apply/index.d.ts +17 -0
- package/all/map_apply/index.js +15 -0
- package/all/map_call/index.d.ts +22 -0
- package/all/map_call/index.js +26 -0
- package/all/map_find/index.d.ts +32 -0
- package/all/map_find/index.js +38 -0
- package/all/map_fn/index.d.ts +4 -0
- package/all/map_fn/index.js +1 -0
- package/all/map_inverse/index.d.ts +5 -0
- package/all/map_inverse/index.js +9 -0
- package/all/map_obj/index.d.ts +30 -0
- package/all/map_obj/index.js +28 -0
- package/all/map_obj_andand/index.d.ts +28 -0
- package/all/map_obj_andand/index.js +28 -0
- package/all/matrix__dot/index.d.ts +6 -0
- package/all/matrix__dot/index.js +22 -0
- package/all/matrix__dot__scalar/index.d.ts +1 -0
- package/all/matrix__dot__scalar/index.js +9 -0
- package/all/matrix__normalize/index.d.ts +4 -0
- package/all/matrix__normalize/index.js +20 -0
- package/all/matrix__validate_length/index.d.ts +1 -0
- package/all/matrix__validate_length/index.js +13 -0
- package/all/maybe/index.d.ts +7 -0
- package/all/maybe/index.js +1 -0
- package/all/mean/index.d.ts +9 -0
- package/all/mean/index.js +17 -0
- package/all/mean/index.test.ts +10 -0
- package/all/median/index.d.ts +4 -0
- package/all/median/index.js +19 -0
- package/all/merge/index.d.ts +7 -0
- package/all/merge/index.js +25 -0
- package/all/minute/index.d.ts +7 -0
- package/all/minute/index.js +7 -0
- package/all/minute_seconds/index.d.ts +2 -0
- package/all/minute_seconds/index.js +2 -0
- package/all/missing_argument/index.d.ts +31 -0
- package/all/missing_argument/index.js +44 -0
- package/all/mixin/index.d.ts +13 -0
- package/all/mixin/index.js +34 -0
- package/all/money_str/index.d.ts +13 -0
- package/all/money_str/index.js +26 -0
- package/all/month_a/index.d.ts +5 -0
- package/all/month_a/index.js +18 -0
- package/all/month_ms/index.d.ts +5 -0
- package/all/month_ms/index.js +6 -0
- package/all/month_seconds/index.d.ts +2 -0
- package/all/month_seconds/index.js +2 -0
- package/all/ms/index.d.ts +5 -0
- package/all/ms/index.js +12 -0
- package/all/mul/index.d.ts +4 -0
- package/all/mul/index.js +12 -0
- package/all/name_sort/index.d.ts +14 -0
- package/all/name_sort/index.js +13 -0
- package/all/negative/index.d.ts +4 -0
- package/all/negative/index.js +8 -0
- package/all/neq/index.d.ts +14 -0
- package/all/neq/index.js +25 -0
- package/all/neql/index.d.ts +15 -0
- package/all/neql/index.js +24 -0
- package/all/next_idx/index.d.ts +8 -0
- package/all/next_idx/index.js +14 -0
- package/all/nf/index.d.ts +1 -0
- package/all/nf/index.js +1 -0
- package/all/no_comma_str/index.d.ts +2 -0
- package/all/no_comma_str/index.js +9 -0
- package/all/noinit/index.d.ts +9 -0
- package/all/noinit/index.js +16 -0
- package/all/noop/index.d.ts +4 -0
- package/all/noop/index.js +6 -0
- package/all/normal_random/index.d.ts +2 -0
- package/all/normal_random/index.js +19 -0
- package/all/normal_random_float/index.d.ts +2 -0
- package/all/normal_random_float/index.js +6 -0
- package/all/normal_random_int/index.d.ts +2 -0
- package/all/normal_random_int/index.js +6 -0
- package/all/not/index.d.ts +17 -0
- package/all/not/index.js +24 -0
- package/all/not_found/index.d.ts +20 -0
- package/all/not_found/index.js +44 -0
- package/all/not_nullish__query_str/index.d.ts +6 -0
- package/all/not_nullish__query_str/index.js +19 -0
- package/all/notnot/index.d.ts +12 -0
- package/all/notnot/index.js +23 -0
- package/all/null/index.d.ts +5 -0
- package/all/null/index.js +10 -0
- package/all/nullish/index.d.ts +2 -0
- package/all/nullish/index.js +1 -0
- package/all/nullish__guard/index.d.ts +10 -0
- package/all/nullish__guard/index.js +16 -0
- package/all/nullish__guard__async/index.d.ts +10 -0
- package/all/nullish__guard__async/index.js +18 -0
- package/all/nullish__none/index.d.ts +12 -0
- package/all/nullish__none/index.js +25 -0
- package/all/nullish__none/index.test.ts +58 -0
- package/all/nullish__not_all/index.d.ts +8 -0
- package/all/nullish__not_all/index.js +16 -0
- package/all/nullish__not_all/index.test.ts +70 -0
- package/all/nullish_or/index.d.ts +5 -0
- package/all/nullish_or/index.js +11 -0
- package/all/number__count/index.d.ts +4 -0
- package/all/number__count/index.js +13 -0
- package/all/number__count/index.test.ts +7 -0
- package/all/number_or_mdash_str/index.d.ts +2 -0
- package/all/number_or_mdash_str/index.js +5 -0
- package/all/numerator_or_0_avg/index.d.ts +5 -0
- package/all/numerator_or_0_avg/index.js +10 -0
- package/all/numerator_or_0_sum/index.d.ts +5 -0
- package/all/numerator_or_0_sum/index.js +10 -0
- package/all/numeric_range/index.d.ts +7 -0
- package/all/numeric_range/index.js +19 -0
- package/all/numeric_range/index.test.ts +9 -0
- package/all/o_a_present/index.d.ts +18 -0
- package/all/o_a_present/index.js +18 -0
- package/all/o_some/index.d.ts +13 -0
- package/all/o_some/index.js +16 -0
- package/all/obj_key_r/index.d.ts +10 -0
- package/all/obj_key_r/index.js +19 -0
- package/all/offset_destructure_aa/index.d.ts +13 -0
- package/all/offset_destructure_aa/index.js +22 -0
- package/all/offset_i/index.d.ts +8 -0
- package/all/offset_i/index.js +13 -0
- package/all/offset_i_slice/index.d.ts +19 -0
- package/all/offset_i_slice/index.js +26 -0
- package/all/omit/index.d.ts +15 -0
- package/all/omit/index.js +26 -0
- package/all/omit/index.test.ts +12 -0
- package/all/one_andand/index.d.ts +13 -0
- package/all/one_andand/index.js +15 -0
- package/all/one_andand_or/index.d.ts +19 -0
- package/all/one_andand_or/index.js +18 -0
- package/all/or/index.d.ts +41 -0
- package/all/or/index.js +47 -0
- package/all/or_in/index.d.ts +9 -0
- package/all/or_in/index.js +14 -0
- package/all/or_null/index.d.ts +11 -0
- package/all/or_null/index.js +10 -0
- package/all/or_property/index.d.ts +9 -0
- package/all/or_property/index.js +15 -0
- package/all/pad2/index.d.ts +1 -0
- package/all/pad2/index.js +7 -0
- package/all/parseFloat_andor/index.d.ts +3 -0
- package/all/parseFloat_andor/index.js +5 -0
- package/all/parseFloat_andor/index.test.ts +11 -0
- package/all/parseFloat_or/index.d.ts +1 -0
- package/all/parseFloat_or/index.js +5 -0
- package/all/parseFloat_or/index.test.ts +9 -0
- package/all/parseInt_andor/index.d.ts +5 -0
- package/all/parseInt_andor/index.js +5 -0
- package/all/parseInt_andor/index.test.ts +11 -0
- package/all/parseInt_or/index.d.ts +1 -0
- package/all/parseInt_or/index.js +5 -0
- package/all/parseInt_or/index.test.ts +10 -0
- package/all/pathname/index.d.ts +2 -0
- package/all/pathname/index.js +8 -0
- package/all/percentage_str/index.d.ts +2 -0
- package/all/percentage_str/index.js +9 -0
- package/all/percentage_str_float/index.d.ts +2 -0
- package/all/percentage_str_float/index.js +4 -0
- package/all/performance__now/index.d.ts +1 -0
- package/all/performance__now/index.js +32 -0
- package/all/pick/index.d.ts +18 -0
- package/all/pick/index.js +35 -0
- package/all/pick_keys/index.d.ts +8 -0
- package/all/pick_keys/index.js +12 -0
- package/all/pick_val_a/index.d.ts +14 -0
- package/all/pick_val_a/index.js +22 -0
- package/all/prev_idx/index.d.ts +8 -0
- package/all/prev_idx/index.js +14 -0
- package/all/promise/index.d.ts +2 -0
- package/all/promise/index.js +1 -0
- package/all/promise_o/index.d.ts +7 -0
- package/all/promise_o/index.js +11 -0
- package/all/promise_timeout/index.d.ts +5 -0
- package/all/promise_timeout/index.js +23 -0
- package/all/prototype_mixin/index.d.ts +8 -0
- package/all/prototype_mixin/index.js +20 -0
- package/all/push/index.d.ts +15 -0
- package/all/push/index.js +17 -0
- package/all/quantile/index.d.ts +5 -0
- package/all/quantile/index.js +16 -0
- package/all/query_str/index.d.ts +27 -0
- package/all/query_str/index.js +46 -0
- package/all/query_str/index.test.ts +43 -0
- package/all/query_str__searchParams/index.d.ts +1 -0
- package/all/query_str__searchParams/index.js +8 -0
- package/all/query_str__searchParams_o/index.d.ts +3 -0
- package/all/query_str__searchParams_o/index.js +11 -0
- package/all/queue/index.d.ts +23 -0
- package/all/queue/index.js +130 -0
- package/all/queue/index.test.ts +207 -0
- package/all/rPad/index.d.ts +1 -0
- package/all/rPad/index.js +11 -0
- package/all/r_val_a/index.d.ts +23 -0
- package/all/r_val_a/index.js +28 -0
- package/all/rad_deg/index.d.ts +5 -0
- package/all/rad_deg/index.js +7 -0
- package/all/random_idx/index.d.ts +8 -0
- package/all/random_idx/index.js +12 -0
- package/all/rank/index.d.ts +10 -0
- package/all/rank/index.js +16 -0
- package/all/rate_limit/index.d.ts +10 -0
- package/all/rate_limit/index.js +49 -0
- package/all/rc_be/index.d.ts +9 -0
- package/all/rc_be/index.js +17 -0
- package/all/rc_be_/index.d.ts +42 -0
- package/all/rc_be_/index.js +62 -0
- package/all/re_/index.d.ts +1 -0
- package/all/re_/index.js +8 -0
- package/all/readable_stream_OR_reader/index.d.ts +7 -0
- package/all/readable_stream_OR_reader/index.js +1 -0
- package/all/reduce/index.d.ts +51 -0
- package/all/reduce/index.js +51 -0
- package/all/regex_indexOf/index.d.ts +10 -0
- package/all/regex_indexOf/index.js +14 -0
- package/all/regex_lastIndexOf/index.d.ts +7 -0
- package/all/regex_lastIndexOf/index.js +25 -0
- package/all/reject/index.d.ts +39 -0
- package/all/reject/index.js +40 -0
- package/all/remove/index.d.ts +16 -0
- package/all/remove/index.js +27 -0
- package/all/remove_idx/index.d.ts +12 -0
- package/all/remove_idx/index.js +14 -0
- package/all/resolver_curry/index.d.ts +6 -0
- package/all/resolver_curry/index.js +1 -0
- package/all/response_o/index.d.ts +10 -0
- package/all/response_o/index.js +17 -0
- package/all/response_pair/index.d.ts +11 -0
- package/all/response_pair/index.js +23 -0
- package/all/response_pair/index.test.ts +30 -0
- package/all/reverse/index.d.ts +16 -0
- package/all/reverse/index.js +16 -0
- package/all/right_and/index.d.ts +14 -0
- package/all/right_and/index.js +15 -0
- package/all/right_or/index.d.ts +14 -0
- package/all/right_or/index.js +16 -0
- package/all/round/index.d.ts +4 -0
- package/all/round/index.js +14 -0
- package/all/run/index.d.ts +8 -0
- package/all/run/index.js +10 -0
- package/all/run_pipe/index.d.ts +61 -0
- package/all/run_pipe/index.js +11 -0
- package/all/run_pipe/index.test.ts +19 -0
- package/all/scalar__matrix__multiply/index.d.ts +7 -0
- package/all/scalar__matrix__multiply/index.js +16 -0
- package/all/searchParams_o/index.d.ts +3 -0
- package/all/searchParams_o/index.js +13 -0
- package/all/seconds/index.d.ts +2 -0
- package/all/seconds/index.js +10 -0
- package/all/segment_point_index/index.d.ts +5 -0
- package/all/segment_point_index/index.js +13 -0
- package/all/selector_splice/index.d.ts +13 -0
- package/all/selector_splice/index.js +17 -0
- package/all/sequence/index.d.ts +2 -0
- package/all/sequence/index.js +8 -0
- package/all/set_member/index.d.ts +6 -0
- package/all/set_member/index.js +1 -0
- package/all/since_time_text/index.d.ts +5 -0
- package/all/since_time_text/index.js +38 -0
- package/all/sleep/index.d.ts +1 -0
- package/all/sleep/index.js +7 -0
- package/all/slice/index.d.ts +38 -0
- package/all/slice/index.js +48 -0
- package/all/slice_arg_a/index.d.ts +28 -0
- package/all/slice_arg_a/index.js +17 -0
- package/all/slice_arg_spread_a/index.d.ts +29 -0
- package/all/slice_arg_spread_a/index.js +15 -0
- package/all/sort/index.d.ts +37 -0
- package/all/sort/index.js +41 -0
- package/all/sort_a/index.d.ts +24 -0
- package/all/sort_a/index.js +28 -0
- package/all/sort_idx_a/index.d.ts +21 -0
- package/all/sort_idx_a/index.js +25 -0
- package/all/sort_idx_o/index.d.ts +29 -0
- package/all/sort_idx_o/index.js +53 -0
- package/all/sort_idx_o/index.test.ts +12 -0
- package/all/sort_val_a/index.d.ts +21 -0
- package/all/sort_val_a/index.js +23 -0
- package/all/sort_val_a__transition_idx_a/index.d.ts +61 -0
- package/all/sort_val_a__transition_idx_a/index.js +108 -0
- package/all/sort_val_a__transition_idx_a/index.test.ts +99 -0
- package/all/sparse_a/index.d.ts +14 -0
- package/all/sparse_a/index.js +19 -0
- package/all/splice/index.d.ts +19 -0
- package/all/splice/index.js +23 -0
- package/all/splice_str/index.d.ts +8 -0
- package/all/splice_str/index.js +20 -0
- package/all/spread/index.d.ts +22 -0
- package/all/spread/index.js +24 -0
- package/all/spread_slice/index.d.ts +10 -0
- package/all/spread_slice/index.js +14 -0
- package/all/stacktrace/index.d.ts +5 -0
- package/all/stacktrace/index.js +42 -0
- package/all/std/index.d.ts +2 -0
- package/all/std/index.js +13 -0
- package/all/sub/index.d.ts +4 -0
- package/all/sub/index.js +10 -0
- package/all/table_txt/index.d.ts +2 -0
- package/all/table_txt/index.js +29 -0
- package/all/table_txt/index.test.ts +17 -0
- package/all/tap/index.d.ts +22 -0
- package/all/tap/index.js +26 -0
- package/all/tf/index.d.ts +2 -0
- package/all/tf/index.js +2 -0
- package/all/throttle/index.d.ts +9 -0
- package/all/throttle/index.js +26 -0
- package/all/tick/index.d.ts +8 -0
- package/all/tick/index.js +23 -0
- package/all/timedout/index.d.ts +2 -0
- package/all/timedout/index.js +9 -0
- package/all/timeout_promise/index.d.ts +10 -0
- package/all/timeout_promise/index.js +12 -0
- package/all/times/index.d.ts +8 -0
- package/all/times/index.js +13 -0
- package/all/timestamp_ms/index.d.ts +6 -0
- package/all/timestamp_ms/index.js +8 -0
- package/all/title_case_/index.d.ts +7 -0
- package/all/title_case_/index.js +24 -0
- package/all/toLocalDateString/index.d.ts +1 -0
- package/all/toLocalDateString/index.js +7 -0
- package/all/toString/index.d.ts +5 -0
- package/all/toString/index.js +5 -0
- package/all/tup/index.d.ts +13 -0
- package/all/tup/index.js +14 -0
- package/all/tuple__o/index.d.ts +7 -0
- package/all/tuple__o/index.js +1 -0
- package/all/tuple__union/index.d.ts +1 -0
- package/all/tuple__union/index.js +1 -0
- package/all/tuple_a_o/index.d.ts +10 -0
- package/all/tuple_a_o/index.js +1 -0
- package/all/unauthorized/index.d.ts +20 -0
- package/all/unauthorized/index.js +43 -0
- package/all/unformat_currency_str/index.d.ts +10 -0
- package/all/unformat_currency_str/index.js +27 -0
- package/all/uniform_random/index.d.ts +2 -0
- package/all/uniform_random/index.js +4 -0
- package/all/uniform_random_float/index.d.ts +2 -0
- package/all/uniform_random_float/index.js +6 -0
- package/all/uniform_random_int/index.d.ts +2 -0
- package/all/uniform_random_int/index.js +6 -0
- package/all/union_a/index.d.ts +14 -0
- package/all/union_a/index.js +18 -0
- package/all/union_by/index.d.ts +11 -0
- package/all/union_by/index.js +28 -0
- package/all/union_set/index.d.ts +14 -0
- package/all/union_set/index.js +18 -0
- package/all/unit_matrix/index.d.ts +1 -0
- package/all/unit_matrix/index.js +11 -0
- package/all/unpick/index.d.ts +11 -0
- package/all/unpick/index.js +28 -0
- package/all/unpick_keys/index.d.ts +8 -0
- package/all/unpick_keys/index.js +12 -0
- package/all/url__join/index.d.ts +5 -0
- package/all/url__join/index.js +24 -0
- package/all/url_basename/index.d.ts +2 -0
- package/all/url_basename/index.js +10 -0
- package/all/url_segment/index.d.ts +2 -0
- package/all/url_segment/index.js +1 -0
- package/all/urn_url/index.d.ts +11 -0
- package/all/urn_url/index.js +15 -0
- package/all/utc_MM_yyyy/index.d.ts +8 -0
- package/all/utc_MM_yyyy/index.js +24 -0
- package/all/utc_M_yyyy/index.d.ts +6 -0
- package/all/utc_M_yyyy/index.js +13 -0
- package/all/utc_m_yy/index.d.ts +5 -0
- package/all/utc_m_yy/index.js +12 -0
- package/all/utc_yyyymmdd/index.d.ts +5 -0
- package/all/utc_yyyymmdd/index.js +13 -0
- package/all/utc_yyyymmddhhmmss/index.d.ts +5 -0
- package/all/utc_yyyymmddhhmmss/index.js +18 -0
- package/all/uuid/index.d.ts +5 -0
- package/all/uuid/index.js +19 -0
- package/all/val/index.d.ts +4 -0
- package/all/val/index.js +8 -0
- package/all/value_key_aa/index.d.ts +10 -0
- package/all/value_key_aa/index.js +20 -0
- package/all/value_key_zip_r/index.d.ts +13 -0
- package/all/value_key_zip_r/index.js +20 -0
- package/all/value_r/index.d.ts +29 -0
- package/all/value_r/index.js +37 -0
- package/all/valueof/index.d.ts +1 -0
- package/all/valueof/index.js +1 -0
- package/all/values/index.d.ts +5 -0
- package/all/values/index.js +5 -0
- package/all/waitfor/index.d.ts +5 -0
- package/all/waitfor/index.js +16 -0
- package/all/waitfor_fibonacci_backoff/index.d.ts +8 -0
- package/all/waitfor_fibonacci_backoff/index.js +27 -0
- package/all/waitfor_val/index.d.ts +6 -0
- package/all/waitfor_val/index.js +20 -0
- package/all/weak_r/index.d.ts +28 -0
- package/all/weak_r/index.js +87 -0
- package/all/week/index.d.ts +1 -0
- package/all/week/index.js +2 -0
- package/all/wrap_a/index.d.ts +32 -0
- package/all/wrap_a/index.js +19 -0
- package/all/wrap_a_item/index.d.ts +5 -0
- package/all/wrap_a_item/index.js +1 -0
- package/all/wrap_aa/index.d.ts +23 -0
- package/all/wrap_aa/index.js +14 -0
- package/all/wrap_aa_item/index.d.ts +5 -0
- package/all/wrap_aa_item/index.js +1 -0
- package/all/wrap_concat/index.d.ts +11 -0
- package/all/wrap_concat/index.js +13 -0
- package/all/year_ms/index.d.ts +5 -0
- package/all/year_ms/index.js +6 -0
- package/all/year_seconds/index.d.ts +2 -0
- package/all/year_seconds/index.js +2 -0
- package/all/yyyymmdd/index.d.ts +2 -0
- package/all/yyyymmdd/index.js +10 -0
- package/all/yyyymmddhhmmss/index.d.ts +2 -0
- package/all/yyyymmddhhmmss/index.js +11 -0
- package/all/zip/index.d.ts +11 -0
- package/all/zip/index.js +17 -0
- package/all/zip__tuple_a/index.d.ts +13 -0
- package/all/zip__tuple_a/index.js +1 -0
- package/all/zip_o/index.d.ts +15 -0
- package/all/zip_o/index.js +22 -0
- package/all/zip_with/index.d.ts +43 -0
- package/all/zip_with/index.js +56 -0
- package/be/index.d.ts +5 -0
- package/be/index.js +5 -0
- package/be/index.test.ts +251 -0
- package/package.json +7 -2
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { test } from 'uvu'
|
|
2
|
+
import { equal } from 'uvu/assert'
|
|
3
|
+
import {
|
|
4
|
+
be_,
|
|
5
|
+
be__delete,
|
|
6
|
+
be__has_,
|
|
7
|
+
be__has__ctx_,
|
|
8
|
+
be__set,
|
|
9
|
+
be__val_,
|
|
10
|
+
type Ctx,
|
|
11
|
+
ctx__delete,
|
|
12
|
+
ctx__set,
|
|
13
|
+
type MapCtx
|
|
14
|
+
} from '../be_/index.js'
|
|
15
|
+
import { ctx__new } from '../ctx/index.js'
|
|
16
|
+
test('be_|Map', ()=>{
|
|
17
|
+
const ctx = ctx__new()
|
|
18
|
+
let incrementer_num = 0
|
|
19
|
+
const incrementer = ()=>++incrementer_num
|
|
20
|
+
const root_ = be_('root_', ()=>incrementer())
|
|
21
|
+
const child_ = be_('child_', ctx=>root_(ctx) + incrementer())
|
|
22
|
+
const child1_ = be_('child1_', ctx=>root_(ctx) + child_(ctx))
|
|
23
|
+
equal(root_(ctx), 1)
|
|
24
|
+
equal(ctx.get('root_'), 1)
|
|
25
|
+
equal(child_(ctx), 3)
|
|
26
|
+
equal(ctx.get('child_'), 3)
|
|
27
|
+
equal(child1_(ctx), 4)
|
|
28
|
+
equal(ctx.get('child1_'), 4)
|
|
29
|
+
})
|
|
30
|
+
test('be_|simple array', ()=>{
|
|
31
|
+
const ctx0 = ctx__new()
|
|
32
|
+
const ctx1 = ctx__new()
|
|
33
|
+
const ctx = [ctx0, ctx1]
|
|
34
|
+
const root_ = be_('root_', ()=>1)
|
|
35
|
+
equal(root_(ctx1), 1)
|
|
36
|
+
equal(root_(ctx), 1)
|
|
37
|
+
equal(ctx0.has(root_), false)
|
|
38
|
+
equal(ctx1.has(root_), true)
|
|
39
|
+
const child_ = be_('child_', ctx=>root_(ctx) + 1)
|
|
40
|
+
equal(child_(ctx), 2)
|
|
41
|
+
equal(ctx0.has(child_), true)
|
|
42
|
+
equal(ctx1.has(child_), false)
|
|
43
|
+
})
|
|
44
|
+
test('be_|nested array', ()=>{
|
|
45
|
+
const ctx0 = ctx__new()
|
|
46
|
+
const ctx1 = ctx__new()
|
|
47
|
+
const ctx2 = ctx__new()
|
|
48
|
+
const ctx3 = ctx__new()
|
|
49
|
+
const ctx = [[[ctx0], ctx1], [ctx2, ctx3]]
|
|
50
|
+
const root_ = be_('root_', ()=>1)
|
|
51
|
+
equal(root_(ctx3), 1)
|
|
52
|
+
equal(root_(ctx), 1)
|
|
53
|
+
equal(ctx0.has(root_), false)
|
|
54
|
+
equal(ctx1.has(root_), false)
|
|
55
|
+
equal(ctx2.has(root_), false)
|
|
56
|
+
equal(ctx3.has(root_), true)
|
|
57
|
+
const child_ = be_('child_', ctx=>root_(ctx) + 1)
|
|
58
|
+
equal(child_(ctx), 2)
|
|
59
|
+
equal(ctx0.has(child_), true)
|
|
60
|
+
equal(ctx1.has(child_), false)
|
|
61
|
+
equal(ctx2.has(child_), false)
|
|
62
|
+
equal(ctx3.has(child_), false)
|
|
63
|
+
})
|
|
64
|
+
test('be_|is_source_', ()=>{
|
|
65
|
+
const ctx0 = ctx__new()
|
|
66
|
+
const ctx1 = ctx__new()
|
|
67
|
+
ctx1.set('matching', true)
|
|
68
|
+
const ctx = [ctx0, ctx1]
|
|
69
|
+
const be__ctx_a:Ctx[] = []
|
|
70
|
+
const root_ = be_('root_', ctx=>{
|
|
71
|
+
be__ctx_a.push(ctx)
|
|
72
|
+
return 1
|
|
73
|
+
}, {
|
|
74
|
+
is_source_(map_ctx) {
|
|
75
|
+
return !!map_ctx.get('matching')
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
equal(root_(ctx), 1)
|
|
79
|
+
equal(be__ctx_a, [[ctx0, ctx1]])
|
|
80
|
+
equal(ctx0.has(root_), false)
|
|
81
|
+
equal(ctx1.has(root_), true)
|
|
82
|
+
})
|
|
83
|
+
test('be_|Ctx generic type', ()=>{
|
|
84
|
+
const valid_ctx = ctx__new() as test_ctx_T
|
|
85
|
+
const val_ = be_<boolean, test_ctx_T>('val_', ()=>true)
|
|
86
|
+
val_(valid_ctx)
|
|
87
|
+
// val_(ctx_()) // type error
|
|
88
|
+
})
|
|
89
|
+
test('be_|Ctx|NestedMapCtx', ()=>{
|
|
90
|
+
const ctx0 = ctx__new()
|
|
91
|
+
const ctx1 = ctx__new()
|
|
92
|
+
ctx1.set('matching', true)
|
|
93
|
+
const ctx = [ctx0, ctx1]
|
|
94
|
+
const nested__ctx_ = be_<Ctx>('nested__ctx_', ctx=>[ctx])
|
|
95
|
+
equal(nested__ctx_(ctx), [[ctx0, ctx1]])
|
|
96
|
+
})
|
|
97
|
+
test('be__set', ()=>{
|
|
98
|
+
const ctx0 = ctx__new()
|
|
99
|
+
const val_ = be_<number|undefined>('val_', ()=>undefined, {
|
|
100
|
+
is_source_: map_ctx=>map_ctx === ctx0
|
|
101
|
+
})
|
|
102
|
+
be__set(val_, ctx0, 1)
|
|
103
|
+
equal(val_(ctx0), 1)
|
|
104
|
+
const ctx1 = ctx__new()
|
|
105
|
+
const ctx_a = [ctx1, ctx0]
|
|
106
|
+
be__set(val_, ctx_a, 2)
|
|
107
|
+
equal(val_(ctx0), 2)
|
|
108
|
+
equal(val_(ctx_a), 2)
|
|
109
|
+
equal(ctx1.has(val_), false)
|
|
110
|
+
})
|
|
111
|
+
test('ctx__set', ()=>{
|
|
112
|
+
const ctx0 = ctx__new()
|
|
113
|
+
ctx__set(ctx0, 'key', 1)
|
|
114
|
+
equal(ctx0.get('key'), 1)
|
|
115
|
+
const ctx1 = ctx__new()
|
|
116
|
+
const ctx_a = [ctx1, ctx0]
|
|
117
|
+
ctx__set(ctx_a, 'key', 2,
|
|
118
|
+
(map_ctx:MapCtx)=>map_ctx.get('key') != null)
|
|
119
|
+
equal(ctx0.get('key'), 2)
|
|
120
|
+
equal(ctx1.has('key'), false)
|
|
121
|
+
})
|
|
122
|
+
test('be__delete', ()=>{
|
|
123
|
+
const ctx0 = ctx__new()
|
|
124
|
+
const val_ = be_<boolean>('val_', ()=>true)
|
|
125
|
+
be__delete(val_, ctx0)
|
|
126
|
+
equal(ctx0.has(val_), false)
|
|
127
|
+
equal(ctx0.has('val_'), false)
|
|
128
|
+
equal(val_(ctx0), true)
|
|
129
|
+
equal(ctx0.get(val_), true)
|
|
130
|
+
equal(ctx0.get('val_'), true)
|
|
131
|
+
be__delete(val_, ctx0)
|
|
132
|
+
equal(ctx0.has(val_), false)
|
|
133
|
+
equal(ctx0.has('val_'), false)
|
|
134
|
+
const ctx1 = ctx__new()
|
|
135
|
+
const nested__ctx = [ctx0, ctx1]
|
|
136
|
+
equal(val_(ctx0), true)
|
|
137
|
+
equal(val_(ctx1), true)
|
|
138
|
+
equal(val_(nested__ctx), true)
|
|
139
|
+
equal(ctx0.get('val_'), true)
|
|
140
|
+
equal(ctx1.get('val_'), true)
|
|
141
|
+
be__delete(val_, nested__ctx)
|
|
142
|
+
equal(ctx0.has(val_), false)
|
|
143
|
+
equal(ctx0.has('val_'), false)
|
|
144
|
+
equal(ctx1.has(val_), false)
|
|
145
|
+
equal(ctx1.has('val_'), false)
|
|
146
|
+
})
|
|
147
|
+
test('ctx__delete|id', ()=>{
|
|
148
|
+
const ctx0 = ctx__new()
|
|
149
|
+
ctx__delete(ctx0, 'key')
|
|
150
|
+
equal(ctx0.has('key'), false)
|
|
151
|
+
ctx0.set('key', true)
|
|
152
|
+
equal(ctx0.get('key'), true)
|
|
153
|
+
ctx__delete(ctx0, 'key')
|
|
154
|
+
equal(ctx0.has('key'), false)
|
|
155
|
+
const ctx1 = ctx__new()
|
|
156
|
+
const nested__ctx = [ctx0, ctx1]
|
|
157
|
+
ctx0.set('key', true)
|
|
158
|
+
ctx1.set('key', true)
|
|
159
|
+
equal(ctx0.get('key'), true)
|
|
160
|
+
equal(ctx1.get('key'), true)
|
|
161
|
+
ctx__delete(nested__ctx, 'key')
|
|
162
|
+
equal(ctx0.has('key'), false)
|
|
163
|
+
equal(ctx1.has('key'), false)
|
|
164
|
+
})
|
|
165
|
+
test('ctx__delete|be', ()=>{
|
|
166
|
+
const ctx0 = ctx__new()
|
|
167
|
+
const num_ = be_(()=>1)
|
|
168
|
+
ctx__delete(ctx0, num_)
|
|
169
|
+
equal(ctx0.has(num_), false)
|
|
170
|
+
num_(ctx0)
|
|
171
|
+
equal(ctx0.has(num_), true)
|
|
172
|
+
ctx__delete(ctx0, num_)
|
|
173
|
+
equal(ctx0.has(num_), false)
|
|
174
|
+
num_(ctx0)
|
|
175
|
+
equal(ctx0.has(num_), true)
|
|
176
|
+
ctx__delete(ctx0, num_)
|
|
177
|
+
equal(ctx0.has(num_), false)
|
|
178
|
+
const ctx1 = ctx__new()
|
|
179
|
+
ctx1.set('ctx1', true)
|
|
180
|
+
const nested__ctx = [ctx0, ctx1]
|
|
181
|
+
num_(ctx0)
|
|
182
|
+
num_(ctx1)
|
|
183
|
+
equal(ctx0.has(num_), true)
|
|
184
|
+
equal(ctx1.has(num_), true)
|
|
185
|
+
ctx__delete(nested__ctx, num_)
|
|
186
|
+
equal(ctx0.has(num_), false)
|
|
187
|
+
equal(ctx1.has(num_), false)
|
|
188
|
+
num_(ctx0)
|
|
189
|
+
num_(ctx1)
|
|
190
|
+
equal(ctx0.has(num_), true)
|
|
191
|
+
equal(ctx1.has(num_), true)
|
|
192
|
+
ctx__delete(nested__ctx, num_)
|
|
193
|
+
equal(ctx0.has(num_), false)
|
|
194
|
+
equal(ctx1.has(num_), false)
|
|
195
|
+
const is_source__num_ =
|
|
196
|
+
be_(()=>1,
|
|
197
|
+
{ is_source_: ctx=>!!ctx.get('ctx1') })
|
|
198
|
+
is_source__num_(nested__ctx)
|
|
199
|
+
equal(ctx0.has(is_source__num_), false)
|
|
200
|
+
equal(ctx1.has(is_source__num_), true)
|
|
201
|
+
ctx__delete(nested__ctx, is_source__num_)
|
|
202
|
+
equal(ctx0.has(is_source__num_), false)
|
|
203
|
+
equal(ctx1.has(is_source__num_), false)
|
|
204
|
+
is_source__num_(nested__ctx)
|
|
205
|
+
equal(ctx0.has(is_source__num_), false)
|
|
206
|
+
equal(ctx1.has(is_source__num_), true)
|
|
207
|
+
ctx__delete(nested__ctx, is_source__num_)
|
|
208
|
+
equal(ctx0.has(is_source__num_), false)
|
|
209
|
+
equal(ctx1.has(is_source__num_), false)
|
|
210
|
+
})
|
|
211
|
+
test('be__has_', ()=>{
|
|
212
|
+
const ctx0 = ctx__new()
|
|
213
|
+
ctx__delete(ctx0, 'key')
|
|
214
|
+
equal(be__has_('key', ctx0), false)
|
|
215
|
+
ctx0.set('key', true)
|
|
216
|
+
equal(be__has_('key', ctx0), true)
|
|
217
|
+
ctx__delete(ctx0, 'key')
|
|
218
|
+
equal(be__has_('key', ctx0), false)
|
|
219
|
+
const ctx1 = ctx__new()
|
|
220
|
+
const nested__ctx = [ctx0, ctx1]
|
|
221
|
+
ctx1.set('key', true)
|
|
222
|
+
equal(be__has_('key', nested__ctx), true)
|
|
223
|
+
})
|
|
224
|
+
test('be__has__ctx_', ()=>{
|
|
225
|
+
const ctx0 = ctx__new()
|
|
226
|
+
ctx__delete(ctx0, 'key')
|
|
227
|
+
equal(be__has__ctx_('key', ctx0), null)
|
|
228
|
+
ctx0.set('key', true)
|
|
229
|
+
equal(be__has__ctx_('key', ctx0), ctx0)
|
|
230
|
+
ctx__delete(ctx0, 'key')
|
|
231
|
+
equal(be__has__ctx_('key', ctx0), null)
|
|
232
|
+
const ctx1 = ctx__new()
|
|
233
|
+
const nested__ctx = [ctx0, ctx1]
|
|
234
|
+
ctx1.set('key', true)
|
|
235
|
+
equal(be__has__ctx_('key', nested__ctx), ctx1)
|
|
236
|
+
})
|
|
237
|
+
test('be__val_', ()=>{
|
|
238
|
+
const ctx = ctx__new()
|
|
239
|
+
const val_ = be_<boolean>('val_', ()=>true)
|
|
240
|
+
equal(val_(ctx), true)
|
|
241
|
+
equal(ctx.get(val_), true)
|
|
242
|
+
equal(be__val_(val_, ctx), true)
|
|
243
|
+
be__set(val_, ctx, false)
|
|
244
|
+
equal(val_(ctx), false)
|
|
245
|
+
equal(be__val_(val_, ctx), false)
|
|
246
|
+
})
|
|
247
|
+
test.run()
|
|
248
|
+
declare const test_ctx_sym:unique symbol
|
|
249
|
+
type test_ctx_T = Ctx&{
|
|
250
|
+
[test_ctx_sym]:any
|
|
251
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { be__params_T, Ctx } from '../be_/index.js'
|
|
2
|
+
export declare function be_arg_triple__new<
|
|
3
|
+
val_T,
|
|
4
|
+
ctx_T extends Ctx = Ctx,
|
|
5
|
+
>(...arg_a:be_arg_triple__new__arg_a_T<val_T, ctx_T>):be_arg_triple_T<val_T, ctx_T>
|
|
6
|
+
export type be_arg_triple_T<
|
|
7
|
+
val_T,
|
|
8
|
+
ctx_T extends Ctx = Ctx
|
|
9
|
+
> = [
|
|
10
|
+
id:string|null,
|
|
11
|
+
val__new:(ctx:ctx_T)=>val_T,
|
|
12
|
+
be__params:be__params_T
|
|
13
|
+
]
|
|
14
|
+
export type be_arg_triple__new__arg_a_T<
|
|
15
|
+
val_T,
|
|
16
|
+
ctx_T extends Ctx = Ctx,
|
|
17
|
+
> =
|
|
18
|
+
|[be__params?:be__params_T]
|
|
19
|
+
|[id:string|null|undefined, be__params?:be__params_T]
|
|
20
|
+
|[val__new:(ctx:ctx_T)=>val_T, be__params?:be__params_T]
|
|
21
|
+
|[id?:string|null|undefined, val__new?:((ctx:ctx_T)=>val_T), be__params?:be__params_T]
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** @typedef {import('../be_/index.d.ts').Ctx}Ctx */
|
|
2
|
+
/** @typedef {import('../be_/index.d.ts').be__params_T}be__params_T */
|
|
3
|
+
/** @typedef {import('../be_arg_triple/index.d.ts').be_arg_triple_T}be_arg_triple_T */
|
|
4
|
+
/** @typedef {import('../be_arg_triple/index.d.ts').be_arg_triple__new__arg_a_T}be_arg_triple__new__arg_a_T */
|
|
5
|
+
/**
|
|
6
|
+
* @param {be_arg_triple__new__arg_a_T}arg_a
|
|
7
|
+
* @returns {be_arg_triple_T}
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
export function be_arg_triple__new(...arg_a) {
|
|
11
|
+
/** @type {string|null|undefined} */
|
|
12
|
+
let id
|
|
13
|
+
/** @type {((ctx:Ctx)=>V)|undefined} */
|
|
14
|
+
let val__new
|
|
15
|
+
/** @type {be__params_T|undefined} */
|
|
16
|
+
let be__params
|
|
17
|
+
if (arg_a.length === 3) {
|
|
18
|
+
[id, val__new, be__params] = arg_a
|
|
19
|
+
} else if (arg_a.length === 2) {
|
|
20
|
+
if (typeof arg_a[0] === 'function') {
|
|
21
|
+
val__new = arg_a[0]
|
|
22
|
+
be__params = arg_a[1]
|
|
23
|
+
} else {
|
|
24
|
+
id = arg_a[0]
|
|
25
|
+
if (typeof arg_a[1] === 'function') {
|
|
26
|
+
val__new = arg_a[1]
|
|
27
|
+
} else {
|
|
28
|
+
be__params = arg_a[1]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
} else if (arg_a.length === 1) {
|
|
32
|
+
if (typeof arg_a[0] === 'function') {
|
|
33
|
+
val__new = arg_a[0]
|
|
34
|
+
} else if (typeof arg_a[0] === 'object') {
|
|
35
|
+
be__params = arg_a[0]
|
|
36
|
+
} else {
|
|
37
|
+
id = arg_a[0]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return [id, val__new, be__params]
|
|
41
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { be__params_T, Ctx } from '../be_/index.js'
|
|
2
|
+
export declare function be_prop_pair_<
|
|
3
|
+
Val extends NonNullable<unknown>,
|
|
4
|
+
ctx_T extends Ctx = Ctx
|
|
5
|
+
>(
|
|
6
|
+
be__params?:be__params_T
|
|
7
|
+
):be_prop_pair_T<Val, ctx_T>
|
|
8
|
+
export declare function be_prop_pair_<
|
|
9
|
+
Val extends NonNullable<unknown>,
|
|
10
|
+
ctx_T extends Ctx = Ctx
|
|
11
|
+
>(
|
|
12
|
+
id:string|null|undefined,
|
|
13
|
+
be__params?:be__params_T
|
|
14
|
+
):be_prop_pair_T<Val, ctx_T>
|
|
15
|
+
export declare function be_prop_pair_<
|
|
16
|
+
Val extends NonNullable<unknown>,
|
|
17
|
+
ctx_T extends Ctx = Ctx
|
|
18
|
+
>(
|
|
19
|
+
val__new:(ctx:ctx_T)=>Val,
|
|
20
|
+
be__params?:be__params_T
|
|
21
|
+
):be_prop_pair_T<Val, ctx_T>
|
|
22
|
+
export declare function be_prop_pair_<
|
|
23
|
+
Val extends NonNullable<unknown>,
|
|
24
|
+
ctx_T extends Ctx = Ctx
|
|
25
|
+
>(
|
|
26
|
+
id?:string|null|undefined,
|
|
27
|
+
val__new?:((ctx:ctx_T)=>Val),
|
|
28
|
+
be__params?:be__params_T
|
|
29
|
+
):be_prop_pair_T<Val, ctx_T>
|
|
30
|
+
export type be_prop_pair_T<
|
|
31
|
+
Val extends NonNullable<unknown>,
|
|
32
|
+
ctx_T extends Ctx = Ctx
|
|
33
|
+
> = [
|
|
34
|
+
(ctx:ctx_T)=>Val,
|
|
35
|
+
(ctx:ctx_T, val:Val)=>void
|
|
36
|
+
]
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { be_, ctx__set } from '../be_/index.js'
|
|
2
|
+
/** @typedef {import('../be_/index.d.ts').be__params_T}be__params_T */
|
|
3
|
+
/** @typedef {import('../be_/index.d.ts').Ctx}Ctx */
|
|
4
|
+
/** @typedef {import('../be_prop_pair/index.d.ts').be_prop_pair_T}be_prop_pair_T */
|
|
5
|
+
/**
|
|
6
|
+
* @param {string|null|undefined|((ctx:Ctx)=>unknown)|be__params_T}[id_OR_val__new_OR_be__params]
|
|
7
|
+
* @param {((ctx:Ctx)=>unknown)|be__params_T}val__new_OR_be__params
|
|
8
|
+
* @param {be__params_T}[be__params]
|
|
9
|
+
* @returns {be_prop_pair_T}
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export function be_prop_pair_(
|
|
13
|
+
id_OR_val__new_OR_be__params,
|
|
14
|
+
val__new_OR_be__params,
|
|
15
|
+
be__params
|
|
16
|
+
) {
|
|
17
|
+
/** @type {string} */
|
|
18
|
+
let id
|
|
19
|
+
/** @type {(ctx:Ctx)=>unknown} */
|
|
20
|
+
let val__new
|
|
21
|
+
if (typeof id_OR_val__new_OR_be__params === 'function') {
|
|
22
|
+
val__new_OR_be__params = id_OR_val__new_OR_be__params
|
|
23
|
+
} else if (typeof id_OR_val__new_OR_be__params === 'object') {
|
|
24
|
+
be__params = id_OR_val__new_OR_be__params
|
|
25
|
+
} else {
|
|
26
|
+
id = id_OR_val__new_OR_be__params
|
|
27
|
+
}
|
|
28
|
+
if (typeof val__new_OR_be__params === 'function') {
|
|
29
|
+
val__new = val__new_OR_be__params
|
|
30
|
+
} else if (!be__params) {
|
|
31
|
+
be__params = val__new_OR_be__params
|
|
32
|
+
}
|
|
33
|
+
if (!val__new) {
|
|
34
|
+
val__new = ()=>null
|
|
35
|
+
}
|
|
36
|
+
const _be_ =
|
|
37
|
+
(be__params && be__params.be_)
|
|
38
|
+
?? be_
|
|
39
|
+
const val_ =
|
|
40
|
+
id
|
|
41
|
+
? _be_(id, val__new, be__params)
|
|
42
|
+
: _be_(val__new, be__params)
|
|
43
|
+
function val__set(ctx, val) {
|
|
44
|
+
ctx__set(
|
|
45
|
+
ctx,
|
|
46
|
+
val_,
|
|
47
|
+
val,
|
|
48
|
+
be__params && be__params.is_source_)
|
|
49
|
+
}
|
|
50
|
+
return [
|
|
51
|
+
val_,
|
|
52
|
+
val__set
|
|
53
|
+
]
|
|
54
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { test } from 'uvu'
|
|
2
|
+
import { equal } from 'uvu/assert'
|
|
3
|
+
import { be_, type MapCtx } from '../be_/index.js'
|
|
4
|
+
import { be_prop_pair_ } from '../be_prop_pair/index.js'
|
|
5
|
+
import { ctx__new } from '../ctx/index.js'
|
|
6
|
+
test('be_prop_pair_|+base_name|+atom__new|+be__params', ()=>{
|
|
7
|
+
const ctx = ctx__new()
|
|
8
|
+
const is_source_ = (map_ctx:MapCtx)=>map_ctx === ctx
|
|
9
|
+
let custom__be__called = false
|
|
10
|
+
const custom__be_ = ((...argv:Parameters<typeof be_>)=>{
|
|
11
|
+
custom__be__called = true
|
|
12
|
+
return be_(...argv)
|
|
13
|
+
}) as typeof be_
|
|
14
|
+
const [
|
|
15
|
+
foobar_,
|
|
16
|
+
foobar__set,
|
|
17
|
+
] = be_prop_pair_(
|
|
18
|
+
'foobar',
|
|
19
|
+
()=>1,
|
|
20
|
+
{
|
|
21
|
+
is_source_,
|
|
22
|
+
be_: custom__be_,
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
equal(custom__be__called, true)
|
|
26
|
+
equal(foobar_([ctx__new(), ctx]), 1)
|
|
27
|
+
foobar__set([ctx__new(), ctx], 2)
|
|
28
|
+
equal(foobar_([ctx__new(), ctx]), 2)
|
|
29
|
+
})
|
|
30
|
+
test('be_prop_pair_|+base_name|+atom__new|-be__params', ()=>{
|
|
31
|
+
const ctx = ctx__new()
|
|
32
|
+
const [
|
|
33
|
+
foobar_,
|
|
34
|
+
foobar__set,
|
|
35
|
+
] = be_prop_pair_(
|
|
36
|
+
'foobar',
|
|
37
|
+
()=>1,
|
|
38
|
+
)
|
|
39
|
+
equal(foobar_(ctx), 1)
|
|
40
|
+
foobar__set(ctx, 2)
|
|
41
|
+
equal(foobar_(ctx), 2)
|
|
42
|
+
})
|
|
43
|
+
test('be_prop_pair_|+base_name|-atom__new|+be__params', ()=>{
|
|
44
|
+
const ctx = ctx__new()
|
|
45
|
+
const is_source_ = (map_ctx:MapCtx)=>map_ctx === ctx
|
|
46
|
+
let custom__be__called = false
|
|
47
|
+
const custom__be_ = ((...argv:Parameters<typeof be_>)=>{
|
|
48
|
+
custom__be__called = true
|
|
49
|
+
return be_(...argv)
|
|
50
|
+
}) as typeof be_
|
|
51
|
+
const [
|
|
52
|
+
foobar_,
|
|
53
|
+
foobar__set,
|
|
54
|
+
] = be_prop_pair_('foobar', {
|
|
55
|
+
is_source_,
|
|
56
|
+
be_: custom__be_,
|
|
57
|
+
})
|
|
58
|
+
equal(custom__be__called, true)
|
|
59
|
+
equal(foobar_([ctx__new(), ctx]), null)
|
|
60
|
+
foobar__set([ctx__new(), ctx], 2)
|
|
61
|
+
equal(foobar_([ctx__new(), ctx]), 2)
|
|
62
|
+
})
|
|
63
|
+
test('be_prop_pair_|+base_name|-atom__new|-be__params', ()=>{
|
|
64
|
+
const [
|
|
65
|
+
foobar_,
|
|
66
|
+
foobar__set,
|
|
67
|
+
] = be_prop_pair_('foobar')
|
|
68
|
+
const ctx = ctx__new()
|
|
69
|
+
equal(foobar_(ctx), null)
|
|
70
|
+
foobar__set(ctx, 2)
|
|
71
|
+
equal(foobar_(ctx), 2)
|
|
72
|
+
})
|
|
73
|
+
test('be_prop_pair_|-base_name|+atom__new|+be__params', ()=>{
|
|
74
|
+
const ctx = ctx__new()
|
|
75
|
+
const is_source_ = (map_ctx:MapCtx)=>map_ctx === ctx
|
|
76
|
+
let custom__be__called = false
|
|
77
|
+
const custom__be_ = ((...argv:Parameters<typeof be_>)=>{
|
|
78
|
+
custom__be__called = true
|
|
79
|
+
return be_(...argv)
|
|
80
|
+
}) as typeof be_
|
|
81
|
+
const [
|
|
82
|
+
foobar_,
|
|
83
|
+
foobar__set,
|
|
84
|
+
] = be_prop_pair_(
|
|
85
|
+
undefined,
|
|
86
|
+
()=>1,
|
|
87
|
+
{
|
|
88
|
+
is_source_,
|
|
89
|
+
be_: custom__be_,
|
|
90
|
+
})
|
|
91
|
+
equal(custom__be__called, true)
|
|
92
|
+
equal(foobar_([ctx__new(), ctx]), 1)
|
|
93
|
+
foobar__set([ctx__new(), ctx], 2)
|
|
94
|
+
equal(foobar_([ctx__new(), ctx]), 2)
|
|
95
|
+
})
|
|
96
|
+
test('be_prop_pair_|-base_name|+atom__new|-be__params', ()=>{
|
|
97
|
+
const [
|
|
98
|
+
foobar_,
|
|
99
|
+
foobar__set,
|
|
100
|
+
] = be_prop_pair_(undefined, ()=>
|
|
101
|
+
1)
|
|
102
|
+
const ctx = ctx__new()
|
|
103
|
+
equal(foobar_(ctx), 1)
|
|
104
|
+
foobar__set(ctx, 2)
|
|
105
|
+
equal(foobar_(ctx), 2)
|
|
106
|
+
})
|
|
107
|
+
test('be_prop_pair_|-base_name|-atom__new|+be__params', ()=>{
|
|
108
|
+
const ctx = ctx__new()
|
|
109
|
+
const is_source_ = (map_ctx:MapCtx)=>map_ctx === ctx
|
|
110
|
+
let custom__be__called = false
|
|
111
|
+
const custom__be_ = ((...argv:Parameters<typeof be_>)=>{
|
|
112
|
+
custom__be__called = true
|
|
113
|
+
return be_(...argv)
|
|
114
|
+
}) as typeof be_
|
|
115
|
+
const [
|
|
116
|
+
foobar_,
|
|
117
|
+
foobar__set,
|
|
118
|
+
] = be_prop_pair_({
|
|
119
|
+
is_source_,
|
|
120
|
+
be_: custom__be_,
|
|
121
|
+
})
|
|
122
|
+
equal(custom__be__called, true)
|
|
123
|
+
equal(foobar_([ctx__new(), ctx]), null)
|
|
124
|
+
foobar__set([ctx__new(), ctx], 2)
|
|
125
|
+
equal(foobar_([ctx__new(), ctx]), 2)
|
|
126
|
+
})
|
|
127
|
+
test('be_prop_pair_|-base_name|-atom__new|-be__params', ()=>{
|
|
128
|
+
const [
|
|
129
|
+
foobar_,
|
|
130
|
+
foobar__set,
|
|
131
|
+
] = be_prop_pair_()
|
|
132
|
+
const ctx = ctx__new()
|
|
133
|
+
equal(foobar_(ctx), null)
|
|
134
|
+
foobar__set(ctx, 2)
|
|
135
|
+
equal(foobar_(ctx), 2)
|
|
136
|
+
})
|
|
137
|
+
test.run()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { compare_1_T } from '../array_types/index.js'
|
|
2
|
+
/**
|
|
3
|
+
* Returns the rank of the item where the compare function === 0, using binarySort
|
|
4
|
+
*/
|
|
5
|
+
export declare function binary_sort_rank(
|
|
6
|
+
a:readonly unknown[], compare_1:compare_1_T
|
|
7
|
+
):number
|
|
8
|
+
export {
|
|
9
|
+
binary_sort_rank as binarySort_rank,
|
|
10
|
+
binary_sort_rank as rank__binarySort,
|
|
11
|
+
binary_sort_rank as rank__binarySort__a1,
|
|
12
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the rank of the item where the compare function === 0, using binarySort
|
|
3
|
+
* @param {unknown[]}a
|
|
4
|
+
* @param {import('../array_types/index.js').compare_1_T}compare_1
|
|
5
|
+
* @returns {number}
|
|
6
|
+
*/
|
|
7
|
+
export function binary_sort_rank(a, compare_1) {
|
|
8
|
+
let min_index = 0
|
|
9
|
+
let max_index = a.length - 1
|
|
10
|
+
let current_index
|
|
11
|
+
let current_element
|
|
12
|
+
while (min_index <= max_index) {
|
|
13
|
+
current_index = (min_index + max_index) / 2 | 0
|
|
14
|
+
current_element = a[current_index]
|
|
15
|
+
const sort_compare = compare_1(current_element, current_index)
|
|
16
|
+
if (sort_compare > 0) {
|
|
17
|
+
min_index = current_index + 1
|
|
18
|
+
} else if (sort_compare < 0) {
|
|
19
|
+
max_index = current_index - 1
|
|
20
|
+
} else {
|
|
21
|
+
return current_index
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return -1
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
binary_sort_rank as binarySort_rank,
|
|
28
|
+
binary_sort_rank as rank__binarySort,
|
|
29
|
+
binary_sort_rank as rank__binarySort__a1,
|
|
30
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { call_fn_T } from '../call/index.js'
|
|
2
|
+
/**
|
|
3
|
+
* Returns function bound to self that applies arg_a with ...arg_a_
|
|
4
|
+
*/
|
|
5
|
+
export declare function bind_apply_<
|
|
6
|
+
Self extends unknown = unknown,
|
|
7
|
+
A_outer extends unknown = unknown,
|
|
8
|
+
A_inner extends unknown[] = unknown[],
|
|
9
|
+
Out extends unknown = unknown
|
|
10
|
+
>(
|
|
11
|
+
fn:call_fn_T<A_inner, Out>, self:Self, in_arg_a?:A_outer
|
|
12
|
+
):ReturnType<call_fn_T<A_inner, Out>>
|
|
13
|
+
export {
|
|
14
|
+
bind_apply_ as _bind_apply,
|
|
15
|
+
bind_apply_ as _apply__bind,
|
|
16
|
+
}
|
|
17
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @typedef {import('../call/index.d.ts').call_fn_T} */
|
|
2
|
+
/**
|
|
3
|
+
* Returns function bound to self that applies arg_a with ...arg_a_
|
|
4
|
+
* @param {call_fn_T}fn
|
|
5
|
+
* @param {unknown}self
|
|
6
|
+
* @param {unknown}[in_arg_a]
|
|
7
|
+
* @returns {(fn:call_fn_T, unknown, in_arg_a?:unknown[])=>ReturnType<call_fn_T>}
|
|
8
|
+
*/
|
|
9
|
+
export function bind_apply_(fn, self, in_arg_a) {
|
|
10
|
+
return (find, self, in_arg_a)=>fn.apply(self, [
|
|
11
|
+
...in_arg_a,
|
|
12
|
+
...fn_arg_a
|
|
13
|
+
])
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
bind_apply_ as _bind_apply,
|
|
17
|
+
bind_apply_ as _apply__bind,
|
|
18
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { call_fn_T } from '../call/index.js'
|
|
2
|
+
/**
|
|
3
|
+
* Returns function bound to self that calls ...in_arg_a concat with ...fn_arg_a passed to function
|
|
4
|
+
*/
|
|
5
|
+
export declare function bind_call_<
|
|
6
|
+
A1 extends unknown[] = unknown[],
|
|
7
|
+
A2 extends unknown[] = unknown[],
|
|
8
|
+
O2 extends unknown = unknown,
|
|
9
|
+
S2 extends unknown = unknown
|
|
10
|
+
>(
|
|
11
|
+
fn:call_fn_T<A2, O2>, self:S2, ...in_arg_a:A2[]
|
|
12
|
+
):ReturnType<call_fn_T<A2, O2>>
|
|
13
|
+
export {
|
|
14
|
+
bind_call_ as _bind_call,
|
|
15
|
+
bind_call_ as _call__bind,
|
|
16
|
+
}
|
|
17
|
+
export declare type bind_call_T<
|
|
18
|
+
A extends readonly unknown[] = readonly unknown[],
|
|
19
|
+
O extends unknown = unknown
|
|
20
|
+
> = (...fn_arg_a:A)=>O
|
|
21
|
+
export declare type bind_call_type = bind_call_T
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @typedef {import('../call_fn/index.js')} */
|
|
2
|
+
/**
|
|
3
|
+
* Returns function bound to self that calls ...in_arg_a concat with ...fn_arg_a passed to function
|
|
4
|
+
* @param {call_fn_T}fn
|
|
5
|
+
* @param {unknown}self
|
|
6
|
+
* @param {unknown}in_arg_a
|
|
7
|
+
* @returns {(fn:call_fn_T, self:unknown, ...in_arg_a:unknown[])=>ReturnType<call_fn_T>}
|
|
8
|
+
*/
|
|
9
|
+
export function bind_call_(fn, self, ...in_arg_a) {
|
|
10
|
+
return (...fn_arg_a)=>fn.call(self, ...[
|
|
11
|
+
...in_arg_a,
|
|
12
|
+
...fn_arg_a
|
|
13
|
+
])
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
bind_call_ as _bind_call,
|
|
17
|
+
bind_call_ as _call__bind,
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { call_fn_T } from '../call/index.js'
|
|
2
|
+
/**
|
|
3
|
+
* Returns function returning map of calls to fn_a bound to self that applies arg_a with ...arg_a_
|
|
4
|
+
*/
|
|
5
|
+
export declare function bind_map_apply_<
|
|
6
|
+
A1 extends unknown[] = unknown[],
|
|
7
|
+
O1 extends unknown = unknown,
|
|
8
|
+
S1 extends unknown = unknown,
|
|
9
|
+
A2 extends unknown[] = unknown[]
|
|
10
|
+
>(
|
|
11
|
+
fn_a:call_fn_T<A1, O1>[], self:S1, in_arg_a:A2
|
|
12
|
+
):(...fn_arg_a:A1)=>O1[]
|
|
13
|
+
export {
|
|
14
|
+
bind_map_apply_ as _bind_map_apply,
|
|
15
|
+
bind_map_apply_ as bind_map_fn_apply_fn,
|
|
16
|
+
bind_map_apply_ as _apply__map__bind
|
|
17
|
+
}
|