From 6977a30382480304b6323bd5f38198472a16ed2c Mon Sep 17 00:00:00 2001 From: mesqueeb Date: Wed, 31 May 2023 10:17:11 +0900 Subject: [PATCH] feat: add JSDocs --- src/index.ts | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/src/index.ts b/src/index.ts index d2044e1..60e297d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -359,21 +359,65 @@ export function isPrimitive( */ export const isNullOrUndefined = isOneOf(isNull, isUndefined) +/** + * A factory function that creates a function to check if the payload is one of the given types. + * @example + * import { isOneOf, isNull, isUndefined } from 'is-what' + * + * const isNullOrUndefined = isOneOf(isNull, isUndefined) + * + * isNullOrUndefined(null) // true + * isNullOrUndefined(undefined) // true + * isNullOrUndefined(123) // false + */ export function isOneOf( a: TypeGuard, b: TypeGuard ): TypeGuard +/** + * A factory function that creates a function to check if the payload is one of the given types. + * @example + * import { isOneOf, isNull, isUndefined } from 'is-what' + * + * const isNullOrUndefined = isOneOf(isNull, isUndefined) + * + * isNullOrUndefined(null) // true + * isNullOrUndefined(undefined) // true + * isNullOrUndefined(123) // false + */ export function isOneOf( a: TypeGuard, b: TypeGuard, c: TypeGuard ): TypeGuard +/** + * A factory function that creates a function to check if the payload is one of the given types. + * @example + * import { isOneOf, isNull, isUndefined } from 'is-what' + * + * const isNullOrUndefined = isOneOf(isNull, isUndefined) + * + * isNullOrUndefined(null) // true + * isNullOrUndefined(undefined) // true + * isNullOrUndefined(123) // false + */ export function isOneOf( a: TypeGuard, b: TypeGuard, c: TypeGuard, d: TypeGuard ): TypeGuard +/** + * A factory function that creates a function to check if the payload is one of the given types. + * @example + * import { isOneOf, isNull, isUndefined } from 'is-what' + * + * const isNullOrUndefined = isOneOf(isNull, isUndefined) + * + * isNullOrUndefined(null) // true + * isNullOrUndefined(undefined) // true + * isNullOrUndefined(123) // false + */ export function isOneOf( a: TypeGuard, b: TypeGuard, @@ -381,6 +425,17 @@ export function isOneOf, e: TypeGuard ): TypeGuard +/** + * A factory function that creates a function to check if the payload is one of the given types. + * @example + * import { isOneOf, isNull, isUndefined } from 'is-what' + * + * const isNullOrUndefined = isOneOf(isNull, isUndefined) + * + * isNullOrUndefined(null) // true + * isNullOrUndefined(undefined) // true + * isNullOrUndefined(123) // false + */ export function isOneOf( a: AnyFunction, b: AnyFunction,