Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/uploads/../uploads/../../../../instantly.picotech.app/homes/../../wa.picotech.app/public_html/node_modules/escape-html/../././form-data/../has-proto/../node-cache/.././methods/../@thi.ng/errors
الملفات الموجودة في هذا الـ Path:
.
..
CHANGELOG.md
LICENSE
README.md
assert.d.ts
assert.js
deferror.d.ts
deferror.js
ensure.d.ts
ensure.js
illegal-arguments.d.ts
illegal-arguments.js
illegal-arity.d.ts
illegal-arity.js
illegal-state.d.ts
illegal-state.js
index.d.ts
index.js
io.d.ts
io.js
out-of-bounds.d.ts
out-of-bounds.js
package.json
unsupported.d.ts
unsupported.js

مشاهدة ملف: ensure.d.ts

/**
 * Higher-order function to define ensurance assertions. Takes a `pred`icate
 * function and an `expected` (type) name, returns a new function which accepts
 * 2 args (an arbitrary value `x` and optional error `msg`). When called, checks
 * `x` for non-null and if so applies given `pred`icate. If result is false (or
 * `x` is nullish) and iff {@link assert} is enabled, throws a
 * {@link AssertionError} with given `msg` (or a constructed default msg).
 * Otherwise function is a no-op.
 *
 * @param pred
 * @param expected
 */
export declare const defEnsure: <T>(pred: (x: any) => boolean, expected: string) => (x: any, msg?: string) => T;
/**
 * Only enabled if {@link assert} is enabled (otherwise no-op). Checks if `x` is
 * a JS array and if not throws {@link AssertionError}, optionally with given
 * `msg`.
 *
 * @remarks
 * See {@link defEnsure} for details.
 *
 * @param x
 * @param msg
 */
export declare const ensureArray: (x: any, msg?: string) => any[];
/**
 * Only enabled if {@link assert} is enabled (otherwise no-op). Checks if `x` is
 * a bigint and if not throws {@link AssertionError}, optionally with given
 * `msg`.
 *
 * @remarks
 * See {@link defEnsure} for details.
 *
 * @param x
 * @param msg
 */
export declare const ensureBigInt: (x: any, msg?: string) => bigint;
/**
 * Only enabled if {@link assert} is enabled (otherwise no-op). Checks if `x` is
 * a boolean and if not throws {@link AssertionError}, optionally with given
 * `msg`.
 *
 * @remarks
 * See {@link defEnsure} for details.
 *
 * @param x
 * @param msg
 */
export declare const ensureBoolean: (x: any, msg?: string) => boolean;
/**
 * Only enabled if {@link assert} is enabled (otherwise no-op). Checks if `x` is
 * a function and if not throws {@link AssertionError}, optionally with given
 * `msg`.
 *
 * @remarks
 * See {@link defEnsure} for details.
 *
 * @param x
 * @param msg
 */
export declare const ensureFunction: (x: any, msg?: string) => Function;
/**
 * Only enabled if {@link assert} is enabled (otherwise no-op). Checks if `x` is
 * an ES6 iterable and if not throws {@link AssertionError}, optionally with
 * given `msg`.
 *
 * @remarks
 * See {@link defEnsure} for details.
 *
 * @param x
 * @param msg
 */
export declare const ensureIterable: (x: any, msg?: string) => Iterable<any>;
/**
 * Only enabled if {@link assert} is enabled (otherwise no-op). Checks if `x` is
 * a number and if not throws {@link AssertionError}, optionally with given
 * `msg`.
 *
 * @remarks
 * See {@link defEnsure} for details.
 *
 * @param x
 * @param msg
 */
export declare const ensureNumber: (x: any, msg?: string) => number;
/**
 * Only enabled if {@link assert} is enabled (otherwise no-op). Checks if `x` is
 * a string and if not throws {@link AssertionError}, optionally with given
 * `msg`.
 *
 * @remarks
 * See {@link defEnsure} for details.
 *
 * @param x
 * @param msg
 */
export declare const ensureString: (x: any, msg?: string) => string;
/**
 * Only enabled if {@link assert} is enabled (otherwise no-op). Checks if `x` is
 * a symbol and if not throws {@link AssertionError}, optionally with given
 * `msg`.
 *
 * @remarks
 * See {@link defEnsure} for details.
 *
 * @param x
 * @param msg
 */
export declare const ensureSymbol: (x: any, msg?: string) => symbol;
//# sourceMappingURL=ensure.d.ts.map