UNPKG

@nacelle/compatibility-connector

Version:

Connect @nacelle/client-js-sdk to Nacelle's v2 back end with minimal code changes

15 lines (14 loc) 735 B
/** * Sanitize integers from user inputs. If the `input` is: * - not an integer, * - below an optional `minimum` value, or * - above an optional `maximum` value * * , we fall back to a `defaultValue`. * @param input could be anything...hopefully a valid integer 🤞 * @param defaultValue the value that should be used if `input` is not an integer, less than the `minimum`, or more than the `maximum` * @param minimum the minimum allowed value of `input` * @param maximum the maximum allowed value of `input` * @returns an integer within the `minimum`-`maximum` bounds, or the `defaultValue` */ export declare function sanitizeIntegerValue(input: unknown, defaultValue: number, minimum?: number, maximum?: number): number;