import { PlainObject } from "../models.mjs"; //#region src/array/toggle.d.ts /** * Toggle an item in an array * * If the item exists, it will be removed; if it doesn't, it will be added * * @param destination Array to toggle within * @param toggled Toggled items * @param callback Callback to find existing item * @returns Original array * * @example * ```typescript * toggle( * [{id: 1}, {id: 2}, {id: 3}], * [{id: 2}, {id: 4}], * item => item.id, * ); // => [{id: 1}, {id: 3}, {id: 4}] * ``` */ declare function toggle(destination: Item[], toggled: Item[], callback: (item: Item, index: number, array: Item[]) => unknown): Item[]; /** * Toggle an item in an array * * If the item exists, it will be removed; if it doesn't, it will be added * * @param destination Array to toggle within * @param toggled Toggled items * @param key Key to find existing item * @returns Original array * * @example * ```typescript * toggle( * [{id: 1}, {id: 2}, {id: 3}], * [{id: 2}, {id: 4}], * 'id', * ); // => [{id: 1}, {id: 3}, {id: 4}] * ``` */ declare function toggle(destination: Item[], toggled: Item[], key: ItemKey): Item[]; /** * Toggle an item in an array * * If the item exists, it will be removed; if it doesn't, it will be added * * @param destination Array to toggle within * @param toggled Toggled items * @returns Original array * * @example * ```typescript * toggle( * [1, 2, 3], * [2, 4], * ); // => [1, 3, 4] * ``` */ declare function toggle(destination: Item[], toggled: Item[]): Item[]; //#endregion export { toggle };