/** * Iterable object like string, Array, Map, Set, Generator iterable... * @private * @typedef {Object} Iterable */ /** * This function converts an iterable object or a plain object to new a plain object * @param {Iterable|Object} v an iterable object or a plain object * @param {function} [callback] Function which will be call on every element of an iterable object or a plain object * @param {*} [context] Value which will be used as context(this) when executed callback function * @returns {Object} New plain object * @example * toPlainObject([1, 2, 3]) // {0: 1, 1: 2, 2: 3} */ export function toPlainObject(v: Iterable | any, callback?: Function, context?: any): any; /** * This function converts an iterable object or a plain object to new a map object * @param {Iterable|Object} v An iterable object or a plain object * @param {function} [callback] Function which will be call on every element of an iterable object or a plain object * @param {*} [context] Value which will be use as context(this) when executed callback function * @returns {Map} New map object * @example * toMap([1, 2, 3]) // Map(3){"x" => 1, "y" => 2, "z" => 3} */ export function toMap(v: Iterable | any, callback?: Function, context?: any): Map; /** * This function converts an iterable object or a plain object to new a set object * @param {Iterable|Object} v An iterable object or a plain object * @param {function} [callback] Function which will be call on every element of an iterable object or a plain object * @param {*} [context] Value which will be use as context(this) when executed callback function * @returns {Set<*>} New set object * @example * toSet({ x: 1, y: 2, z: 3 }) // Set(3){{ ... }, { ... }, { ... } */ export function toSet(v: Iterable | any, callback?: Function, context?: any): Set; /** * This function converts an any value to new a set object * @param {*} v An any value * @param {function} [callback] Function which will be call on every element of an iterable object or a plain object * @param {*} [context] Value which will be use as context(this) when executed callback function * @returns {*[]} New set object * @example * toSetAll(undefined) // Set { undefined } */ export function toSetAll(v: any, callback?: Function, context?: any): any[]; /** * This function assigns several source objects to a target object * @param {Iterable|Object} targetObject target object which will be assigned * @param {Object} sourceObjects Source objects which to assign to a target object * @returns {Object} New target object * @example * assign([1, 2, 3], 33, 33, 44) // [ 1, 2, 3, 33, 33, 44 ] */ export function assign(targetObject: Iterable | any, ...sourceObjects: any): any; /** * This function returns new array object with [key, value] pair * @param {Iterable|Object} v An iterable object or a plain object * @returns {Array} New array object * @example * entries({ x: 1, y: 2, z: new Map([['x', 1]]) }) // [['x', 1], ['y', 2], ['z', Map { 'x' => 1 }]] */ export function entries(v: Iterable | any): any[]; /** * This function returns new value which shallow copied of given value * @param {*} v Value which will be copy * @param {*} [context] Context(this) which will be bind if function type * @returns {*} Copied value * @example * copy(new Map([['x', 1], ['y', 2]])) // Map { 'x' => 1, 'y' => 2 } */ export function copy(v: any, context?: any): any; /** * This function returns new value which deep copied of given value * @param {*} v Value which will be copy * @param {function} [callback] Function which will be call on every element of given value * @param {*} [context] Value which will be used as context(this) when executed callback function * @returns {*} Copied value * @example * deepCopy({ x: { y: new Map([['x', { x: { y: function() {}, z: new Set([1, 2, 3]) } }]]) } }) // { x: { y: Map { 'x' => [Object] } } } */ export function deepCopy(v: any, callback?: Function, context?: any): any; /** * This function will be deeply freeze of given object * @param {*} v Value which will be frozen * @returns {*} * @example * deepFreeze({ x: { y: { z: () => {} } } }) */ export function deepFreeze(v: any): any; /** * This function will be deeply seal of given object * @param {Iterable|Object} v Iterable object or Plain object * @returns {Object} * @example * deepSeal({ x: { y: { z: () => {} } } }) */ export function deepSeal(v: Iterable | any): any; /** * This function will be prevent extended of given object * @param {Iterable|Object} v Iterable object or Plain object * @returns {Object} * @example * deepPreventExtensions({ x: { y: { z: () => {} } } }) */ export function deepPreventExtensions(v: Iterable | any): any; /** * This function returns whether has a property in given object * @param {Iterable|Object} v Iterable object or Plain object * @param {string} k key * @returns {boolean} * @example * hasProp({ x: { y: { z: () => {} } } }, 'x') // true */ export function hasProp(v: Iterable | any, k: string): boolean; /** * This function returns whether has a property in given object * @param {Iterable|Object} v Iterable object or Plain object * @param {string} k key * @returns {boolean} * @example * deepHasProp({ x: { y: { z: () => {}, x: { y: { zz: 1 } } } } }, 'zz') // true */ export function deepHasProp(v: Iterable | any, k: string): boolean; /** * This function returns whether has extensible of given object * @param {Iterable|Object} v Iterable object or Plain object * @returns {boolean} * @example * deepHasExtensible(obj) */ export function deepHasExtensible(v: Iterable | any): boolean; /** * This function returns whether has freeze of given object * @param {Iterable|Object} v Iterable object or Plain object * @returns {boolean} * @example * deepHasFrozen(obj) */ export function deepHasFrozen(v: Iterable | any): boolean; /** * This function returns whether seal of given object * @param {Iterable|Object} v Iterable object or Plain object * @returns {boolean} * @example * deepHasSealed(obj) */ export function deepHasSealed(v: Iterable | any): boolean; /** * This function returns whether included a constructor in prototype object * @param {Iterable|Object} v Iterable object or Plain object * @param {Object} constructor * @returns {boolean} * @example * hasInstanceOf(obj, constructor) // true */ export function hasInstanceOf(v: Iterable | any, constructor: any): boolean; /** * This function inserts a value from a target index of an array object or a set object * @param {Array|Set} v An Array object or a Set object * @param {number} targetIndex Target index * @param {*} values Values which will be inserted * @returns {Set|Array} * @example * insert([1, 2, 3, 4], 1, 22) // [1, 22, 2, 3, 4] */ export function insert(v: any[] | Set, targetIndex: number, ...values: any): Set | any[]; /** * This function replaces from target index value of an array object or a set object to new values * @param {Array|Set} v An Array object or a Set object * @param {number} targetIndex Target index * @param {*} values Values which will be replaced * @returns {Set|Array} * @example * replace([1, 2, 3, 4], 2, 33, 'ADD') // [1, 2, 33, 'ADD', 4] */ export function replace(v: any[] | Set, targetIndex: number, ...values: any): Set | any[]; /** * This function inserts a value from first index of an iterable object or a plain object * @param {Array|Set} v An Array object or a Set object * @param {*} values Values which will be inserted * @returns {Set|Array} * @example * unshift([1, 2, 3], 11, 22, 33) // [ 11, 22, 33, 1, 2, 3 ] */ export function unshift(v: any[] | Set, ...values: any): Set | any[]; /** * This function inserts a value from last index of an iterable object or a plain object * @param {Array|Set} v An Array object or a Set object * @param {*} values Values which will be inserted * @returns {Set|Array} * @example * push([1, 2, 3], 11, 22, 33) // [ 1, 2, 3, 11, 22, 33 ] */ export function push(v: any[] | Set, ...values: any): Set | any[]; /** * This function removes a value at a target index of an array object or a set object * @param {Array|Set} v An Array object or a Set object * @param {function} callback Function which will be call on every element of an iterable object or a plain object * @param {number} [fromIndex=0] Start index which will be search * @returns {Set|Array} * @example * remove(['1', 2, 3, 4], v => typeof v === 'number'); // ['1'] */ export function remove(v: any[] | Set, callback: Function, fromIndex?: number): Set | any[]; /** * This function returns a length of an iterable object or plain object * @param {Iterable|Object} v An iterable object or a plain object * @returns {number} * @example * size(new Map([['x', 1]])) // 1 */ export function size(v: Iterable | any): number; /** * @private */ export function deepTruly(v: any, { fAtNotObject, fAtObject }: { fAtNotObject?: () => void; fAtObject?: () => void; }): boolean; /** * Iterable object like string, Array, Map, Set, Generator iterable... */ export type Iterable = any; import { toArray } from "array-organizer"; import { toArrayAll } from "array-organizer"; import { forEach } from "array-organizer"; import { of } from "array-organizer"; import { indexOf } from "array-organizer"; import { lastIndexOf } from "array-organizer"; import { join } from "array-organizer"; import { keys } from "array-organizer"; import { values } from "array-organizer"; import { find } from "array-organizer"; import { findIndex } from "array-organizer"; import { deepFind } from "array-organizer"; import { includes } from "array-organizer"; import { asc } from "array-organizer"; import { desc } from "array-organizer"; import { ascBy } from "array-organizer"; import { descBy } from "array-organizer"; export { toArray, toArrayAll, forEach, of, indexOf, lastIndexOf, join, keys, values, find, findIndex, deepFind, includes, asc, desc, ascBy, descBy };