@monstermann/fn
Version:
A utility library for TypeScript.
27 lines (25 loc) • 606 B
TypeScript
import { Primitive } from "type-fest";
//#region src/function/isPrimitive.d.ts
/**
* `isPrimitive(value)`
*
* Checks if a value is a primitive type (string, number, boolean, null, undefined, symbol, bigint).
*
* ```ts
* isPrimitive("hello"); // true
* isPrimitive(42); // true
* isPrimitive({}); // false
* isPrimitive([]); // false
* ```
*
* ```ts
* pipe("hello", isPrimitive()); // true
* pipe({}, isPrimitive()); // false
* ```
*/
declare const isPrimitive: {
(): (value: unknown) => value is Primitive;
(value: unknown): value is Primitive;
};
//#endregion
export { isPrimitive };