Function isPOJO

  • This is named isPOJO ("Plain Old JavaScript Object) rather than isObject to emphasize that it does not test for anything that broadly derives from the Object type. It is instead intended to exclude arrays, null, and other entities not of the "curly brace" type.

    Example

    import * as G from "flurp/guard";

    G.isPOJO({x: 3}); // true
    G.isPOJO({}); // true
    G.isPOJO([]); // false
    G.isPOJO(null); // false
    G.isPOJO(undefined); // false
    G.isPOJO(Number(5)); // false

    Parameters

    • x: unknown

    Returns x is Readonly<Record<string, unknown>>