@blake.regalia/belt
Advanced tools
Comparing version 0.48.3 to 0.48.4
@@ -83,2 +83,10 @@ import type { NoInfer } from 'ts-toolbelt/out/Function/NoInfer'; | ||
/** | ||
* Takes the given value, applies it as the sole argument to the given callback, and | ||
* returns the callback's return value if it is not falsy, otherweise returns undefined. | ||
* @param w_what - value to apply | ||
* @param f_apply - callback to call | ||
* @returns | ||
*/ | ||
export declare const keep: <w_what>(w_value: w_what, f_callback: (w_arg: w_what) => any) => w_what | undefined; | ||
/** | ||
* Equivalent to testing `'undefined' === typeof thing` | ||
@@ -85,0 +93,0 @@ */ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.filter_object = exports.odem = exports.map_entries = exports.ofe = exports.from_entries = exports.ode = exports.entries = exports.odv = exports.values = exports.odk = exports.keys = exports.oda = exports.assign = exports.odc = exports.create = exports.each = exports.array = exports.is_nan = exports.is_safe_integer = exports.is_integer = exports.is_finite = exports.is_error = exports.is_iterable = exports.is_dict_es = exports.is_dict = exports.is_array = exports.is_bytes = exports.is_function = exports.is_object = exports.is_symbol = exports.is_string = exports.is_bigint = exports.is_number = exports.is_boolean = exports.is_undefined = exports.narrow = exports.cast = exports.F_NXOR = exports.F_NOR = exports.F_NAND = exports.F_XOR = exports.F_OR = exports.F_AND = exports.F_IDENTITY = exports.F_NOOP = exports.XG_32 = exports.XG_16 = exports.XG_8 = exports.__UNDEFINED = exports.ATU8_NIL = void 0; | ||
exports.call_with = exports.try_async = exports.try_sync = exports.die = exports.normalize = exports.product = exports.sum = exports.remove = exports.shuffle = exports.random_int = exports.deduplicate = exports.interjoin = exports.collapse = exports.fold = exports.fodemtv = exports.transform_values = exports.oderom = exports.transform_object = exports.oderaf = exports.flatten_entries = exports.oderac = exports.concat_entries = exports.oder = exports.reduce_object = void 0; | ||
exports.odem = exports.map_entries = exports.ofe = exports.from_entries = exports.ode = exports.entries = exports.odv = exports.values = exports.odk = exports.keys = exports.oda = exports.assign = exports.odc = exports.create = exports.each = exports.array = exports.is_nan = exports.is_safe_integer = exports.is_integer = exports.is_finite = exports.is_error = exports.is_iterable = exports.is_dict_es = exports.is_dict = exports.is_array = exports.is_bytes = exports.is_function = exports.is_object = exports.is_symbol = exports.is_string = exports.is_bigint = exports.is_number = exports.is_boolean = exports.is_undefined = exports.keep = exports.narrow = exports.cast = exports.F_NXOR = exports.F_NOR = exports.F_NAND = exports.F_XOR = exports.F_OR = exports.F_AND = exports.F_IDENTITY = exports.F_NOOP = exports.XG_32 = exports.XG_16 = exports.XG_8 = exports.__UNDEFINED = exports.ATU8_NIL = void 0; | ||
exports.call_with = exports.try_async = exports.try_sync = exports.die = exports.normalize = exports.product = exports.sum = exports.remove = exports.shuffle = exports.random_int = exports.deduplicate = exports.interjoin = exports.collapse = exports.fold = exports.fodemtv = exports.transform_values = exports.oderom = exports.transform_object = exports.oderaf = exports.flatten_entries = exports.oderac = exports.concat_entries = exports.oder = exports.reduce_object = exports.filter_object = void 0; | ||
/** | ||
@@ -98,2 +98,11 @@ * Utility nil buffer constant | ||
/** | ||
* Takes the given value, applies it as the sole argument to the given callback, and | ||
* returns the callback's return value if it is not falsy, otherweise returns undefined. | ||
* @param w_what - value to apply | ||
* @param f_apply - callback to call | ||
* @returns | ||
*/ | ||
const keep = (w_value, f_callback) => f_callback(w_value) ? w_value : exports.__UNDEFINED; | ||
exports.keep = keep; | ||
/** | ||
* Equivalent to testing `'undefined' === typeof thing` | ||
@@ -100,0 +109,0 @@ */ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Debouncer = void 0; | ||
const async_1 = require("./async"); | ||
const belt_1 = require("./belt"); | ||
const async_js_1 = require("./async.js"); | ||
const belt_js_1 = require("./belt.js"); | ||
const G_PROTOTYPE = { | ||
@@ -16,5 +16,5 @@ // private termination function | ||
// clear timeouts | ||
clearTimeout(k_this.S = belt_1.__UNDEFINED); | ||
clearTimeout(k_this.D = belt_1.__UNDEFINED); | ||
clearTimeout(k_this.I = belt_1.__UNDEFINED); | ||
clearTimeout(k_this.S = belt_js_1.__UNDEFINED); | ||
clearTimeout(k_this.D = belt_js_1.__UNDEFINED); | ||
clearTimeout(k_this.I = belt_js_1.__UNDEFINED); | ||
// execution wasn't cancelled | ||
@@ -30,3 +30,3 @@ if (!xc_cancel) { | ||
// set a timeout to execute once the idle passes | ||
if ((0, belt_1.is_finite)(k_this.i)) | ||
if ((0, belt_js_1.is_finite)(k_this.i)) | ||
k_this.I = setTimeout(() => k_this.t(), k_this.i); | ||
@@ -57,6 +57,6 @@ }, | ||
if (!c_calls) | ||
if ((0, belt_1.is_finite)(k_this.s)) | ||
if ((0, belt_js_1.is_finite)(k_this.s)) | ||
k_this.S = setTimeout(f_t, k_this.s); | ||
// set a timeout to execute once the delay passes | ||
if ((0, belt_1.is_finite)(k_this.d)) | ||
if ((0, belt_js_1.is_finite)(k_this.d)) | ||
k_this.D = setTimeout(f_t, k_this.d); | ||
@@ -75,3 +75,3 @@ } | ||
// creates a deferred Promise | ||
const [dp_cleared, f_cleared] = (0, async_1.defer)(); | ||
const [dp_cleared, f_cleared] = (0, async_js_1.defer)(); | ||
// adds resolver to list | ||
@@ -100,3 +100,3 @@ this.r.push(f_cleared); | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
const Debouncer = (f_exec, xt_span, xt_delay = Infinity, xt_idle = Infinity, n_calls = Infinity) => (0, belt_1.assign)((0, belt_1.create)(G_PROTOTYPE), { | ||
const Debouncer = (f_exec, xt_span, xt_delay = Infinity, xt_idle = Infinity, n_calls = Infinity) => (0, belt_js_1.assign)((0, belt_js_1.create)(G_PROTOTYPE), { | ||
// execution callback | ||
@@ -103,0 +103,0 @@ f: f_exec, |
@@ -83,2 +83,10 @@ import type { NoInfer } from 'ts-toolbelt/out/Function/NoInfer'; | ||
/** | ||
* Takes the given value, applies it as the sole argument to the given callback, and | ||
* returns the callback's return value if it is not falsy, otherweise returns undefined. | ||
* @param w_what - value to apply | ||
* @param f_apply - callback to call | ||
* @returns | ||
*/ | ||
export declare const keep: <w_what>(w_value: w_what, f_callback: (w_arg: w_what) => any) => w_what | undefined; | ||
/** | ||
* Equivalent to testing `'undefined' === typeof thing` | ||
@@ -85,0 +93,0 @@ */ |
@@ -85,2 +85,10 @@ /** | ||
/** | ||
* Takes the given value, applies it as the sole argument to the given callback, and | ||
* returns the callback's return value if it is not falsy, otherweise returns undefined. | ||
* @param w_what - value to apply | ||
* @param f_apply - callback to call | ||
* @returns | ||
*/ | ||
export const keep = (w_value, f_callback) => f_callback(w_value) ? w_value : __UNDEFINED; | ||
/** | ||
* Equivalent to testing `'undefined' === typeof thing` | ||
@@ -87,0 +95,0 @@ */ |
@@ -1,3 +0,3 @@ | ||
import { defer } from './async'; | ||
import { __UNDEFINED, assign, create, is_finite } from './belt'; | ||
import { defer } from './async.js'; | ||
import { __UNDEFINED, assign, create, is_finite } from './belt.js'; | ||
const G_PROTOTYPE = { | ||
@@ -4,0 +4,0 @@ // private termination function |
{ | ||
"name": "@blake.regalia/belt", | ||
"version": "0.48.3", | ||
"version": "0.48.4", | ||
"repository": "github:blake-regalia/belt", | ||
@@ -5,0 +5,0 @@ "license": "ISC", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
383728
7290