import { Merge } from "../types/index.js"; //#region src/object/index.d.ts /** * @license MIT * @author kazuya kawaguchi (a.k.a. kazupon) */ /** * check if a value is an object * * @param value - a value to check * @returns whether the value is an object * * @example * ```ts * import { isObject } from '@kazupon/jts-utils' * * const result1 = isObject({}); // true * const result2 = isObject(null); // false * const result3 = isObject(42); // false * ``` */ declare const isObject: (value: unknown) => value is object; /** * check if a value is a plain object * * @param value - a value to check * @returns whether the value is a plain object * * @example * ```ts * import { isPlainObject } from '@kazupon/jts-utils' * * const result1 = isPlainObject({}); // true * const result2 = isPlainObject(null); // false * const result3 = isPlainObject([]); // false * const result4 = isPlainObject(() => {}); // false */ declare const isPlainObject: (value: unknown) => value is Record; /** * get the type string of a value * * @param value - target value * @returns type string with `[object ${type}]` * * @example * ```ts * import { toTypeString } from '@kazupon/jts-utils' * * const result1 = toTypeString({}); // "[object Object]" * const result2 = toTypeString([]); // "[object Array]" * const result4 = toTypeString(42); // "[object Number]" * ``` */ declare const toTypeString: (value: unknown) => string; /** * get the raw type of a value * * @param value - target value * @returns extract "RawType" from strings like "[object RawType]" * * @example * ```ts * import { toRawType } from '@kazupon/jts-utils' * * const result1 = toRawType({}); // "Object" * const result2 = toRawType([]); // "Array" * const result3 = toRawType(42); // "Number" * ``` */ declare const toRawType: (value: unknown) => string; /** * create a new object * * @param object - prototype object, default is null * @returns a new object * * @example * ```ts * import { create } from '@kazupon/jts-utils' * * const obj1 = create() // {} * const proto = { a: 1 } * const obj2 = create(proto) // inherits prototype * ``` */ declare const create: )>(object?: T | null) => R; /** * check if an object has a property * * @param target - a target object * @param key - property key of the object * @returns whether the object has the property * * @example * ```ts * import { hasOwn } from '@kazupon/jts-utils' * * const obj = { a: 1 } * const result1 = hasOwn(obj, 'a') // true * const result2 = hasOwn(obj, 'b') // false * ``` */ declare function hasOwn(target: object | Array, key: string | number | symbol): boolean; /** * get own property value of an object * * @param target - a target object * @param key - property key of the object * @returns the property value, if the object has the property, otherwise undefined * * @example * ```ts * import { getOwn } from '@kazupon/jts-utils' * * const obj = { a: 1 } * const result1 = getOwn(obj, 'a') // 1 * const result2 = getOwn(obj, 'b') // undefined * ``` */ declare function getOwn(target: T, key: K): T[K] | undefined; //#endregion export { create, getOwn, hasOwn, isObject, isPlainObject, toRawType, toTypeString };