ctx-core 5.1.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all/CACHE_VERSION/index.d.ts +10 -0
- package/all/CACHE_VERSION/index.js +14 -0
- package/all/NODE_ENV/index.d.ts +10 -0
- package/all/NODE_ENV/index.js +14 -0
- package/all/Request/index.js +2 -1
- package/all/Response/index.js +1 -1
- package/all/VERSION/index.d.ts +7 -0
- package/all/VERSION/index.js +12 -0
- package/all/add/index.js +1 -1
- package/all/all_union_a/index.js +1 -1
- package/all/and/index.js +2 -1
- package/all/andand_or/index.js +2 -1
- package/all/andandfn/index.js +4 -3
- package/all/apply/index.js +4 -2
- package/all/arg_a__pick/index.d.ts +6 -0
- package/all/arg_a__pick/index.js +16 -0
- package/all/arg_i0_a/index.js +3 -2
- package/all/assign_fn_key_a/index.js +1 -1
- package/all/bad_gateway/index.js +2 -1
- package/all/bad_request/index.js +1 -1
- package/all/be/index.js +3 -2
- package/all/be_/index.d.ts +38 -3
- package/all/be_/index.js +52 -14
- package/all/be_/index.test.ts +191 -90
- package/all/be_lock_memosig_triple/index.test.ts +6 -6
- package/all/be_memo_pair/index.test.ts +4 -4
- package/all/be_memosig_triple/index.test.ts +6 -6
- package/all/be_sig_triple/index.test.ts +4 -4
- package/all/binary_sort_rank/index.js +2 -1
- package/all/bind_apply/index.js +4 -4
- package/all/bind_call/index.js +1 -1
- package/all/bind_map_apply/index.js +1 -1
- package/all/bind_map_call/index.js +4 -5
- package/all/btoa/index.js +2 -1
- package/all/btoa_Uint32Array/index.js +2 -1
- package/all/call/index.js +2 -1
- package/all/call_assign/index.js +2 -1
- package/all/chain/index.js +3 -2
- package/all/clone_assign_fn_key_a/index.js +2 -1
- package/all/color_hsv_phi_rgb_a/index.js +3 -2
- package/all/color_invert_rgb_a/index.js +3 -2
- package/all/compact_a_ctx/index.js +2 -1
- package/all/compare/index.js +2 -1
- package/all/compose/index.js +5 -5
- package/all/concat_truthy_a/index.js +4 -2
- package/all/console__error/index.js +2 -1
- package/all/crypto__sign/index.js +2 -1
- package/all/currency_str/index.js +2 -1
- package/all/currency_symbol/index.js +2 -1
- package/all/curry/index.js +2 -2
- package/all/date/index.js +1 -1
- package/all/default_arg_a/index.d.ts +11 -0
- package/all/default_arg_a/index.js +41 -0
- package/all/dfn_flag_r/index.d.ts +8 -0
- package/all/dfn_flag_r/index.js +24 -0
- package/all/difference_a/index.js +4 -2
- package/all/each/index.js +2 -1
- package/all/ensure__refresh/index.js +3 -2
- package/all/eq/index.js +5 -3
- package/all/eql_fn_a/index.js +1 -1
- package/all/error__print/index.js +4 -2
- package/all/error_o/index.js +4 -2
- package/all/falsy__none/index.js +2 -1
- package/all/fetch/index.js +2 -1
- package/all/fetch__template_pair/index.js +2 -1
- package/all/fetch_method/index.js +2 -1
- package/all/fetch_response_pair/index.js +4 -2
- package/all/filter/index.js +2 -1
- package/all/filter_o/index.js +3 -2
- package/all/find/index.js +1 -1
- package/all/flag_a/index.d.ts +6 -0
- package/all/flag_a/index.js +13 -0
- package/all/flag_r/index.d.ts +8 -0
- package/all/flag_r/index.js +34 -0
- package/all/flag_r__pick/index.d.ts +11 -0
- package/all/flag_r__pick/index.js +31 -0
- package/all/flag_r_arg_a/index.d.ts +9 -0
- package/all/flag_r_arg_a/index.js +27 -0
- package/all/flag_r_param_name/index.d.ts +9 -0
- package/all/flag_r_param_name/index.js +24 -0
- package/all/flag_regex/index.d.ts +1 -0
- package/all/flag_regex/index.js +1 -0
- package/all/flatten/index.js +7 -7
- package/all/flip/index.js +3 -2
- package/all/head_arg_a/index.js +3 -2
- package/all/headers/index.js +1 -1
- package/all/hex__digest/index.js +2 -1
- package/all/hmac/index.js +2 -1
- package/all/hmac_key/index.js +2 -1
- package/all/html/index.d.ts +0 -1
- package/all/html/index.js +0 -4
- package/all/html_attr/index.d.ts +0 -2
- package/all/html_attr/index.js +0 -2
- package/all/html_attrs/index.d.ts +0 -1
- package/all/html_attrs/index.js +0 -1
- package/all/html_class/index.d.ts +0 -2
- package/all/html_class/index.js +0 -2
- package/all/html_dataset__data_attrs/index.d.ts +0 -1
- package/all/html_dataset__data_attrs/index.js +0 -1
- package/all/html_style/index.d.ts +0 -2
- package/all/html_style/index.js +0 -2
- package/all/html_style__assign/index.d.ts +2 -6
- package/all/html_style__assign/index.js +0 -5
- package/all/html_styles_o/index.d.ts +0 -5
- package/all/html_styles_o/index.js +0 -5
- package/all/http_error/index.js +4 -2
- package/all/idx/index.js +2 -1
- package/all/idx_filter/index.js +2 -2
- package/all/idx_key_r/index.js +5 -4
- package/all/idx_reject/index.js +1 -1
- package/all/idx_sort_a__sort_idx_o/index.js +2 -1
- package/all/import_meta_env/index.d.ts +10 -0
- package/all/import_meta_env/index.js +18 -0
- package/all/index.d.ts +22 -0
- package/all/index.js +22 -0
- package/all/intersection_a/index.js +4 -2
- package/all/intersection_by/index.js +2 -1
- package/all/invalid_state/index.js +2 -2
- package/all/is_development/index.d.ts +6 -0
- package/all/is_development/index.js +9 -0
- package/all/is_production/index.d.ts +9 -0
- package/all/is_production/index.js +12 -0
- package/all/is_staging/index.d.ts +9 -0
- package/all/is_staging/index.js +12 -0
- package/all/item_r_idx/index.js +2 -1
- package/all/js_html/index.d.ts +0 -4
- package/all/js_html/index.js +0 -4
- package/all/left_and/index.js +2 -1
- package/all/left_or/index.js +2 -1
- package/all/line__parse/index.js +2 -3
- package/all/line__transform_stream/index.js +1 -1
- package/all/links_html/index.d.ts +0 -5
- package/all/links_html/index.js +0 -4
- package/all/many_andand/index.js +4 -2
- package/all/many_andand_or/index.js +6 -3
- package/all/map/index.js +1 -1
- package/all/map_andand/index.js +1 -1
- package/all/map_andand_or/index.js +3 -2
- package/all/map_andandfn/index.js +2 -1
- package/all/map_apply/index.js +2 -1
- package/all/map_call/index.js +3 -2
- package/all/map_find/index.js +1 -1
- package/all/map_obj/index.js +3 -2
- package/all/map_obj_andand/index.js +1 -1
- package/all/missing_argument/index.js +3 -2
- package/all/missing_env__throw/index.d.ts +8 -0
- package/all/missing_env__throw/index.js +19 -0
- package/all/money_str/index.js +2 -2
- package/all/neq/index.js +2 -1
- package/all/not/index.js +4 -3
- package/all/not_found/index.js +1 -1
- package/all/nullish__none/index.js +1 -1
- package/all/nullish__not_all/index.js +1 -1
- package/all/number__count/index.js +2 -2
- package/all/o_a_present/index.js +1 -1
- package/all/one_andand/index.js +2 -1
- package/all/one_andand_or/index.js +3 -2
- package/all/or/index.js +2 -3
- package/all/or_null/index.js +2 -1
- package/all/param_dfn/index.d.ts +1 -0
- package/all/param_dfn/index.js +1 -0
- package/all/param_dfn_a_reducer/index.d.ts +9 -0
- package/all/param_dfn_a_reducer/index.js +12 -0
- package/all/param_dfn_split_regex/index.d.ts +1 -0
- package/all/param_dfn_split_regex/index.js +1 -0
- package/all/param_name_r_param_val_a/index.d.ts +11 -0
- package/all/param_name_r_param_val_a/index.js +29 -0
- package/all/param_r/index.d.ts +16 -0
- package/all/param_r/index.js +33 -0
- package/all/param_r/index.test.ts +28 -0
- package/all/parseFloat_andor/index.d.ts +3 -2
- package/all/parseFloat_andor/index.test.ts +1 -1
- package/all/promise_o/index.js +2 -1
- package/all/rank/index.js +2 -1
- package/all/reduce/index.js +1 -1
- package/all/reject/index.js +1 -1
- package/all/response_o/index.js +2 -3
- package/all/right_and/index.js +2 -1
- package/all/right_or/index.js +2 -1
- package/all/slice_arg_a/index.js +3 -2
- package/all/slice_arg_spread_a/index.js +3 -2
- package/all/sort/index.js +1 -1
- package/all/sort_a/index.js +1 -1
- package/all/sort_idx_a/index.js +1 -1
- package/all/sort_idx_o/index.js +5 -4
- package/all/sort_val_a/index.js +1 -1
- package/all/sort_val_a__transition_idx_a/index.js +1 -3
- package/all/spread/index.js +1 -1
- package/all/spread_slice/index.js +2 -1
- package/all/tap/index.js +1 -1
- package/all/tempfile_path/index.test.ts +1 -1
- package/all/unauthorized/index.js +1 -1
- package/all/unformat_currency_str/index.js +1 -2
- package/all/union_a/index.js +3 -2
- package/all/union_by/index.js +1 -1
- package/all/url__join/index.js +2 -1
- package/all/weak_r/index.js +1 -1
- package/all/wrap_a/index.js +8 -5
- package/all/wrap_aa/index.js +3 -2
- package/all/wrap_concat/index.js +4 -3
- package/all/zip_with/index.js +1 -1
- package/cli-args/index.d.ts +14 -0
- package/cli-args/index.js +14 -0
- package/env/index.d.ts +8 -0
- package/env/index.js +8 -0
- package/html/index.d.ts +31 -0
- package/html/index.js +31 -0
- package/package.json +13 -7
package/all/call/index.js
CHANGED
package/all/call_assign/index.js
CHANGED
package/all/chain/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/// <reference types="../chain/index.d.ts" />
|
|
1
2
|
import { isArray } from '../isArray/index.js'
|
|
2
3
|
/**
|
|
3
|
-
* @param {
|
|
4
|
-
* @param {
|
|
4
|
+
* @param {chain__o_T}chain__o
|
|
5
|
+
* @param {chain_key__T[]}key_a
|
|
5
6
|
* @returns {*}
|
|
6
7
|
*/
|
|
7
8
|
export function chain_(chain__o, ...key_a) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
/// <reference types="../assign_fn_key_a/index.d.ts" />
|
|
1
2
|
import { assign_fn_key_a } from '../assign_fn_key_a/index.js'
|
|
2
3
|
import { clone } from '../clone/index.js'
|
|
3
4
|
/**
|
|
4
5
|
* Assigns to a cloned obj array of keys the return value of function in key_a_fn_aa.
|
|
5
6
|
* @param {Record<string, object>}obj
|
|
6
|
-
* @param {
|
|
7
|
+
* @param {fn_key_a_tuple_T}key_a_fn_aa
|
|
7
8
|
* @returns {Record<string, object>}
|
|
8
9
|
*/
|
|
9
10
|
export function clone_assign_fn_key_a(
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
/// <reference types="../color_rgb_a__color_hsv_a/index.d.ts" />
|
|
1
2
|
import { color_rgb_a__color_hsv_a_ } from '../color_hsv/index.js'
|
|
2
3
|
import { PHI } from '../PHI/index.js'
|
|
3
4
|
const { floor } = Math
|
|
4
5
|
/**
|
|
5
6
|
* Returns an array of colors with a given sv (`[saturation, value]`)
|
|
6
7
|
* with h (hue) seperated by `1/PHI`
|
|
7
|
-
* @param {
|
|
8
|
-
* @returns {
|
|
8
|
+
* @param {hsv_phi_rgb_color_a__params_T}params
|
|
9
|
+
* @returns {color_rgb_a_T[]}
|
|
9
10
|
* @see {@link https://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/}
|
|
10
11
|
*/
|
|
11
12
|
export function color_hsv_phi_rgb_a_(
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/// <reference types="../color_invert_rgb_a/index.d.ts" />
|
|
1
2
|
/**
|
|
2
3
|
* Inverted color for rgb_color_a as rgb_color_a
|
|
3
|
-
* @param {
|
|
4
|
-
* @return {
|
|
4
|
+
* @param {color_hsv_a_T}rgb_color_a
|
|
5
|
+
* @return {color_hsv_a_T}
|
|
5
6
|
*/
|
|
6
7
|
export function color_invert_rgb_a_(
|
|
7
8
|
rgb_color_a
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/// <reference types="../array_types/index.d.ts" />
|
|
1
2
|
/**
|
|
2
3
|
* Returns a [sort_val_a__transition_a_frame_T](#sort_val_a__transition_a_frame_T)
|
|
3
4
|
* @param {unknown[]}sparse_a
|
|
4
|
-
* @returns {
|
|
5
|
+
* @returns {sort_val_a__transition_a_frame_T}
|
|
5
6
|
*/
|
|
6
7
|
export function compact_a_ctx_(sparse_a) {
|
|
7
8
|
const idx_a = []
|
package/all/compare/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/// <reference types="../array_types/index.d.ts" />
|
|
1
2
|
/**
|
|
2
3
|
* Returns a basic ascending or descending `compare` function to be used for sorting.
|
|
3
4
|
* @param {boolean}[asc]
|
|
4
|
-
* @returns {
|
|
5
|
+
* @returns {compare_T}
|
|
5
6
|
*/
|
|
6
7
|
export function compare_(asc = true) {
|
|
7
8
|
return (a, b)=>{
|
package/all/compose/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="../compose/index.d.ts" />
|
|
2
2
|
/**
|
|
3
3
|
* Composes fn_a into a single function
|
|
4
4
|
*
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
export function compose(...fn_a) {
|
|
10
10
|
return (
|
|
11
11
|
fn_a.reduceRight((prev_fn, next_fn)=>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
(...arg_a)=>
|
|
13
|
+
next_fn(
|
|
14
|
+
prev_fn(...arg_a)),
|
|
15
|
+
$=>$)
|
|
16
16
|
)
|
|
17
17
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
/// <reference types="../a_nowrap/index.d.ts" />
|
|
2
|
+
/// <reference types="../wrap_a/index.d.ts" />
|
|
1
3
|
import { wrap_a_ } from '../wrap_a/index.js'
|
|
2
4
|
/**
|
|
3
5
|
* Array#`concat`, setting falsy values to an empty Array (`[]`).
|
|
4
|
-
* @param {
|
|
6
|
+
* @param {a_nowrap_T}a_nowrap
|
|
5
7
|
* @param {unknown}rest_a
|
|
6
|
-
* @returns {
|
|
8
|
+
* @returns {wrap_a_T<unknown>}
|
|
7
9
|
*/
|
|
8
10
|
export function concat_truthy_a(a_nowrap, ...rest_a) {
|
|
9
11
|
let out_a = a_nowrap ? wrap_a_(a_nowrap) : []
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
/// <reference types="../crypto__sign/index.d.ts" />
|
|
1
2
|
import { crypto_ } from '../crypto/index.js'
|
|
2
3
|
/**
|
|
3
|
-
* @param {
|
|
4
|
+
* @param {crypto__sign__algorithm_T}algorithm
|
|
4
5
|
* @param {CryptoKey}key
|
|
5
6
|
* @param {BufferSource}data
|
|
6
7
|
* @returns {Promise<ArrayBuffer>}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="../currency_str/index.d.ts" />
|
|
1
2
|
import { currency_symbol_ } from '../currency_symbol/index.js'
|
|
2
3
|
import { money_str_ } from '../money_str/index.js'
|
|
3
4
|
/**
|
|
@@ -25,7 +26,7 @@ export {
|
|
|
25
26
|
currency_str_ as format__currency,
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
|
-
* @param {
|
|
29
|
+
* @param {currency_str__default_params_T|string}params
|
|
29
30
|
* @returns {(amount:number)=>string}
|
|
30
31
|
*/
|
|
31
32
|
export function currency_str__(params) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/// <reference types="../currency_code/index.d.ts" />
|
|
1
2
|
import { currencies } from '../currencies/index.js'
|
|
2
3
|
/**
|
|
3
4
|
* Returns the symbol for the given `currency_code_.currency`. Defaults to `$`
|
|
4
|
-
* @param {
|
|
5
|
+
* @param {currency_code_o_T|string}currency_code_
|
|
5
6
|
* @returns {string} * @see {@link https://github.com/bengourley/currency-symbol-map}
|
|
6
7
|
* @see {@link https://raw.githubusercontent.com/bengourley/currency-symbol-map/master/map.js}
|
|
7
8
|
*/
|
package/all/curry/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="../resolver_curry/index.d.ts" />
|
|
2
2
|
/// <reference types="./index.d.ts" />
|
|
3
3
|
/**
|
|
4
|
-
* @param append{
|
|
5
|
-
* @returns {
|
|
4
|
+
* @param append{append_current_T}
|
|
5
|
+
* @returns {resolver_curry_T}
|
|
6
6
|
*/
|
|
7
7
|
export function curry(append) {
|
|
8
8
|
return curry_((local, arg_a)=>
|
package/all/date/index.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { param_dfn_T } from '../param_dfn/index.js'
|
|
2
|
+
export declare function default_arg_a_(
|
|
3
|
+
arg_a:string[],
|
|
4
|
+
value_r_param_dfn?:Record<string, param_dfn_T>,
|
|
5
|
+
cancel_a?:string[]
|
|
6
|
+
):string[]
|
|
7
|
+
export {
|
|
8
|
+
default_arg_a_ as default_arg_a1_fn,
|
|
9
|
+
default_arg_a_ as _default_arg_a1,
|
|
10
|
+
default_arg_a_ as _a1__arg__default,
|
|
11
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { a_some } from '../a_some/index.js'
|
|
2
|
+
import { every } from '../every/index.js'
|
|
3
|
+
import { flag_a_ } from '../flag_a/index.js'
|
|
4
|
+
import { flag_r_ } from '../flag_r/index.js'
|
|
5
|
+
import { keys } from '../keys/index.js'
|
|
6
|
+
/**
|
|
7
|
+
* @param {string[]}arg_a
|
|
8
|
+
* @param {Record<string, param_dfn_T>}value_R_param_dfn
|
|
9
|
+
* @param {string[]}cancel_a
|
|
10
|
+
* @returns {string[]}
|
|
11
|
+
*/
|
|
12
|
+
export function default_arg_a_(
|
|
13
|
+
arg_a,
|
|
14
|
+
value_R_param_dfn = {},
|
|
15
|
+
cancel_a = []
|
|
16
|
+
) {
|
|
17
|
+
const default_arg_a = arg_a.slice(0)
|
|
18
|
+
const flag_h = flag_r_(default_arg_a)
|
|
19
|
+
if (
|
|
20
|
+
a_some(keys(flag_h), flag=>cancel_a.indexOf(flag) > -1
|
|
21
|
+
)) {
|
|
22
|
+
return default_arg_a
|
|
23
|
+
}
|
|
24
|
+
for (let param_dfn in value_R_param_dfn) {
|
|
25
|
+
const flag_a = flag_a_(param_dfn)
|
|
26
|
+
if (every(flag_a, (flag)=>!(flag in flag_h)
|
|
27
|
+
)) {
|
|
28
|
+
const value = value_R_param_dfn[param_dfn]
|
|
29
|
+
const $value = typeof value === 'function' ? value() : value
|
|
30
|
+
const flag1 = find(flag_a, (flag)=>/^--/.test(flag)
|
|
31
|
+
) || flag_a[0]
|
|
32
|
+
default_arg_a.push(flag1, $value)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return default_arg_a
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
default_arg_a_ as default_arg_a1_fn,
|
|
39
|
+
default_arg_a_ as _default_arg_a1,
|
|
40
|
+
default_arg_a_ as _a1__arg__default,
|
|
41
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="../types/index.d.ts" />
|
|
2
|
+
import { each } from '../each/index.js'
|
|
3
|
+
import { flag_a_ } from '../flag_a/index.js'
|
|
4
|
+
/**
|
|
5
|
+
* @param {param_dfn_T[]}param_dfn_a
|
|
6
|
+
* @returns {Record<string, string[]>}
|
|
7
|
+
*/
|
|
8
|
+
export function dfn_flag_r_(param_dfn_a) {
|
|
9
|
+
const dfn_flag_R = {}
|
|
10
|
+
each(param_dfn_a, (param_dfn)=>{
|
|
11
|
+
const flag_a = flag_a_(
|
|
12
|
+
typeof param_dfn === 'function'
|
|
13
|
+
? param_dfn()
|
|
14
|
+
: param_dfn)
|
|
15
|
+
each(flag_a, (flag)=>{
|
|
16
|
+
dfn_flag_R[flag] = flag_a
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
return dfn_flag_R
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
dfn_flag_r_ as dfn_flag_h_,
|
|
23
|
+
dfn_flag_r_ as _dfn_flag_h,
|
|
24
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
/// <reference types="../a_nowrap/index.d.ts" />
|
|
2
|
+
/// <reference types="../wrap_aa/index.d.ts" />
|
|
1
3
|
import { difference_set_ } from '../difference_set/index.js'
|
|
2
4
|
import { wrap_aa_ } from '../wrap_aa/index.js'
|
|
3
5
|
/**
|
|
4
6
|
* Returns the difference of n arrays
|
|
5
|
-
* @param {
|
|
6
|
-
* @returns {
|
|
7
|
+
* @param {a_nowrap_T}aa_nowrap
|
|
8
|
+
* @returns {wrap_aa_T[]}
|
|
7
9
|
* @see {@link http://www.2ality.com/2015/01/es6-set-operations.html}
|
|
8
10
|
*/
|
|
9
11
|
export function difference_a_(aa_nowrap) {
|
package/all/each/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
/// <reference types="../ensure__refresh/index.d.ts" />
|
|
1
2
|
import { clone } from '../clone/index.js'
|
|
2
3
|
/**
|
|
3
4
|
* `ensure` `obj[key]` is present or call `ensure(obj)`. Then call `refresh(obj, obj[key])`.
|
|
4
|
-
* @param {
|
|
5
|
-
* @param {
|
|
5
|
+
* @param {ensure_refresh__o_T}obj
|
|
6
|
+
* @param {ensure__refresh_opts_T}ensure__refresh_opts_a
|
|
6
7
|
* @returns {unknown}
|
|
7
8
|
*/
|
|
8
9
|
export function ensure__refresh(
|
package/all/eq/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
/// <reference types="../a_nowrap/index.d.ts" />
|
|
2
|
+
/// <reference types="../eq/index.d.ts" />
|
|
1
3
|
import { wrap_a_ } from '../wrap_a/index.js'
|
|
2
4
|
import { wrap_concat } from '../wrap_concat/index.js'
|
|
3
5
|
/**
|
|
4
6
|
* Returns `==` operator to all values in `a_nowrap`.
|
|
5
|
-
* @param {
|
|
7
|
+
* @param {a_nowrap_T}a_nowrap
|
|
6
8
|
* @returns {boolean}
|
|
7
9
|
*/
|
|
8
10
|
export function eq(a_nowrap) {
|
|
@@ -16,8 +18,8 @@ export function eq(a_nowrap) {
|
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* Returns function that returns `==` operator to all values in `in_value_aS`.
|
|
19
|
-
* @param {
|
|
20
|
-
* @returns {
|
|
21
|
+
* @param {a_nowrap_T}a_nowrap
|
|
22
|
+
* @returns {eq_fn_T}
|
|
21
23
|
*/
|
|
22
24
|
export function eq_(a_nowrap) {
|
|
23
25
|
return (value)=>eq(wrap_concat(a_nowrap, value))
|
package/all/eql_fn_a/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="../error_o/index.d.ts" />
|
|
2
|
+
/// <reference types="../error__print/index.d.ts" />
|
|
3
|
+
/** @typedef {argument__error_o_T} */
|
|
2
4
|
/**
|
|
3
5
|
* Prints the given `error_o_error` to stderr
|
|
4
6
|
* @param {error_o_error_T}error_o_error
|
|
5
|
-
* @type {typeof
|
|
7
|
+
* @type {typeof error__print}
|
|
6
8
|
*/
|
|
7
9
|
export function error__print(error_o_error) {
|
|
8
10
|
const {
|
package/all/error_o/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/// <reference types="../error_o/index.d.ts" />
|
|
2
|
+
/// <reference types="./index.d.ts" />
|
|
1
3
|
import { assign } from '../assign/index.js'
|
|
2
|
-
/** @typedef {
|
|
3
|
-
/** @typedef {
|
|
4
|
+
/** @typedef {argument__error_o_T} */
|
|
5
|
+
/** @typedef {error_o_error_T} */
|
|
4
6
|
/**
|
|
5
7
|
* argument__error_o_T factory function
|
|
6
8
|
* @param {string}[message]
|
package/all/falsy__none/index.js
CHANGED
package/all/fetch/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="../fetch__template_pair/index.d.ts" />
|
|
1
2
|
import { response_pair__new } from '../response_pair/index.js'
|
|
2
|
-
/** @typedef {
|
|
3
|
+
/** @typedef {fetch__template_pair_T} */
|
|
3
4
|
/**
|
|
4
5
|
* @param {(...arg_a:any[])=>Promise<Response>}fetch_fn
|
|
5
6
|
* @param {(val:unknown)=>unknown}[hydrate]
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
/// <reference types="../fetch/index.d.ts" />
|
|
2
|
+
/// <reference types="../fetch__template_pair/index.d.ts" />
|
|
1
3
|
import { response_pair__new } from '../response_pair/index.js'
|
|
2
|
-
/** @typedef {
|
|
4
|
+
/** @typedef {fetch_T} */
|
|
3
5
|
/**
|
|
4
6
|
* @param {fetch_T}fetch
|
|
5
|
-
* @returns {typeof
|
|
7
|
+
* @returns {typeof fetch_response_pair__new}
|
|
6
8
|
*/
|
|
7
9
|
export function fetch_response_pair__new2(fetch) {
|
|
8
10
|
return async (input, init)=>{
|
package/all/filter/index.js
CHANGED
package/all/filter_o/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
/// <reference types="../filter_o/index.d.ts" />
|
|
1
2
|
import { I__ } from '../combinators/index.js'
|
|
2
3
|
/**
|
|
3
4
|
* Returns a filter_h1 with the values filtered by `fn`.
|
|
4
5
|
* @param {object}o
|
|
5
6
|
* @param {(val:any, key:string, h1:object)=>any}fn
|
|
6
|
-
* @returns {
|
|
7
|
+
* @returns {filter_o_T|undefined}
|
|
7
8
|
*/
|
|
8
9
|
export function filter_o_(
|
|
9
10
|
o,
|
|
@@ -27,7 +28,7 @@ export {
|
|
|
27
28
|
* Returns a filter_h where the value is a
|
|
28
29
|
* boolean of whether the array has items present
|
|
29
30
|
* @param {(val:any, key:string, l0_r:object)=>any}fn
|
|
30
|
-
* @returns {(l1_r:object|undefined)=>(
|
|
31
|
+
* @returns {(l1_r:object|undefined)=>(filter_o_T|undefined)}
|
|
31
32
|
*/
|
|
32
33
|
export function filter_o__(fn = I__) {
|
|
33
34
|
return (l1_r)=>filter_o_(l1_r, fn)
|
package/all/find/index.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { param_dfn_split_regex } from '../param_dfn_split_regex/index.js'
|
|
2
|
+
/**
|
|
3
|
+
* @param {string}param_dfn
|
|
4
|
+
* @returns {string[]}
|
|
5
|
+
*/
|
|
6
|
+
export function flag_a_(param_dfn) {
|
|
7
|
+
return param_dfn.split(param_dfn_split_regex)
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
flag_a_ as flag_a1_fn,
|
|
11
|
+
flag_a_ as _flag_a1,
|
|
12
|
+
flag_a_ as _a1__flag,
|
|
13
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { flag_regex } from '../flag_regex/index.js'
|
|
2
|
+
/**
|
|
3
|
+
* @param {string[]}arg_a
|
|
4
|
+
* @returns {Record<string, string>}
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
export function flag_r_(arg_a) {
|
|
8
|
+
const flag_R = {}
|
|
9
|
+
let i = 0
|
|
10
|
+
while (i < arg_a.length) {
|
|
11
|
+
const flag = arg_a[i]
|
|
12
|
+
const match = flag_regex.test(flag)
|
|
13
|
+
let j = i + 1
|
|
14
|
+
if (match) {
|
|
15
|
+
while (j < arg_a.length && !flag_regex.test(arg_a[j])) {
|
|
16
|
+
const value = arg_a[j]
|
|
17
|
+
if (flag_R[flag]) {
|
|
18
|
+
flag_R[flag] += ` ${value}`
|
|
19
|
+
} else {
|
|
20
|
+
flag_R[flag] = value
|
|
21
|
+
}
|
|
22
|
+
j += 1
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (!(flag in flag_R)) delete flag_R[flag]
|
|
26
|
+
i = j
|
|
27
|
+
}
|
|
28
|
+
return flag_R
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
flag_r_ as flag_h_,
|
|
32
|
+
flag_r_ as _flag_h,
|
|
33
|
+
flag_r_ as _h__flag,
|
|
34
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { param_dfn_T } from '../param_dfn/index.js'
|
|
2
|
+
export declare function flag_r__pick(
|
|
3
|
+
arg_a:string[],
|
|
4
|
+
...param_dfn_a:param_dfn_T[]
|
|
5
|
+
):Record<string, string>
|
|
6
|
+
export {
|
|
7
|
+
flag_r__pick as flag_R__pick,
|
|
8
|
+
flag_r__pick as pick_flag_r_,
|
|
9
|
+
flag_r__pick as pick_flag_h_,
|
|
10
|
+
flag_r__pick as _pick_flag_h,
|
|
11
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="../types/index.d.ts" />
|
|
2
|
+
import { dfn_flag_r_ } from '../dfn_flag_r/index.js'
|
|
3
|
+
import { each } from '../each/index.js'
|
|
4
|
+
import { flag_r_ } from '../flag_r/index.js'
|
|
5
|
+
import { keys } from '../keys/index.js'
|
|
6
|
+
/**
|
|
7
|
+
* @param {string[]}arg_a
|
|
8
|
+
* @param {param_dfn_T}param_dfn_a
|
|
9
|
+
* @returns {Record<string, string>}
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export function flag_r__pick(
|
|
13
|
+
arg_a,
|
|
14
|
+
...param_dfn_a
|
|
15
|
+
) {
|
|
16
|
+
const dfn_flag_h = dfn_flag_r_(param_dfn_a)
|
|
17
|
+
const flag_h = flag_r_(arg_a)
|
|
18
|
+
const pick_flag_a = []
|
|
19
|
+
each(keys(flag_h), (flag)=>{
|
|
20
|
+
if (flag in dfn_flag_h) {
|
|
21
|
+
pick_flag_a.push(flag)
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
return pick(flag_h, ...pick_flag_a)
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
flag_r__pick as flag_R__pick,
|
|
28
|
+
flag_r__pick as pick_flag_r_,
|
|
29
|
+
flag_r__pick as pick_flag_h_,
|
|
30
|
+
flag_r__pick as _pick_flag_h,
|
|
31
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { keys } from '../keys/index.js'
|
|
2
|
+
import { reduce } from '../reduce/index.js'
|
|
3
|
+
/**
|
|
4
|
+
* @param {Record<string, unknown>}flag_R
|
|
5
|
+
* @param {string[]}arg_a
|
|
6
|
+
* @returns {string|unknown}
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export function flag_r_arg_a_(
|
|
10
|
+
flag_R,
|
|
11
|
+
arg_a
|
|
12
|
+
) {
|
|
13
|
+
return reduce(keys(flag_R), (memo, flag)=>{
|
|
14
|
+
memo.push(flag)
|
|
15
|
+
const _value = flag_R[flag]
|
|
16
|
+
const value = typeof _value === 'function' ? _value(arg_a) : _value
|
|
17
|
+
if (value != null) {
|
|
18
|
+
memo.push(...[].concat(value))
|
|
19
|
+
}
|
|
20
|
+
return memo
|
|
21
|
+
}, [])
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
flag_r_arg_a_ as flag_R_arg_a_,
|
|
25
|
+
flag_r_arg_a_ as flag_h_arg_a_,
|
|
26
|
+
flag_r_arg_a_ as _flag_h_arg_a1,
|
|
27
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function flag_r_param_name_(
|
|
2
|
+
param_dfn_r_param_name?:param_name_r_param_dfn_T
|
|
3
|
+
):Record<string, string>
|
|
4
|
+
export {
|
|
5
|
+
flag_r_param_name_ as flag_R_param_name_,
|
|
6
|
+
flag_r_param_name_ as flag_h_param_name_,
|
|
7
|
+
flag_r_param_name_ as _flag_h_param_name,
|
|
8
|
+
}
|
|
9
|
+
export type param_name_r_param_dfn_T = Record<string, string>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="../types/index.d.ts" />
|
|
2
|
+
import { each } from '../each/index.js'
|
|
3
|
+
import { flag_a_ } from '../flag_a/index.js'
|
|
4
|
+
/**
|
|
5
|
+
* @param {param_name_r_param_dfn_T}param_dfn_r_param_name
|
|
6
|
+
* @returns {Record<string, string>}
|
|
7
|
+
*/
|
|
8
|
+
export function flag_r_param_name_(
|
|
9
|
+
param_dfn_r_param_name
|
|
10
|
+
) {
|
|
11
|
+
const flag_R_param_name = {}
|
|
12
|
+
for (let param_name in param_dfn_r_param_name) {
|
|
13
|
+
const param_dfn = param_dfn_r_param_name[param_name]
|
|
14
|
+
const flag_a = flag_a_(param_dfn)
|
|
15
|
+
each(flag_a, flag=>
|
|
16
|
+
flag_R_param_name[flag] = param_name)
|
|
17
|
+
}
|
|
18
|
+
return flag_R_param_name
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
flag_r_param_name_ as flag_R_param_name_,
|
|
22
|
+
flag_r_param_name_ as flag_h_param_name_,
|
|
23
|
+
flag_r_param_name_ as _flag_h_param_name,
|
|
24
|
+
}
|