UNPKG

@storm-stack/types

Version:

⚡ The storm-stack monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.

51 lines (50 loc) 1.16 kB
import { PlainObject } from "../utility-types/base"; /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @example * ```typescript * isObjectLike({}) * // => true * * isObjectLike([1, 2, 3]) * // => true * * isObjectLike(Function) * // => false * * isObjectLike(null) * // => false * ``` * * @param value - The value to check. * @returns Returns `true` if `value` is object-like, else `false`. */ export declare const isObjectLike: (obj: unknown) => obj is object; /** * Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`. * * @example * ```typescript * function Foo() { * this.a = 1 * } * * isPlainObject(new Foo) * // => false * * isPlainObject([1, 2, 3]) * // => false * * isPlainObject({ 'x': 0, 'y': 0 }) * // => true * * isPlainObject(Object.create(null)) * // => true * ``` * * @param obj - The value to check. * @returns Returns `true` if `obj` is a plain object, else `false`. */ export declare const isPlainObject: (obj: unknown) => obj is PlainObject;