UNPKG

remeda

Version:

A utility library for JavaScript and Typescript.

1 lines 684 B
{"version":3,"file":"isDefined.cjs","names":[],"sources":["../src/isDefined.ts"],"sourcesContent":["/**\n * A function that checks if the passed parameter is defined (`!== undefined`)\n * and narrows its type accordingly.\n *\n * @param data - The variable to check.\n * @returns True if the passed input is defined, false otherwise.\n * @signature\n * R.isDefined(data)\n * @example\n * R.isDefined('string') //=> true\n * R.isDefined(null) //=> true\n * R.isDefined(undefined) //=> false\n * @category Guard\n */\nexport function isDefined<T>(data: T | undefined): data is T {\n return data !== undefined;\n}\n"],"mappings":"AAcA,SAAgB,EAAa,EAAgC,CAC3D,OAAO,IAAS,IAAA"}