UNPKG

n2words

Version:

Convert numbers to words in 70+ languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.

18 lines (17 loc) 1.16 kB
/** * Apply a form's option defaults and reject anything it doesn't declare. * * The exported defaults map (e.g. `cardinalDefaults`) is the single source of * truth for each option's default value — the form never restates it, and the * docs generator imports it rather than scraping the body. A malformed options * argument (unknown key, wrong-typed value, inherited key) throws `TypeError`; * a known option with a value outside its declared allowed set (an exported * `<form>Values` map, e.g. gender) throws `RangeError` — right kind of value, * out of range — instead of silently falling back to the default. * @template {object} T * @param {T | undefined} options - Caller-provided options, or undefined * @param {Required<T>} defaults - The form's default for every option * @param {Partial<Record<keyof T & string, readonly unknown[]>>} [values] - Allowed set per enum-valued option * @returns {Required<T>} The options with every default applied */ export declare function resolveOptions<T extends object>(options: T | undefined, defaults: Required<T>, values?: Partial<Record<keyof T & string, readonly unknown[]>>): Required<T>;