@monstermann/fn
Version:
A utility library for TypeScript.
28 lines (26 loc) • 596 B
JavaScript
import { dfdlT } from "@monstermann/dfdl";
//#region src/number/isBigInt.ts
/**
* `isBigInt(target)`
*
* Returns `true` if `target` is a bigint, otherwise `false`. This function acts as a type guard.
*
* ```ts
* isBigInt(123n); // true
* isBigInt(123); // false
* isBigInt("123"); // false
* isBigInt(null); // false
* ```
*
* ```ts
* pipe(123n, isBigInt()); // true
* pipe(123, isBigInt()); // false
* pipe("123", isBigInt()); // false
* pipe(null, isBigInt()); // false
* ```
*/
const isBigInt = dfdlT((target) => {
return typeof target === "bigint";
}, 1);
//#endregion
export { isBigInt };