import { MapItems } from "../collection/Collection"; export interface Props { [key: string]: V; } /** * Defines to return boolean or void in the callback * @export * @interface ForEachCallback * ForEach Callback interface */ export declare type ForEachCallback = (item: any, key?: string, obj?: Props) => boolean | void; /** * Defines to return value in the callback * @export * @interface MapCallback * Map Callback interface */ export declare type MapCallback = (item: any, key?: string, obj?: Props) => any; /** * A class which provides some operations on Object {@see ObjectProps} * @export * @static * @class Objects */ export default class Objects { /** * * Checks the given Object (is exist or not) or (the given key is exist or not} * @public * @static * @param src {T} * @param key? {string} * @return {boolean} */ static has(src: T, key?: string): boolean; /** * Gets length of the given object keys * @public * @static * @param src * @returns {number} */ static getLength(src: T): number; /** * Removes value by the given key from the given object * @public * @static * @param src {T} * @param key {any} * @return {T} */ static remove(src: T, key: any): T; /** * Removes value from the given object * @public * @static * @param src {T} * @param value {any} * @return {T} */ static removeValue(src: T, value: any): T; /** * Provdes to navigate in the given Object and create an array from the result of the callback function. * if the result of the callback is empty then ignores it. * @public * @static * @param {MapItems} map * @param {(value: T, key: K) => U} callback * @returns {Array} */ static map(map: MapItems, callback: (value: T, key: K) => U): U[]; /** * Provides to navigate in the given Object and can broken if return false from callback function. * @public * @static * @param {MapItems} map * @param {(value: T, key: K) => (void | boolean)} callback * @returns {boolean} */ static forEach(map: MapItems, callback: (value: T, key: K) => void | boolean): boolean; /** * Gets keys of the given object as string[]. * @public * @static * @param src {T} * @returns {string[]} */ static keys(src: T): string[]; /** * Gets values of the given object as any[]. * @public * @static * @param src {T} * @returns {any[]} */ static values(src: T): any[]; /** * Adds value by key or keys to the given source Object * @public * @static * @param src {T} * @param key {string} * @param value {any} * @param keys? {string[]} * @return {T} */ static addValue(src: T, key: string, value: any, keys?: string[]): T; /** * Gets value by the given key or keys from the given source object * @public * @static * @param src {T} * @param key {string} * @param keys? {string[]} * @returns {T} */ static getValue(src: T, key: string, keys?: string[]): U; /** * Clones the given source object * @public * @static * @param src {T} * @param ignoreList? {string[]} * @return {T} */ static clone(src: T, ignoreList?: string[]): T; /** * Merges the given source object and destination object by ignoreList. * @public * @static * @param src {S} * @param dest {D} * @param ignoreList? {string[]} specifies get clone of the element by type or not clones just return its. * @returns {any} */ static merge(src: S, dest: D, ignoreList?: string[]): R; /** * Merges the given default props and the given props * @public * @static * @param defaults {D} * @param props {P} * @return {any} */ static mergeDefaults(defaults: D, props: P): R; static replace, D extends Props>(src: S, dest: D): D; }