INNER CODE UNIT · TypeScript

isPrimitive

OS-Guild/graphql-to-mongodb · src/common.ts:140

export function isPrimitive(value: any): boolean {
    const type = typeof value;
    return (type === "boolean"
        || type === "number"
        || type === "string"
        || type === "undefined"
        || (type === "object" && (value === null || isValidDate(value))));
}

function isValidDate(date): boolean {
    return date && Object.prototype.toString.call(date) === "[object Date]" && !isNaN(date);
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…