@naturalcycles/nodejs-lib
Version:
Standard library for Node.js
32 lines (31 loc) • 1.03 kB
TypeScript
import type { Options } from 'ajv/dist/2020.js';
import { Ajv2020 } from 'ajv/dist/2020.js';
/**
* Return cached instance of Ajv with default (recommended) options.
*
* This function should be used as much as possible,
* to benefit from cached Ajv instance.
*/
export declare const getAjv: any;
/**
* Returns cached instance of Ajv, which is non-mutating.
*
* To be used in places where we only need to know if an item is valid or not,
* and are not interested in transforming the data.
*/
export declare const getNonMutatingAjv: any;
/**
* Returns cached instance of Ajv, which is coercing data.
*
* To be used in places where we know that we are going to receive data with the wrong type,
* typically: request path params and request query params.
*/
export declare const getCoercingAjv: any;
/**
* Create Ajv with modified defaults.
*
* !!! Please note that this function is EXPENSIVE computationally !!!
*
* https://ajv.js.org/options.html
*/
export declare function createAjv(opt?: Options): Ajv2020;