ctx-core 2.2.0 → 2.2.2
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/index.js +2 -0
- package/package.json +6 -1
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {(()=>Promise<unknown>)|Promise<unknown>}promise
|
|
3
|
+
* @param {number}ms
|
|
4
|
+
* @param {Error}[error]
|
|
5
|
+
* @returns {Promise<unknown>}
|
|
6
|
+
*/
|
|
7
|
+
export async function promise_timeout(
|
|
8
|
+
promise,
|
|
9
|
+
ms,
|
|
10
|
+
error = new Error(`Timed out after ${ms}ms.`),
|
|
11
|
+
) {
|
|
12
|
+
let id
|
|
13
|
+
let timeout = new Promise((_resolve, reject)=>{
|
|
14
|
+
id = setTimeout(()=>reject(error), ms)
|
|
15
|
+
})
|
|
16
|
+
return Promise.race([
|
|
17
|
+
typeof promise === 'function' ? promise() : promise,
|
|
18
|
+
timeout
|
|
19
|
+
]).then(result=>{
|
|
20
|
+
clearTimeout(id)
|
|
21
|
+
return result
|
|
22
|
+
})
|
|
23
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function prototype_mixin<
|
|
2
|
+
target_T extends Function&{ prototype:object },
|
|
3
|
+
source_T extends Function&{ prototype:object },
|
|
4
|
+
out_T extends Function&{ prototype:object } = target_T&{ prototype:target_T['prototype']&source_T['prototype'] },
|
|
5
|
+
>(
|
|
6
|
+
target:target_T,
|
|
7
|
+
source:source_T
|
|
8
|
+
):out_T
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Function&{ prototype:object }}target
|
|
3
|
+
* @param {Function&{ prototype:object }}source
|
|
4
|
+
* @returns {Function&{ prototype:object }}
|
|
5
|
+
*/
|
|
6
|
+
export function prototype_mixin(target, source) {
|
|
7
|
+
const target_prototype = target.prototype
|
|
8
|
+
const source_prototype = source.prototype
|
|
9
|
+
const propertyNames = Object.getOwnPropertyNames(source_prototype)
|
|
10
|
+
for (let i = 0; i < propertyNames.length; i++) {
|
|
11
|
+
const propertyName = propertyNames[i]
|
|
12
|
+
if (propertyName !== 'constructor') {
|
|
13
|
+
Object.defineProperty(
|
|
14
|
+
target_prototype,
|
|
15
|
+
propertyName,
|
|
16
|
+
Object.getOwnPropertyDescriptor(source_prototype, propertyName))
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return target
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calls push on an array
|
|
3
|
+
*/
|
|
4
|
+
export declare function push<
|
|
5
|
+
I extends unknown = unknown
|
|
6
|
+
>(
|
|
7
|
+
a:readonly I[],
|
|
8
|
+
...arg_a:readonly I[]
|
|
9
|
+
):number
|
|
10
|
+
export declare function maybe_push<
|
|
11
|
+
I extends unknown = unknown
|
|
12
|
+
>(
|
|
13
|
+
maybe_a:readonly I[]|undefined,
|
|
14
|
+
...arg_a:readonly I[]
|
|
15
|
+
):number|undefined
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calls push on an array
|
|
3
|
+
* @param {unknown[]}a
|
|
4
|
+
* @param {unknown}arg_a
|
|
5
|
+
* @returns {number}
|
|
6
|
+
*/
|
|
7
|
+
export function push(a, ...arg_a) {
|
|
8
|
+
return a.push.apply(a, arg_a)
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @param {unknown[]|undefined}maybe_a
|
|
12
|
+
* @param {unknown}arg_a
|
|
13
|
+
* @returns {number|undefined}
|
|
14
|
+
*/
|
|
15
|
+
export function maybe_push(maybe_a, ...arg_a) {
|
|
16
|
+
return maybe_a ? push(maybe_a, ...arg_a) : void 0
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { isNumber } from '../isNumber/index.js'
|
|
2
|
+
export function quantile_(a, bound_a, sorted_ = quantile_sorted_) {
|
|
3
|
+
const sorted = sorted_(a)
|
|
4
|
+
return bound_a.map((q)=>{
|
|
5
|
+
if (sorted.length === 0) return 0
|
|
6
|
+
const pos = Math.floor((sorted.length - 1) * q)
|
|
7
|
+
const base = pos
|
|
8
|
+
const rest = pos - base
|
|
9
|
+
return sorted[base + 1] !== undefined ? sorted[base] + rest * (sorted[base + 1] - sorted[base]) : sorted[base]
|
|
10
|
+
})
|
|
11
|
+
}
|
|
12
|
+
export function quantile_sorted_(a) {
|
|
13
|
+
return a.filter(isNumber).sort((val0, val1)=>val0 - val1
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
export { quantile_ as quantile }
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare function query_str_(
|
|
2
|
+
query?:query_T,
|
|
3
|
+
prefix?:string
|
|
4
|
+
):string
|
|
5
|
+
export {
|
|
6
|
+
query_str_ as _str__query,
|
|
7
|
+
query_str_ as _query_str,
|
|
8
|
+
}
|
|
9
|
+
export declare type query_T =
|
|
10
|
+
string|
|
|
11
|
+
{
|
|
12
|
+
[key:string]:query_value_T
|
|
13
|
+
}|
|
|
14
|
+
Record<string, query_value_T>|
|
|
15
|
+
Map<string, query_value_T>
|
|
16
|
+
export declare type query_value_T =
|
|
17
|
+
string
|
|
18
|
+
|number
|
|
19
|
+
|boolean
|
|
20
|
+
|string[]
|
|
21
|
+
|number[]
|
|
22
|
+
|boolean[]
|
|
23
|
+
|(string|number)[]
|
|
24
|
+
|(string|boolean)[]
|
|
25
|
+
|(number|boolean)[]
|
|
26
|
+
|(string|number|boolean)[]
|
|
27
|
+
export declare type query_type = query_T
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { isArray } from '../isArray/index.js'
|
|
2
|
+
/**
|
|
3
|
+
* @param {import('./index.d.ts').query_T}[query]
|
|
4
|
+
* @param {string}[prefix]
|
|
5
|
+
* @returns {string}
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
export function query_str_(
|
|
9
|
+
query = '',
|
|
10
|
+
prefix = query[0] === '?' ? '' : '?'
|
|
11
|
+
) {
|
|
12
|
+
if (typeof query === 'string') return `${prefix}${query}`
|
|
13
|
+
const query_str_a = []
|
|
14
|
+
if (query instanceof Map) {
|
|
15
|
+
for (let [key, val] of query.entries()) {
|
|
16
|
+
query_str_a__push(key, val)
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
for (let key in query) {
|
|
20
|
+
query_str_a__push(key, query[key])
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return query_str_a.length ? `${prefix}${query_str_a.join('&')}` : ''
|
|
24
|
+
/**
|
|
25
|
+
* @param {string}key
|
|
26
|
+
* @param {import('./index.d.ts').query_value_T}in_query_value
|
|
27
|
+
*/
|
|
28
|
+
function query_str_a__push(
|
|
29
|
+
key,
|
|
30
|
+
in_query_value
|
|
31
|
+
) {
|
|
32
|
+
const query_value =
|
|
33
|
+
in_query_value == null ? '' : in_query_value
|
|
34
|
+
if (isArray(query_value)) {
|
|
35
|
+
for (const $value_item of query_value) {
|
|
36
|
+
query_str_a.push(`${encodeURIComponent(key)}[]=${encodeURIComponent($value_item)}`)
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
query_str_a.push(`${encodeURIComponent(key)}=${encodeURIComponent(query_value)}`)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
query_str_ as _str__query,
|
|
45
|
+
query_str_ as _query_str,
|
|
46
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { test } from 'uvu'
|
|
2
|
+
import { equal } from 'uvu/assert'
|
|
3
|
+
import type { query_value_T } from './index.js'
|
|
4
|
+
import { query_str_ } from './index.js'
|
|
5
|
+
test('query_str_|interface', ()=>{
|
|
6
|
+
equal(
|
|
7
|
+
query_str_({
|
|
8
|
+
number: 1, string: 'a', boolean: true,
|
|
9
|
+
number_a: [1, 2, 3], string_a: ['a', 'b', 'c'],
|
|
10
|
+
string_or_number_a: ['a', 1],
|
|
11
|
+
string_or_boolean_a: ['a', true],
|
|
12
|
+
number_or_boolean_a: [true, 1],
|
|
13
|
+
string_or_number_or_boolean_a: ['a', true, 1],
|
|
14
|
+
} as query_I),
|
|
15
|
+
'?number=1&string=a&boolean=true&number_a[]=1&number_a[]=2&number_a[]=3&string_a[]=a&string_a[]=b&string_a[]=c&string_or_number_a[]=a&string_or_number_a[]=1&string_or_boolean_a[]=a&string_or_boolean_a[]=true&number_or_boolean_a[]=true&number_or_boolean_a[]=1&string_or_number_or_boolean_a[]=a&string_or_number_or_boolean_a[]=true&string_or_number_or_boolean_a[]=1'
|
|
16
|
+
)
|
|
17
|
+
})
|
|
18
|
+
test('query_str_|record', ()=>{
|
|
19
|
+
equal(
|
|
20
|
+
query_str_({
|
|
21
|
+
number: 1, string: 'a', boolean: true,
|
|
22
|
+
number_a: [1, 2, 3], string_a: ['a', 'b', 'c'],
|
|
23
|
+
string_or_number_a: ['a', 1],
|
|
24
|
+
string_or_boolean_a: ['a', true],
|
|
25
|
+
number_or_boolean_a: [true, 1],
|
|
26
|
+
string_or_number_or_boolean_a: ['a', true, 1],
|
|
27
|
+
}),
|
|
28
|
+
'?number=1&string=a&boolean=true&number_a[]=1&number_a[]=2&number_a[]=3&string_a[]=a&string_a[]=b&string_a[]=c&string_or_number_a[]=a&string_or_number_a[]=1&string_or_boolean_a[]=a&string_or_boolean_a[]=true&number_or_boolean_a[]=true&number_or_boolean_a[]=1&string_or_number_or_boolean_a[]=a&string_or_number_or_boolean_a[]=true&string_or_number_or_boolean_a[]=1'
|
|
29
|
+
)
|
|
30
|
+
})
|
|
31
|
+
test.run()
|
|
32
|
+
interface query_I {
|
|
33
|
+
[key:string]:query_value_T
|
|
34
|
+
number:number
|
|
35
|
+
string:string
|
|
36
|
+
boolean:boolean
|
|
37
|
+
number_a:number[]
|
|
38
|
+
string_a:string[]
|
|
39
|
+
string_or_number_a:(string|number)[]
|
|
40
|
+
string_or_boolean_a:(string|boolean)[]
|
|
41
|
+
number_or_boolean_a:(boolean|number)[]
|
|
42
|
+
string_or_number_or_boolean_a:(string|boolean|number)[]
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function query_str__searchParams_(query_str:string):URLSearchParams
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { query_str__searchParams_ } from '../query_str__searchParams/index.js'
|
|
2
|
+
import { searchParams_o_ } from '../searchParams_o/index.js'
|
|
3
|
+
/**
|
|
4
|
+
* @param {string}query_str
|
|
5
|
+
* @returns {URLSearchParams}
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
export function query_str__searchParams_o_(query_str) {
|
|
9
|
+
const searchParams = query_str__searchParams_(query_str)
|
|
10
|
+
return searchParams_o_(searchParams)
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare function queue_(
|
|
2
|
+
queue_size?:number
|
|
3
|
+
):queue_T
|
|
4
|
+
export { queue_ as _queue, }
|
|
5
|
+
export interface queue_T {
|
|
6
|
+
add<Out>(fn:()=>Promise<Out>):Promise<Out>
|
|
7
|
+
add_sync<Out>(fn:()=>Promise<Out>):number
|
|
8
|
+
close():Promise<number>
|
|
9
|
+
cancel():number
|
|
10
|
+
get pending():number
|
|
11
|
+
throttle(
|
|
12
|
+
max_item_count_OR_throttle__continue_:
|
|
13
|
+
number
|
|
14
|
+
|((item_count:number)=>boolean)
|
|
15
|
+
):Promise<number>
|
|
16
|
+
get item_count():number
|
|
17
|
+
}
|
|
18
|
+
export interface queue_waiting_T {
|
|
19
|
+
fn:()=>Promise<any>
|
|
20
|
+
fulfil:(v:any)=>void
|
|
21
|
+
reject:(err:any)=>void
|
|
22
|
+
}
|
|
23
|
+
export type queue_item_T = queue_waiting_T
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { noop } from '../noop/index.js'
|
|
2
|
+
const default_queue_size = 4
|
|
3
|
+
/**
|
|
4
|
+
* @param queue_size
|
|
5
|
+
* @returns {queue_T}
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
export function queue_(
|
|
9
|
+
queue_size = default_queue_size
|
|
10
|
+
) {
|
|
11
|
+
if (!queue_size) queue_size = default_queue_size
|
|
12
|
+
const waiting_a = []
|
|
13
|
+
let pending = 0
|
|
14
|
+
let closed = false
|
|
15
|
+
let close__resolve
|
|
16
|
+
let cancelled = false
|
|
17
|
+
/** @type {Set<(item_count:number)=>void>} */
|
|
18
|
+
const throttle__subscriber_S = new Set()
|
|
19
|
+
let processed__count = 0
|
|
20
|
+
return /** @type {queue_T} */{
|
|
21
|
+
add(fn) {
|
|
22
|
+
if (closed) {
|
|
23
|
+
throw new Error('Cannot add to a closed queue')
|
|
24
|
+
}
|
|
25
|
+
return new Promise((resolve, reject)=>{
|
|
26
|
+
waiting_a.push({ fn, resolve, reject })
|
|
27
|
+
throttle__notify()
|
|
28
|
+
dequeue()
|
|
29
|
+
})
|
|
30
|
+
},
|
|
31
|
+
add_sync(fn) {
|
|
32
|
+
if (closed) {
|
|
33
|
+
throw new Error('Cannot add to a closed queue')
|
|
34
|
+
}
|
|
35
|
+
waiting_a.push({ fn, resolve: noop, reject: noop })
|
|
36
|
+
throttle__notify()
|
|
37
|
+
dequeue()
|
|
38
|
+
return item_count_()
|
|
39
|
+
},
|
|
40
|
+
close() {
|
|
41
|
+
closed = true
|
|
42
|
+
return new Promise(resolve=>{
|
|
43
|
+
if (pending) {
|
|
44
|
+
close__resolve = resolve
|
|
45
|
+
} else {
|
|
46
|
+
resolve(processed__count)
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
},
|
|
50
|
+
cancel() {
|
|
51
|
+
closed = true
|
|
52
|
+
cancelled = true
|
|
53
|
+
if (close__resolve) close__resolve(processed__count)
|
|
54
|
+
return pending
|
|
55
|
+
},
|
|
56
|
+
get pending() {
|
|
57
|
+
return pending
|
|
58
|
+
},
|
|
59
|
+
get item_count() {
|
|
60
|
+
return item_count_()
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* @param {number|((item_count:number)=>boolean)}max_item_count_OR_throttle__continue_
|
|
64
|
+
* @returns {Promise<number>}
|
|
65
|
+
*/
|
|
66
|
+
throttle(max_item_count_OR_throttle__continue_) {
|
|
67
|
+
const throttle__continue_ =
|
|
68
|
+
typeof max_item_count_OR_throttle__continue_ === 'function'
|
|
69
|
+
? max_item_count_OR_throttle__continue_
|
|
70
|
+
: item_count=>item_count <= max_item_count_OR_throttle__continue_
|
|
71
|
+
let resolve
|
|
72
|
+
const pending__wait__promise =
|
|
73
|
+
new Promise(res=>{
|
|
74
|
+
resolve = res
|
|
75
|
+
})
|
|
76
|
+
const throttle__subscriber =
|
|
77
|
+
item_count=>{
|
|
78
|
+
if (throttle__continue_(item_count)) {
|
|
79
|
+
throttle__subscriber_S.delete(throttle__subscriber)
|
|
80
|
+
resolve(item_count)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
throttle__subscriber_S.add(throttle__subscriber)
|
|
84
|
+
throttle__subscriber(item_count_())
|
|
85
|
+
return pending__wait__promise
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function item_count_() {
|
|
89
|
+
return pending + waiting_a.length
|
|
90
|
+
}
|
|
91
|
+
function dequeue() {
|
|
92
|
+
if (cancelled) return
|
|
93
|
+
if (pending >= queue_size) return
|
|
94
|
+
if (!waiting_a.length) {
|
|
95
|
+
if (!pending && close__resolve) close__resolve(processed__count)
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
pending++
|
|
99
|
+
const { fn, resolve, reject } = waiting_a.shift()
|
|
100
|
+
const promise = fn()
|
|
101
|
+
try {
|
|
102
|
+
promise
|
|
103
|
+
.then($res=>{
|
|
104
|
+
if (!cancelled) return resolve($res)
|
|
105
|
+
}, $rej=>{
|
|
106
|
+
if (!cancelled) return reject($rej)
|
|
107
|
+
})
|
|
108
|
+
.then(()=>{
|
|
109
|
+
processed__count++
|
|
110
|
+
if (!cancelled) pending__decrement()
|
|
111
|
+
dequeue()
|
|
112
|
+
})
|
|
113
|
+
} catch (err) {
|
|
114
|
+
reject(err)
|
|
115
|
+
pending__decrement()
|
|
116
|
+
dequeue()
|
|
117
|
+
}
|
|
118
|
+
dequeue()
|
|
119
|
+
}
|
|
120
|
+
function pending__decrement() {
|
|
121
|
+
pending--
|
|
122
|
+
throttle__notify()
|
|
123
|
+
}
|
|
124
|
+
function throttle__notify() {
|
|
125
|
+
const item_count = item_count_()
|
|
126
|
+
throttle__subscriber_S.forEach(throttle__subscriber=>
|
|
127
|
+
throttle__subscriber(item_count))
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
export { queue_ as _queue, }
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { test } from 'uvu'
|
|
2
|
+
import { equal } from 'uvu/assert'
|
|
3
|
+
import { promise_o_ } from '../promise_o/index.js'
|
|
4
|
+
import { queue_ } from '../queue/index.js'
|
|
5
|
+
import { run } from '../run/index.js'
|
|
6
|
+
import { tick } from '../tick/index.js'
|
|
7
|
+
test('queue_(1).add|queue length of 1 at a time', async ()=>{
|
|
8
|
+
const queue = queue_(1)
|
|
9
|
+
const promise_o_a = [promise_o_(), promise_o_(), promise_o_()]
|
|
10
|
+
const ret_a:any[] = [null, null, null]
|
|
11
|
+
queue.add(()=>promise_o_a[0].promise).then(ret=>ret_a[0] = ret)
|
|
12
|
+
queue.add(()=>promise_o_a[1].promise).then(ret=>ret_a[1] = ret)
|
|
13
|
+
queue.add(()=>promise_o_a[2].promise).then(ret=>ret_a[2] = ret)
|
|
14
|
+
equal(ret_a, [null, null, null])
|
|
15
|
+
promise_o_a[1].resolve('val1')
|
|
16
|
+
await tick()
|
|
17
|
+
equal(ret_a, [null, null, null])
|
|
18
|
+
promise_o_a[0].resolve('val0')
|
|
19
|
+
await tick()
|
|
20
|
+
equal(ret_a, ['val0', null, null])
|
|
21
|
+
await tick()
|
|
22
|
+
equal(ret_a, ['val0', 'val1', null])
|
|
23
|
+
promise_o_a[2].resolve('val2')
|
|
24
|
+
await tick()
|
|
25
|
+
equal(ret_a, ['val0', 'val1', 'val2'])
|
|
26
|
+
const close__promise__arg_aa:any[][] = []
|
|
27
|
+
queue.close()
|
|
28
|
+
.then((...arg_a)=>
|
|
29
|
+
close__promise__arg_aa.push(arg_a))
|
|
30
|
+
await tick()
|
|
31
|
+
equal(close__promise__arg_aa, [[3]])
|
|
32
|
+
})
|
|
33
|
+
test('queue_(2).add|queue length of 2 at a time', async ()=>{
|
|
34
|
+
const queue = queue_(2)
|
|
35
|
+
const promise_o_a = [promise_o_(), promise_o_(), promise_o_(), promise_o_()]
|
|
36
|
+
const ret_a:any[] = [null, null, null, null]
|
|
37
|
+
queue.add(()=>promise_o_a[0].promise).then(ret=>ret_a[0] = ret)
|
|
38
|
+
queue.add(()=>promise_o_a[1].promise).then(ret=>ret_a[1] = ret)
|
|
39
|
+
queue.add(()=>promise_o_a[2].promise).then(ret=>ret_a[2] = ret)
|
|
40
|
+
queue.add(()=>promise_o_a[3].promise).then(ret=>ret_a[3] = ret)
|
|
41
|
+
equal(ret_a, [null, null, null, null])
|
|
42
|
+
promise_o_a[2].resolve('val2')
|
|
43
|
+
await tick()
|
|
44
|
+
equal(ret_a, [null, null, null, null])
|
|
45
|
+
promise_o_a[3].resolve('val3')
|
|
46
|
+
await tick()
|
|
47
|
+
equal(ret_a, [null, null, null, null])
|
|
48
|
+
promise_o_a[0].resolve('val0')
|
|
49
|
+
await tick()
|
|
50
|
+
equal(ret_a, ['val0', null, null, null])
|
|
51
|
+
await tick()
|
|
52
|
+
equal(ret_a, ['val0', null, 'val2', null])
|
|
53
|
+
await tick()
|
|
54
|
+
equal(ret_a, ['val0', null, 'val2', 'val3'])
|
|
55
|
+
promise_o_a[1].resolve('val1')
|
|
56
|
+
await tick()
|
|
57
|
+
equal(ret_a, ['val0', 'val1', 'val2', 'val3'])
|
|
58
|
+
const close__promise__arg_aa:any[][] = []
|
|
59
|
+
queue.close()
|
|
60
|
+
.then((...arg_a)=>
|
|
61
|
+
close__promise__arg_aa.push(arg_a))
|
|
62
|
+
await tick()
|
|
63
|
+
equal(close__promise__arg_aa, [[4]])
|
|
64
|
+
})
|
|
65
|
+
test('queue_(1).add_sync|queue length of 1 at a time', async ()=>{
|
|
66
|
+
const queue = queue_(1)
|
|
67
|
+
const promise_o_a = [promise_o_(), promise_o_(), promise_o_()]
|
|
68
|
+
const ret_a:any[] = [null, null, null]
|
|
69
|
+
ret_a[0] = queue.add_sync(()=>promise_o_a[0].promise)
|
|
70
|
+
equal(ret_a, [1, null, null])
|
|
71
|
+
ret_a[1] = queue.add_sync(()=>promise_o_a[1].promise)
|
|
72
|
+
equal(ret_a, [1, 2, null])
|
|
73
|
+
ret_a[2] = queue.add_sync(()=>promise_o_a[2].promise)
|
|
74
|
+
equal(ret_a, [1, 2, 3])
|
|
75
|
+
})
|
|
76
|
+
test('queue_(2).add_sync|queue length of 2 at a time', async ()=>{
|
|
77
|
+
const queue = queue_(2)
|
|
78
|
+
const promise_o_a = [promise_o_(), promise_o_(), promise_o_(), promise_o_()]
|
|
79
|
+
const ret_a:any[] = [null, null, null, null]
|
|
80
|
+
ret_a[0] = queue.add_sync(()=>promise_o_a[0].promise)
|
|
81
|
+
equal(ret_a, [1, null, null, null])
|
|
82
|
+
ret_a[1] = queue.add_sync(()=>promise_o_a[1].promise)
|
|
83
|
+
equal(ret_a, [1, 2, null, null])
|
|
84
|
+
ret_a[2] = queue.add_sync(()=>promise_o_a[2].promise)
|
|
85
|
+
equal(ret_a, [1, 2, 3, null])
|
|
86
|
+
ret_a[3] = queue.add_sync(()=>promise_o_a[3].promise)
|
|
87
|
+
equal(ret_a, [1, 2, 3, 4])
|
|
88
|
+
})
|
|
89
|
+
test('queue_(2).cancel|immediately stops queue discarding pending jobs|returns pending count', async ()=>{
|
|
90
|
+
const queue = queue_(2)
|
|
91
|
+
let pending:number|undefined = undefined
|
|
92
|
+
const promise_o_a = [
|
|
93
|
+
promise_o_(),
|
|
94
|
+
run(()=>{
|
|
95
|
+
const promise_o = promise_o_()
|
|
96
|
+
promise_o.promise.then($=>{
|
|
97
|
+
pending = queue.cancel()
|
|
98
|
+
return $
|
|
99
|
+
})
|
|
100
|
+
return promise_o
|
|
101
|
+
}),
|
|
102
|
+
promise_o_(),
|
|
103
|
+
promise_o_()
|
|
104
|
+
]
|
|
105
|
+
const ret_a:any[] = [null, null, null, null]
|
|
106
|
+
queue.add(()=>promise_o_a[0].promise).then(ret=>ret_a[0] = ret)
|
|
107
|
+
queue.add(()=>promise_o_a[1].promise).then(ret=>ret_a[1] = ret)
|
|
108
|
+
queue.add(()=>promise_o_a[2].promise).then(ret=>ret_a[2] = ret)
|
|
109
|
+
queue.add(()=>promise_o_a[3].promise).then(ret=>ret_a[3] = ret)
|
|
110
|
+
const close__promise__arg_aa:any[][] = []
|
|
111
|
+
queue.close()
|
|
112
|
+
.then((...arg_a)=>
|
|
113
|
+
close__promise__arg_aa.push(arg_a))
|
|
114
|
+
equal(ret_a, [null, null, null, null])
|
|
115
|
+
equal(pending, undefined)
|
|
116
|
+
equal(close__promise__arg_aa, [])
|
|
117
|
+
promise_o_a[2].resolve('val2')
|
|
118
|
+
await tick()
|
|
119
|
+
equal(ret_a, [null, null, null, null])
|
|
120
|
+
equal(pending, undefined)
|
|
121
|
+
equal(close__promise__arg_aa, [])
|
|
122
|
+
promise_o_a[3].resolve('val3')
|
|
123
|
+
await tick()
|
|
124
|
+
equal(ret_a, [null, null, null, null])
|
|
125
|
+
equal(pending, undefined)
|
|
126
|
+
equal(close__promise__arg_aa, [])
|
|
127
|
+
promise_o_a[1].resolve('val1')
|
|
128
|
+
await tick()
|
|
129
|
+
equal(ret_a, [null, null, null, null])
|
|
130
|
+
equal(pending, 2)
|
|
131
|
+
equal(close__promise__arg_aa, [[0]])
|
|
132
|
+
})
|
|
133
|
+
test('throttle|number', async ()=>{
|
|
134
|
+
const queue = queue_(2)
|
|
135
|
+
const promise_o_a = [promise_o_(), promise_o_(), promise_o_(), promise_o_(), promise_o_()]
|
|
136
|
+
promise_o_a.map(pending_o=>queue.add(()=>pending_o.promise))
|
|
137
|
+
const pending__wait__arg_aa:any[][] = []
|
|
138
|
+
const throttle__then = (...arg_a:any[])=>{
|
|
139
|
+
pending__wait__arg_aa.push(arg_a)
|
|
140
|
+
}
|
|
141
|
+
queue.throttle(5)
|
|
142
|
+
.then(throttle__then)
|
|
143
|
+
await tick()
|
|
144
|
+
equal(pending__wait__arg_aa, [[5]])
|
|
145
|
+
queue.throttle(3)
|
|
146
|
+
.then(throttle__then)
|
|
147
|
+
await tick()
|
|
148
|
+
equal(pending__wait__arg_aa, [[5]])
|
|
149
|
+
promise_o_a[0].resolve(true)
|
|
150
|
+
await tick()
|
|
151
|
+
await tick()
|
|
152
|
+
equal(pending__wait__arg_aa, [[5]])
|
|
153
|
+
promise_o_a[1].resolve(true)
|
|
154
|
+
await tick()
|
|
155
|
+
await tick()
|
|
156
|
+
equal(pending__wait__arg_aa, [[5], [3]])
|
|
157
|
+
})
|
|
158
|
+
test('throttle|fn', async ()=>{
|
|
159
|
+
const queue = queue_(2)
|
|
160
|
+
const promise_o_a = [promise_o_(), promise_o_(), promise_o_(), promise_o_(), promise_o_()]
|
|
161
|
+
promise_o_a.map(pending_o=>queue.add(()=>pending_o.promise))
|
|
162
|
+
const pending__wait__arg_aa:any[][] = []
|
|
163
|
+
const throttle__then = (...arg_a:any[])=>{
|
|
164
|
+
pending__wait__arg_aa.push(arg_a)
|
|
165
|
+
}
|
|
166
|
+
queue.throttle(item_count=>
|
|
167
|
+
item_count <= 5
|
|
168
|
+
).then(throttle__then)
|
|
169
|
+
await tick()
|
|
170
|
+
equal(pending__wait__arg_aa, [[5]])
|
|
171
|
+
queue.throttle(item_count=>
|
|
172
|
+
item_count <= 3
|
|
173
|
+
).then(throttle__then)
|
|
174
|
+
await tick()
|
|
175
|
+
equal(pending__wait__arg_aa, [[5]])
|
|
176
|
+
promise_o_a[0].resolve(true)
|
|
177
|
+
await tick()
|
|
178
|
+
await tick()
|
|
179
|
+
equal(pending__wait__arg_aa, [[5]])
|
|
180
|
+
promise_o_a[1].resolve(true)
|
|
181
|
+
await tick()
|
|
182
|
+
await tick()
|
|
183
|
+
equal(pending__wait__arg_aa, [[5], [3]])
|
|
184
|
+
})
|
|
185
|
+
test('pending', async ()=>{
|
|
186
|
+
const queue = queue_(2)
|
|
187
|
+
const promise_o_a = [promise_o_(), promise_o_(), promise_o_()]
|
|
188
|
+
equal(queue.pending, 0)
|
|
189
|
+
queue.add(()=>promise_o_a[0].promise).then()
|
|
190
|
+
equal(queue.pending, 1)
|
|
191
|
+
queue.add(()=>promise_o_a[1].promise).then()
|
|
192
|
+
equal(queue.pending, 2)
|
|
193
|
+
queue.add(()=>promise_o_a[2].promise).then()
|
|
194
|
+
equal(queue.pending, 2)
|
|
195
|
+
})
|
|
196
|
+
test('item_count', async ()=>{
|
|
197
|
+
const queue = queue_(2)
|
|
198
|
+
const promise_o_a = [promise_o_(), promise_o_(), promise_o_()]
|
|
199
|
+
equal(queue.item_count, 0)
|
|
200
|
+
queue.add(()=>promise_o_a[0].promise).then()
|
|
201
|
+
equal(queue.item_count, 1)
|
|
202
|
+
queue.add(()=>promise_o_a[1].promise).then()
|
|
203
|
+
equal(queue.item_count, 2)
|
|
204
|
+
queue.add(()=>promise_o_a[2].promise).then()
|
|
205
|
+
equal(queue.item_count, 3)
|
|
206
|
+
})
|
|
207
|
+
test.run()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function rPad(str:string, padString:string, length:number):string
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string}str
|
|
3
|
+
* @param {string}padString
|
|
4
|
+
* @param {number}length
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
export function rPad(str, padString, length) {
|
|
8
|
+
let str2 = str.toString()
|
|
9
|
+
while (str2.length < length) str2 = str2 + padString
|
|
10
|
+
return str2
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns Array of `obj[key_a[]]`.
|
|
3
|
+
*/
|
|
4
|
+
export declare function r_val_a_<
|
|
5
|
+
Val extends unknown = unknown
|
|
6
|
+
>(
|
|
7
|
+
obj:Record<string, Val>,
|
|
8
|
+
key_a?:readonly string[]
|
|
9
|
+
):Val[]
|
|
10
|
+
export declare function maybe_r_val_a_<
|
|
11
|
+
Val extends unknown = unknown, Or = null
|
|
12
|
+
>(
|
|
13
|
+
obj:Record<string, Val>|undefined,
|
|
14
|
+
key_a?:readonly string[],
|
|
15
|
+
or?:Or
|
|
16
|
+
):Val[]|Or
|
|
17
|
+
export {
|
|
18
|
+
r_val_a_ as key_a1_from_val_a1_fn,
|
|
19
|
+
r_val_a_ as _key_a1_from_val_a1,
|
|
20
|
+
r_val_a_ as _a1__val__from__a1__key,
|
|
21
|
+
maybe_r_val_a_ as maybe_key_a1_from_val_a1_fn,
|
|
22
|
+
maybe_r_val_a_ as _maybe_key_a1_from_val_a1,
|
|
23
|
+
}
|