@rx-angular/cdk
Version:
@rx-angular/cdk is a Component Development Kit for ergonomic and highly performant angular applications. It helps to to build Large scale applications, UI libs, state management, rendering systems and much more. Furthermore the unique way of mixing reacti
1 lines • 42 kB
Source Map (JSON)
{"version":3,"file":"cdk-transformations.mjs","sources":["../../../../libs/cdk/transformations/src/lib/_internals/guards.ts","../../../../libs/cdk/transformations/src/lib/array/extract.ts","../../../../libs/cdk/transformations/src/lib/array/insert.ts","../../../../libs/cdk/transformations/src/lib/_internals/valuesComparer.util.ts","../../../../libs/cdk/transformations/src/lib/array/remove.ts","../../../../libs/cdk/transformations/src/lib/array/toDictionary.ts","../../../../libs/cdk/transformations/src/lib/array/update.ts","../../../../libs/cdk/transformations/src/lib/array/upsert.ts","../../../../libs/cdk/transformations/src/lib/object/deleteProp.ts","../../../../libs/cdk/transformations/src/lib/object/dictionaryToArray.ts","../../../../libs/cdk/transformations/src/lib/object/patch.ts","../../../../libs/cdk/transformations/src/lib/object/setProp.ts","../../../../libs/cdk/transformations/src/lib/object/slice.ts","../../../../libs/cdk/transformations/src/lib/object/toggle.ts","../../../../libs/cdk/transformations/src/cdk-transformations.ts"],"sourcesContent":["export function isKeyOf<O>(k: unknown): k is keyof O {\n const typeofK = typeof k;\n return (\n k !== null &&\n k !== undefined &&\n ['string', 'symbol', 'number'].includes(typeofK)\n );\n}\n\nexport function isObjectGuard(obj: unknown): obj is object {\n return (\n obj !== null &&\n obj !== undefined &&\n typeof obj === 'object' &&\n !Array.isArray(obj)\n );\n}\n\nexport function isDefined(val: unknown): val is NonNullable<any> {\n return val !== null && val !== undefined;\n}\n\n/**\n * @description\n * Allows to pass only keys which value is of specific type.\n *\n * @example\n *\n * interface Creature {\n * id: number;\n * type: string;\n * name: string;\n * }\n *\n * const cat = {id: 1, type: 'cat', name: 'Fluffy'};\n *\n * function updateCreature<T>(creature: T, key: OnlyKeysOfSpecificType<T, string>, value: string) {\n * // update logic\n * }\n *\n * // Valid key\n * updateCreature(cat, 'name', 'Luna');\n *\n * // Invalid key\n * updateCreature(cat, 'id', 3);\n *\n * @docsPage OnlyKeysOfSpecificType\n * @docsCategory interfaces\n */\nexport type OnlyKeysOfSpecificType<T, S> = {\n [Key in keyof T]: S extends T[Key] ? Key : never;\n}[keyof T];\n","import { isDefined, isKeyOf } from '../_internals/guards';\n\n/**\n * @description\n * Accepts an array of objects of type T and single key or array of keys (K extends keyof T).\n * The `exctract` method is pure and immutable, thus not touching the input values and returning a shallow\n * copy of the extracted source.\n *\n * @example\n *\n * const cats = [{id: 1, type: 'cat', name: 'Fluffy'}, {id: 2, type: 'cat', name: 'Emma'}];\n *\n * const catsWithoutTypes = extract(cats, ['name', 'id']);\n *\n * // catsWithoutTypes will be:\n * // [{id: 1, name: 'Fluffy'}, {id: 2, name: 'Emma'}];\n *\n * @example\n * // Usage with RxState\n *\n * export class AnimalsListComponent {\n *\n * constructor(private state: RxState<ComponentState>, private api: ApiService) {\n * state.connect(\n * 'animals'\n * this.api.getAnimals(),\n * (state, animals) => extract(animals, ['id', 'name'])\n * );\n * }\n * }\n *\n * @returns T\n *\n * @docsPage slice\n * @docsCategory transformation-helpers\n */\n export function extract<T extends object, K extends keyof T>(\n array: T[],\n keys: K | K[]\n): Pick<T, K>[] {\n const arrayIsArray = isDefined(array) && Array.isArray(array);\n\n if (!arrayIsArray) {\n console.warn(`extract: original value (${array}) is not an array.`);\n return undefined as any;\n }\n\n const sanitizedKeys = (Array.isArray(keys) ? keys : [keys]).filter(\n k => isKeyOf<T>(k) && array.some(i => k in i)\n );\n const length = sanitizedKeys.length;\n\n if (!sanitizedKeys.length) {\n console.warn(`extract: provided keys not found`);\n return undefined as any;\n }\n\n return array.map(item => {\n let i = 0;\n const result = {} as Pick<T, K>;\n\n for(i; i < length; i++) {\n result[sanitizedKeys[i]] = item[sanitizedKeys[i]];\n }\n\n return result;\n }\n );\n}\n","import { isDefined } from '../_internals/guards';\n\n/**\n * @description\n * Inserts one or multiple items to an array T[].\n * Returns a shallow copy of the updated array T[], and does not mutate the original one.\n *\n * @example\n * // Inserting single value\n *\n * const creatures = [{id: 1, type: 'cat'}, {id: 2, type: 'dog'}];\n *\n * const updatedCreatures = insert(creatures, {id: 3, type: 'parrot'});\n *\n * // updatedCreatures will be:\n * // [{id: 1, type: 'cat'}, {id: 2, type: 'dog}, {id: 3, type: 'parrot}];\n *\n * @example\n * // Inserting multiple values\n *\n * const creatures = [{id: 1, type: 'cat'}, {id: 2, type: 'dog'}];\n *\n * const updatedCreatures = insert(creatures, [{id: 3, type: 'parrot'}, {id: 4, type: 'hamster'}]);\n *\n * // updatedCreatures will be:\n * // [{id: 1, type: 'cat'}, {id: 2, type: 'dog'}, {id: 3, type: 'parrot'}, {id: 4, type: 'hamster'}];\n *\n * @example\n * // Usage with RxState\n *\n * export class ListComponent {\n *\n * readonly insertCreature$ = new Subject<void>();\n *\n * constructor(private state: RxState<ComponentState>) {\n * // Reactive implementation\n * state.connect(\n * 'creatures',\n * this.insertCreature$,\n * ({ creatures }) => {\n * const creatureToAdd = {id: generateId(), name: 'newCreature', type: 'dinosaur' };\n * return insert(creatures, creatureToAdd);\n * }\n * );\n * }\n *\n * // Imperative implementation\n * insertCeature(): void {\n * const creatureToAdd = {id: generateId(), name: 'newCreature', type: 'dinosaur' };\n * this.state.set({ creatures: insert(this.state.get().creatures, creatureToAdd)});\n * }\n * }\n *\n *\n * @returns T[]\n *\n * @docsPage insert\n * @docsCategory transformation-helpers\n */\nexport function insert<T>(source: T[], updates: T | T[]): T[] {\n const updatesDefined = isDefined(updates);\n const sourceIsNotArray = !Array.isArray(source);\n const invalidInput = sourceIsNotArray && !updatesDefined;\n\n if (sourceIsNotArray && isDefined(source)) {\n console.warn(`Insert: Original value (${source}) is not an array.`);\n }\n\n if (invalidInput) {\n return source;\n }\n\n return (sourceIsNotArray ? [] : source).concat(\n updatesDefined ? (Array.isArray(updates) ? updates : [updates]) : []\n );\n}\n","import { isKeyOf } from '../_internals/guards';\nimport { CompareFn } from '../interfaces/comparable-data-type';\nimport { ComparableData } from '../interfaces/comparable-data-type';\n\nconst defaultCompareFn = <T>(a: T, b: T) => a === b;\n\nexport function valuesComparer<T>(\n original: T,\n incoming: T,\n compare?: ComparableData<T>\n): boolean {\n if (isKeyOf<T>(compare)) {\n return original[compare] === incoming[compare];\n }\n\n if (Array.isArray(compare)) {\n const sanitizedKeys = compare.filter((k) => isKeyOf<T>(k));\n return sanitizedKeys.length > 0\n ? sanitizedKeys.every((k) => original[k] === incoming[k])\n : defaultCompareFn(original, incoming);\n }\n\n return ((compare as CompareFn<T>) || defaultCompareFn)(original, incoming);\n}\n","import { isDefined } from '../_internals/guards';\nimport { valuesComparer } from '../_internals/valuesComparer.util';\nimport { ComparableData } from '../interfaces/comparable-data-type';\n\n/**\n * @description\n * Removes one or multiple items from an array T[].\n * For comparison you can provide a key, an array of keys or a custom comparison function that should return true if items match.\n * If no comparison data is provided, an equality check is used by default.\n * Returns a shallow copy of the updated array T[], and does not mutate the original one.\n *\n * @example\n * // Removing value without comparison data\n *\n * const items = [1,2,3,4,5];\n *\n * const updatedItems = remove(items, [1,2,3]);\n *\n * // updatedItems will be: [4,5];\n *\n * @example\n * // Removing values with comparison function\n *\n * const creatures = [{id: 1, type: 'cat'}, {id: 2, type: 'unicorn'}, {id: 3, type: 'kobold'}];\n *\n * const nonExistingCreatures = [{id: 2, type: 'unicorn'}, {id: 3, type: 'kobold'}];\n *\n * const realCreatures = remove(creatures, nonExistingCreatures, (a, b) => a.id === b.id);\n *\n * // realCreatures will be: [{id: 1, type: 'cat'}];\n *\n * @example\n * // Removing values with key\n *\n * const creatures = [{id: 1, type: 'cat'}, {id: 2, type: 'unicorn'}, {id: 3, type: 'kobold'}];\n *\n * const nonExistingCreatures = [{id: 2, type: 'unicorn'}, {id: 3, type: 'kobold'}];\n *\n * const realCreatures = remove(creatures, nonExistingCreatures, 'id');\n *\n * // realCreatures will be: [{id: 1, type: 'cat'}];\n *\n * @example\n * // Removing values with array of keys\n *\n * const creatures = [{id: 1, type: 'cat'}, {id: 2, type: 'unicorn'}, {id: 3, type: 'kobold'}];\n *\n * const nonExistingCreatures = [{id: 2, type: 'unicorn'}, {id: 3, type: 'kobold'}];\n *\n * const realCreatures = remove(creatures, nonExistingCreatures, ['id', 'type']);\n *\n * // realCreatures will be: [{id: 1, type: 'cat'}];\n *\n * @example\n * // Usage with RxState\n *\n * export class ListComponent {\n *\n * readonly removeCreature$ = new Subject<Creature>();\n *\n * constructor(private state: RxState<ComponentState>) {\n * // Reactive implementation\n * state.connect(\n * 'creatures',\n * this.removeCreature$,\n * ({ creatures }, creatureToRemove) => {\n * return remove(creatures, creatureToRemove, (a, b) => a.id === b.id);\n * }\n * );\n * }\n *\n * // Imperative implementation\n * removeCreature(creatureToRemove: Creature): void {\n * this.state.set({ creatures: remove(this.state.get().creatures, creatureToRemove, (a, b) => a.id === b.id)});\n * }\n * }\n *\n * @returns T[]\n *\n * @docsPage remove\n * @docsCategory transformation-helpers\n */\nexport function remove<T>(\n source: T[],\n scrap: Partial<T>[] | Partial<T>,\n compare?: ComparableData<T>\n): T[] {\n const scrapAsArray = isDefined(scrap)\n ? Array.isArray(scrap)\n ? scrap\n : [scrap]\n : [];\n const invalidInput = !Array.isArray(source);\n\n if (invalidInput) {\n console.warn(`Remove: original value (${source}) is not an array`);\n return source;\n }\n\n return source.filter((existingItem) => {\n return !scrapAsArray.some((item) =>\n valuesComparer(item as T, existingItem, compare)\n );\n });\n}\n","import { isDefined, isKeyOf, OnlyKeysOfSpecificType } from '../_internals/guards';\n\n/**\n * @description\n * Converts an array of objects to a dictionary {[key: string]: T}.\n * Accepts array T[] and key of type string, number or symbol as inputs.\n *\n *\n * @example\n *\n * const creatures = [{id: 1, type: 'cat'}, {id: 2, type: 'dog'}, {id: 3, type: 'parrot'}];\n *\n * const creaturesDictionary = toDictionary(creatures, 'id');\n *\n * // creaturesDictionary will be:\n * // {\n * // 1: {id: 1, type: 'cat'},\n * // 2: {id: 2, type: 'dog'},\n * // 3: {id: 3, type: 'parrot'}\n * // };\n * @example\n * // Usage with RxState\n *\n * export class ListComponent {\n *\n * readonly convertToDictionary$ = new Subject();\n *\n * constructor(private state: RxState<ComponentState>) {\n * // Reactive implementation\n * state.connect(\n * 'creaturesDictionary',\n * this.convertToDictionary$,\n * ({ creatures }) => {\n * return toDictionary(creatures, 'id');\n * }\n * );\n * }\n *\n * // Imperative implementation\n * convertToDictionary(): void {\n * this.state.set({ creaturesDictionary: toDictionary(this.state.get().creatures, 'id'});\n * }\n * }\n *\n * @see {@link OnlyKeysOfSpecificType}\n * @param {OnlyKeysOfSpecificType<T, S>} key\n * @returns { [key: string]: T[] }\n * @docsPage toDictionary\n * @docsCategory transformation-helpers\n */\nexport function toDictionary<T extends object>(\n source: T[],\n key:\n | OnlyKeysOfSpecificType<T, number>\n | OnlyKeysOfSpecificType<T, string>\n | OnlyKeysOfSpecificType<T, symbol>\n): { [key: string]: T } {\n if (!isDefined(source)) {\n return source;\n }\n\n const sourceEmpty = !source.length;\n\n if (!Array.isArray(source) || sourceEmpty || !isKeyOf<T>(source[0][key])) {\n if (!sourceEmpty) {\n console.warn('ToDictionary: unexpected input params.');\n }\n return {};\n }\n\n const dictionary: { [key: string]: T } = {};\n const length = source.length;\n let i = 0;\n\n for (i; i < length; i++) {\n dictionary[`${source[i][key]}`] = Object.assign({}, source[i]);\n }\n\n return dictionary;\n}\n","import { valuesComparer } from '../_internals/valuesComparer.util';\nimport { ComparableData } from '../interfaces/comparable-data-type';\n\n/**\n * @description\n * Updates one or multiple items in an array T[].\n * For comparison you can provide key, array of keys or a custom comparison function that should return true if items match.\n * If no comparison is provided, an equality check is used by default.\n * Returns a shallow copy of the array T[] and updated items, does not mutate the original array.\n *\n * @example\n * // Update with comparison function\n *\n * const creatures = [{id: 1, type: 'cat'}, {id: 2, type: 'dog'}];\n *\n * const newCat = {id: 1, type: 'lion'};\n *\n * const updatedCreatures = update(creatures, newCat, (a, b) => a.id === b.id);\n *\n * // updatedCreatures will be:\n * // [{id: 1, type: 'lion'}, {id: 2, type: 'dog'}];\n *\n * @example\n * // Update with key\n *\n * const creatures = [{id: 1, type: 'cat'}, {id: 2, type: 'dog'}];\n *\n * const newCat = {id: 1, type: 'lion'};\n *\n * const updatedCreatures = update(creatures, newCat, 'id');\n *\n * // updatedCreatures will be:\n * // [{id: 1, type: 'lion'}, {id: 2, type: 'dog'}];\n *\n * @example\n * // Update with array of keys\n *\n * const creatures = [{id: 1, type: 'cat', name: 'Bella'}, {id: 2, type: 'dog', name: 'Sparky'}];\n *\n * const newCat = {id: 1, type: 'lion', name: 'Bella'};\n *\n * const updatedCreatures = update(creatures, newCat, ['id', 'name']);\n *\n * // updatedCreatures will be:\n * // [{id: 1, type: 'lion', name: 'Bella'}, {id: 2, type: 'dog', name: 'Sparky'}];\n *\n * @example\n * // Usage with RxState\n *\n * export class ListComponent {\n *\n * readonly updateCreature$ = new Subject<Creature>();\n *\n * constructor(private state: RxState<ComponentState>) {\n * // Reactive implementation\n * state.connect(\n * 'creatures',\n * this.updateCreature$,\n * ({ creatures }, creatureToUpdate) => {\n * return update(creatures, creatureToUpdate, (a, b) => a.id === b.id);\n * }\n * );\n * }\n *\n * // Imperative implementation\n * updateCreature(creatureToUpdate: Creature): void {\n * this.state.set({ creatures: update(this.state.get().creatures, creatureToUpdate, (a, b) => a.id === b.id)});\n * }\n * }\n *\n * @returns T[]\n *\n * @docsPage update\n * @docsCategory transformation-helpers\n */\nexport function update<T extends object>(\n source: T[],\n updates: Partial<T>[] | Partial<T>,\n compare?: ComparableData<T>\n): T[] {\n const updatesDefined = updates != null;\n const updatesAsArray = updatesDefined\n ? Array.isArray(updates)\n ? updates\n : [updates]\n : [];\n\n const sourceDefined = source != null;\n const sourceIsNotArray = !Array.isArray(source);\n const invalidInput =\n sourceIsNotArray || source.length === 0 || updatesAsArray.length === 0;\n\n if (sourceDefined && sourceIsNotArray) {\n console.warn(`Update: Original value (${source}) is not an array.`);\n }\n\n if (invalidInput) {\n return source;\n }\n\n const x: T[] = [];\n for (const existingItem of source) {\n const match = customFind(updatesAsArray, (item) =>\n valuesComparer(item as T, existingItem, compare)\n );\n\n x.push(match ? { ...existingItem, ...match } : existingItem);\n }\n\n return x;\n}\n\nfunction customFind<T>(array: T[], fn: (item: T) => boolean): T | undefined {\n for (const item of array) {\n const x = fn(item);\n if (x) {\n return item;\n }\n }\n}\n","import { isObjectGuard } from '../_internals/guards';\nimport { valuesComparer } from '../_internals/valuesComparer.util';\nimport { ComparableData } from '../interfaces/comparable-data-type';\n\n/**\n * @description\n * Updates or inserts (if does not exist) one or multiple items in an array T[].\n * For comparison you can provide a key, an array of keys or a custom comparison function that should return true if\n * items match.\n * If no comparison is provided, an equality check is used by default.\n * upsert is `pure` and `immutable`, your inputs won't be changed\n *\n *\n * @example\n * // Upsert (update) with key\n *\n * const creatures = [{id: 1, type: 'cat'}, {id: 2, type: 'dog'}];\n *\n * const newCat = {id: 1, type: 'lion'};\n *\n * const updatedCreatures = upsert(creatures, newCat, 'id');\n *\n * // updatedCreatures will be:\n * // [{id: 1, type: 'lion'}, {id: 2, type: 'dog'}];\n *\n * @example\n * // Upsert (insert) with key\n *\n * const creatures = [{id: 1, type: 'cat'}, {id: 2, type: 'dog'}];\n *\n * const newCat = {id: 3, type: 'lion'};\n *\n * const updatedCreatures = upsert(creatures, newCat, 'id');\n *\n * // updatedCreatures will be:\n * // [{id: 1, type: 'cat'}, {id: 2, type: 'dog'}, {id: 3, type: 'lion'}];\n *\n * @example\n * // Upsert (update) with array of keys\n *\n * const creatures = [{id: 1, type: 'cat', name: 'Bella'}, {id: 2, type: 'dog', name: 'Sparky'}];\n *\n * const newCat = {id: 1, type: 'lion', name: 'Bella'};\n *\n * const updatedCreatures = upsert(creatures, newCat, ['id', 'name']);\n *\n * // updatedCreatures will be:\n * // [{id: 1, type: 'lion', name: 'Bella'}, {id: 2, type: 'dog', name: 'Sparky'}];\n *\n * @example\n * // Update (insert) with comparison function\n *\n * const creatures = [{id: 1, type: 'cat'}, {id: 2, type: 'dog'}];\n *\n * const newCat = {id: 3, type: 'lion'};\n *\n * const updatedCreatures = upsert(creatures, newCat, (a, b) => a.id === b.id);\n *\n * // updatedCreatures will be:\n * // [{id: 1, type: 'cat'}, {id: 2, type: 'dog'}, {id: 3, type: 'lion'}];\n *\n * @example\n * // Usage with RxState\n *\n * export class ListComponent {\n *\n * // trigger which gets called on add/update (for reactive implementation)\n * readonly addOrUpdateCreature = new Subject<Creature>();\n *\n * constructor(private state: RxState<ComponentState>) {\n * const initialCreatures = [{id: 1, type: 'cat', name: 'Bella'}, {id: 2, type: 'dog', name: 'Sparky'}];\n * state.set({ creatures: initialCreatures });\n * // Reactive implementation\n * state.connect(\n * 'creatures',\n * this.addOrUpdateCreature,\n * ({ creatures }, creatureToUpsert) => {\n * return upsert(creatures, creatureToUpsert, 'id');\n * }\n * );\n * }\n *\n * // Imperative implementation\n * updateCreature(creatureToUpdate: Creature): void {\n * this.state.set({ creatures: upsert(this.state.get('creatures'), creatureToUpdate, 'id')});\n * }\n * }\n *\n * @returns T[]\n *\n * @docsPage upsert\n * @docsCategory transformation-helpers\n */\nexport function upsert<T>(\n source: T[],\n update: Partial<T>[] | Partial<T>,\n compare?: ComparableData<T>\n): T[] {\n // check inputs for validity\n const updatesAsArray =\n update != null ? (Array.isArray(update) ? update : [update]) : [];\n // check inputs for validity\n const sourceIsNotArray = !Array.isArray(source);\n const invalidInput = sourceIsNotArray && updatesAsArray.length === 0;\n // if the source value is not an Array or the input is not defined return the original source\n // this is the case for any edge case:\n // '', null, undefined, CustomObjectOfDoomAndDarkness, ...\n if (invalidInput) {\n return source;\n }\n\n // if source is empty array or not an array, but the updates are valid:\n // return a shallow copy of the updates as result\n if (updatesAsArray.length > 0 && (sourceIsNotArray || source.length === 0)) {\n return [...updatesAsArray] as T[];\n }\n\n const inserts: T[] = [];\n const updates: Record<number, Partial<T>> = {};\n // process updates/inserts\n for (const item of updatesAsArray) {\n const match = source.findIndex((sourceItem) =>\n valuesComparer(item as T, sourceItem, compare)\n );\n // if item already exists, save it as update\n if (match !== -1) {\n updates[match] = item;\n } else {\n // otherwise consider this as insert\n if (isObjectGuard(item)) {\n // create a shallow copy if item is an object\n inserts.push({ ...(item as T) });\n } else {\n // otherwise just push it\n inserts.push(item);\n }\n }\n }\n\n const updated = source.map((item, i) => {\n const updatedItem = updates[i];\n // process the updated\n if (updatedItem !== null && updatedItem !== undefined) {\n if (isObjectGuard(item)) {\n return { ...item, ...updatedItem } as T;\n } else {\n return updatedItem as T;\n }\n }\n return item;\n });\n\n // return the combination of the updated source & the inserts as new array\n return updated.concat(inserts);\n}\n","import { isDefined, isKeyOf, isObjectGuard } from '../_internals/guards';\n\n/**\n * @description\n * Accepts an object of type T and key of type K extends keyof T.\n * Removes property from an object and returns a shallow copy of the updated object without specified property.\n * If property not found returns copy of the original object.\n * Not mutating original object.\n *\n * @example\n *\n * const cat = {id: 1, type: 'cat', name: 'Fluffy'};\n *\n * const anonymusCat = deleteProp(cat, 'name');\n *\n * // anonymusCat will be:\n * // {id: 1, type: 'cat'};\n *\n * @example\n * // Usage with RxState\n *\n * export class ProfileComponent {\n *\n * readonly removeName$ = new Subject();\n *\n * constructor(private state: RxState<ComponentState>) {\n * // Reactive implementation\n * state.connect(\n * this.removeName$,\n * (state) => {\n * return deleteProp(state, 'name');\n * }\n * );\n * }\n *\n * // Imperative implementation\n * removeName(): void {\n * this.state.set(remove(this.get(), 'name'));\n * }\n * }\n *\n * @returns Omit<T, K>\n *\n * @docsPage deleteProp\n * @docsCategory transformation-helpers\n */\nexport function deleteProp<T extends object, K extends keyof T>(\n object: T,\n key: K\n): Omit<T, K> {\n if (!isDefined(object) || !isObjectGuard(object)) {\n console.warn(`DeleteProp: original value ${object} is not an object.`);\n return object;\n }\n\n if (!isKeyOf<T>(key)) {\n console.warn(`DeleteProp: provided key is not a string, number or symbol.`);\n return { ...object };\n }\n\n const copy = { ...object };\n delete copy[key];\n return copy;\n}\n","import { isDefined, isObjectGuard } from '../_internals/guards';\n\n/**\n * @description\n * Converts a dictionary of type {[key: string]: T} to array T[].\n *\n * @example\n *\n * const creaturesDictionary = {\n * '1': {id: 1, type: 'cat'},\n * '2': {id: 2, type: 'dog'},\n * '3': {id: 3, type: 'parrot'}\n * };\n *\n * const creaturesArray = dictionaryToArray(creaturesDictionary);\n *\n * // creaturesArray will be:\n * // [{id: 1, type: 'cat'}, {id: 2, type: 'dog'}, {id: 3, type: 'parrot'}];\n *\n * @example\n * // Usage with RxState\n *\n * export class ListComponent {\n * readonly removeName$ = new Subject();\n *\n * constructor(\n * private state: RxState<ComponentState>,\n * private api: ApiService\n * ) {\n * // Reactive implementation\n * state.connect(\n * 'creatures',\n * this.api.creaturesDictionary$,\n * (_, creatures) => {\n * return dictionaryToArray(creatures);\n * }\n * );\n * }\n *\n * // Imperative implementation\n * removeName(): void {\n * this.api.creaturesDictionary$.pipe(\n * // subscription handling logic\n * ).subscribe(\n * dictionary => this.set({creatures: dictionaryToArray(dictionary)})\n * );\n * }\n * }\n *\n * @returns T[];\n *\n * @docsPage dictionaryToArray\n * @docsCategory transformation-helpers\n */\nexport function dictionaryToArray<T>(dictionary: { [key: string]: T }): T[] {\n if (!isDefined(dictionary)) {\n return dictionary;\n }\n\n if (!isObjectGuard(dictionary)) {\n console.warn(`DictionaryToArray: unexpected input.`);\n return [];\n }\n\n return Object.values(dictionary);\n}\n","import { isObjectGuard } from '../_internals/guards';\n\n/**\n * @description\n * Merges an object of type T with updates of type Partial<T>.\n * Returns a new object where updates override original values while not mutating the original one.\n\n * @example\n * interface Creature {\n * id: number,\n * type: string,\n * name: string\n * }\n *\n * const cat = {id: 1, type: 'cat'};\n *\n * const catWithname = patch(cat, {name: 'Fluffy'});\n *\n * // catWithname will be:\n * // {id: 1, type: 'cat', name: 'Fluffy'};\n *\n * @example\n * // Usage with RxState\n *\n * export class ProfileComponent {\n *\n * readonly changeName$ = new Subject<string>();\n *\n * constructor(private state: RxState<ComponentState>) {\n * // Reactive implementation\n * state.connect(\n * this.changeName$,\n * (state, name) => {\n * return patch(state, { name });\n * }\n * );\n * }\n *\n * // Imperative implementation\n * changeName(name: string): void {\n * this.state.set(patch(this.get(), { name }));\n * }\n * }\n *\n * @returns T\n *\n * @docsPage patch\n * @docsCategory transformation-helpers\n */\nexport function patch<T extends object>(object: T, upd: Partial<T>): T {\n const update = isObjectGuard(upd) ? upd : {};\n\n if (!isObjectGuard(object) && isObjectGuard(upd)) {\n console.warn(`Patch: original value ${object} is not an object.`);\n return { ...update } as T;\n }\n\n if (!isObjectGuard(object) && !isObjectGuard(upd)) {\n console.warn(\n `Patch: original value ${object} and updates ${upd} are not objects.`\n );\n return object;\n }\n\n return { ...object, ...update };\n}\n","import { isDefined, isKeyOf, isObjectGuard } from '../_internals/guards';\n\n/**\n * @description\n * Accepts an object of type T, key of type K extends keyof T, and value of type T[K].\n * Sets the property and returns a newly updated shallow copy of an object while not mutating the original one.\n *\n * @example\n *\n * const cat = {id: 1, type: 'cat', name: 'Fluffy'};\n *\n * const renamedCat = setProp(cat, 'name', 'Bella');\n *\n * // renamedCat will be:\n * // {id: 1, type: 'cat', name: 'Bella'};\n *\n * @example\n * // Usage with RxState\n *\n * export class ProfileComponent {\n *\n * readonly changeName$ = new Subject<string>();\n *\n * constructor(private state: RxState<ComponentState>) {\n * // Reactive implementation\n * state.connect(\n * this.changeName$,\n * (state, name) => {\n * return setProp(state, 'name', name);\n * }\n * );\n * }\n *\n * // Imperative implementation\n * changeName(name: string): void {\n * this.state.set(setProp(this.get(), 'name', name));\n * }\n * }\n *\n * @returns T\n *\n * @docsPage setProp\n * @docsCategory transformation-helpers\n */\nexport function setProp<T extends object, K extends keyof T>(\n object: T,\n key: K,\n value: T[K]\n): T {\n const objectIsObject = isObjectGuard(object);\n const keyIsValid = isKeyOf<T>(key);\n const initialObject = objectIsObject ? object : ({} as T);\n\n if (!objectIsObject) {\n console.warn(`SetProp: original value (${object}) is not an object.`);\n }\n\n if (!keyIsValid) {\n console.warn(`SetProp: key argument (${key}) is invalid.`);\n }\n\n if (!isDefined(object) && !keyIsValid) {\n return object;\n }\n\n if (keyIsValid) {\n return {\n ...initialObject,\n [key]: value\n };\n }\n\n return { ...initialObject };\n}\n","import { isDefined, isKeyOf, isObjectGuard } from '../_internals/guards';\n\n/**\n * @description\n * Accepts an object of type T and single key or array of keys (K extends keyof T).\n * Constructs new object based on provided keys.\n *\n * @example\n *\n * const cat = {id: 1, type: 'cat', name: 'Fluffy'};\n *\n * const catWithoutType = slice(cat, ['name', 'id']);\n *\n * // catWithoutType will be:\n * // {id: 1, name: 'Fluffy'};\n *\n * @example\n * // Usage with RxState\n *\n * export class AnimalsListComponent {\n *\n * constructor(private state: RxState<ComponentState>, private api: ApiService) {\n * state.connect(\n * 'animals'\n * this.api.getAnimals(),\n * (state, animals) => {\n * return animals.map(animal => slice(animal, ['id', 'name']));\n * }\n * );\n * }\n * }\n *\n * @returns T\n *\n * @docsPage slice\n * @docsCategory transformation-helpers\n */\nexport function slice<T extends object, K extends keyof T>(\n object: T,\n keys: K | K[]\n): Pick<T, K> {\n const objectIsObject = isDefined(object) && isObjectGuard(object);\n\n if (!objectIsObject) {\n console.warn(`slice: original value (${object}) is not an object.`);\n return undefined as any;\n }\n\n const sanitizedKeys = (Array.isArray(keys) ? keys : [keys]).filter(\n (k) => isKeyOf<T>(k) && k in object\n );\n\n if (!sanitizedKeys.length) {\n console.warn(`slice: provided keys not found`);\n return undefined as any;\n }\n\n return sanitizedKeys.reduce(\n (acc, k) => ({ ...acc, [k]: object[k] }),\n {} as Pick<T, K>\n );\n}\n","import {\n isDefined,\n isKeyOf,\n isObjectGuard,\n OnlyKeysOfSpecificType,\n} from '../_internals/guards';\n\n/**\n * @description\n * Toggles a boolean property in the object.\n * Accepts object of type T and key value of which is boolean.\n * Toggles the property and returns a shallow copy of an object, while not mutating the original one.\n *\n * @example\n *\n * const state = {items: [1,2,3], loading: true};\n *\n * const updatedState = toggle(state, 'loading');\n *\n * // updatedState will be:\n * // {items: [1,2,3], loading: false};\n *\n * @example\n * // Usage with RxState\n *\n * export class ListComponent {\n * readonly loadingChange$ = new Subject();\n *\n * constructor(\n * private state: RxState<ComponentState>\n * ) {\n * // Reactive implementation\n * state.connect(\n * this.api.loadingChange$,\n * (state, _) => {\n * return toggle(state, 'isLoading');\n * }\n * );\n * }\n *\n * // Imperative implementation\n * toggleLoading(): void {\n * this.set(toggle(state, 'isLoading'));\n * }\n * }\n *\n * @returns T\n *\n * @docsPage toggle\n * @docsCategory transformation-helpers\n */\n\nexport function toggle<T extends object>(\n object: T,\n key: OnlyKeysOfSpecificType<T, boolean>\n): T {\n const objectIsObject = isObjectGuard(object);\n const keyIsValid = isKeyOf<T>(key);\n const initialObject = objectIsObject ? object : ({} as T);\n\n if (!objectIsObject) {\n console.warn(`Toggle: original value (${object}) is not an object.`);\n }\n\n if (!keyIsValid) {\n console.warn(`Toggle: key argument (${key}) is invalid.`);\n }\n\n if (keyIsValid && typeof initialObject[key] !== 'boolean') {\n console.warn(`Toggle: value of the key (${String(key)}) is not a boolean.`);\n }\n\n if (!isDefined(object) && !keyIsValid) {\n return object;\n }\n\n if (\n keyIsValid &&\n (typeof initialObject[key] === 'boolean' ||\n !initialObject.hasOwnProperty(key))\n ) {\n return { ...initialObject, [key]: !initialObject[key] };\n }\n\n return { ...initialObject };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAM,SAAU,OAAO,CAAI,CAAU,EAAA;AACnC,IAAA,MAAM,OAAO,GAAG,OAAO,CAAC;IACxB,QACE,CAAC,KAAK,IAAI;AACV,QAAA,CAAC,KAAK,SAAS;AACf,QAAA,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;AAEpD;AAEM,SAAU,aAAa,CAAC,GAAY,EAAA;IACxC,QACE,GAAG,KAAK,IAAI;AACZ,QAAA,GAAG,KAAK,SAAS;QACjB,OAAO,GAAG,KAAK,QAA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