import { PlainObject } from "../models.mjs"; //#region src/array/match.d.ts /** * Comparison of an array within another array */ type ArrayComparison = 'end' | 'inside' | 'invalid' | 'outside' | 'same' | 'start'; /** * Is the needle array at the end of the haystack array? * * @param haystack Haystack array * @param needle Needle array * @param callback Callback to get an item's value for matching * @returns `true` if the haystack ends with the needle, otherwise `false` * * @example * ```typescript * endsWithArray( * [{id: 1}, {id: 2}, {id: 3}], * [{id: 2}, {id: 3}], * item => item.id, * ); // => true * ``` */ declare function endsWithArray(haystack: Item[], needle: Item[], callback: (item: Item, index: number, array: Item[]) => unknown): boolean; /** * Is the needle array at the end of the haystack array? * * @param haystack Haystack array * @param needle Needle array * @param key Key to get an item's value for matching * @returns `true` if the haystack ends with the needle, otherwise `false` * * @example * ```typescript * endsWithArray( * [{id: 1}, {id: 2}, {id: 3}], * [{id: 2}, {id: 3}], * 'id', * ); // => true * ``` */ declare function endsWithArray(haystack: Item[], needle: Item[], key: keyof Item): boolean; /** * Is the needle array at the end of the haystack array? * * @param haystack Haystack array * @param needle Needle array * @returns `true` if the haystack ends with the needle, otherwise `false` * * @example * ```typescript * endsWithArray([1, 2, 3], [2, 3]); // => true * ``` */ declare function endsWithArray(haystack: Item[], needle: Item[]): boolean; /** * Get the position of an array within another array * * @param haystack Haystack array * @param needle Needle array * @param callback Callback to get an item's value for matching * @returns Position of the needle within the haystack * * @example * ```typescript * getArrayComparison( * [{id: 1}, {id: 2}, {id: 3}], * [{id: 2}, {id: 3}], * item => item.id, * ); // => 'end' * ``` */ declare function getArrayComparison(haystack: Item[], needle: Item[], callback: (item: Item, index: number, array: Item[]) => unknown): ArrayComparison; /** * Get the position of an array within another array * * @param haystack Haystack array * @param needle Needle array * @param key Key to get an item's value for matching * @returns Position of the needle within the haystack * * @example * ```typescript * getArrayComparison( * [{id: 1}, {id: 2}, {id: 3}], * [{id: 2}, {id: 3}], * 'id', * ); // => 'end' * ``` */ declare function getArrayComparison(haystack: Item[], needle: Item[], key: keyof Item): ArrayComparison; /** * Get the position of an array within another array * * @param haystack Haystack array * @param needle Needle array * @returns Position of the needle within the haystack * * @example * ```typescript * getArrayComparison([1, 2, 3], [2, 3]); // => 'end' * ``` */ declare function getArrayComparison(haystack: Item[], needle: Item[]): ArrayComparison; /** * Does the needle array exist within the haystack array? * * @param haystack Haystack array * @param needle Needle array * @param callback Callback to get an item's value for matching * @returns `true` if the haystack includes the needle, otherwise `false` * * @example * ```typescript * includesArray( * [{id: 1}, {id: 2}, {id: 3}], * [{id: 2}, {id: 3}], * item => item.id, * ); // => true * ``` */ declare function includesArray(haystack: Item[], needle: Item[], callback: (item: Item, index: number, array: Item[]) => unknown): boolean; /** * Does the needle array exist within the haystack array? * * @param haystack Haystack array * @param needle Needle array * @param key Key to get an item's value for matching * @returns `true` if the haystack includes the needle, otherwise `false` * * @example * ```typescript * includesArray( * [{id: 1}, {id: 2}, {id: 3}], * [{id: 2}, {id: 3}], * 'id', * ); // => true * ``` */ declare function includesArray(haystack: Item[], needle: Item[], key: keyof Item): boolean; /** * Does the needle array exist within the haystack array? * * @param haystack Haystack array * @param needle Needle array * @returns `true` if the haystack includes the needle, otherwise `false` * * @example * ```typescript * includesArray([1, 2, 3], [2, 3]); // => true * ``` */ declare function includesArray(haystack: Item[], needle: Item[]): boolean; /** * Get the index of an array within another array * * @param haystack Haystack array * @param needle Needle array * @param callback Callback to get an item's value for matching * @returns Index of the needle's start within the haystack, or `-1` if it is not found * * @example * ```typescript * indexOfArray( * [{id: 1}, {id: 2}, {id: 3}], * [{id: 2}, {id: 3}], * item => item.id, * ); // => 1 * ``` */ declare function indexOfArray(haystack: Item[], needle: Item[], callback: (item: Item, index: number, array: Item[]) => unknown): number; /** * Get the index of an array within another array * * @param haystack Haystack array * @param needle Needle array * @param key Key to get an item's value for matching * @returns Index of the needle's start within the haystack, or `-1` if it is not found * * @example * ```typescript * indexOfArray( * [{id: 1}, {id: 2}, {id: 3}], * [{id: 2}, {id: 3}], * 'id', * ); // => 1 * ``` */ declare function indexOfArray(haystack: Item[], needle: Item[], key: keyof Item): number; /** * Get the index of an array within another array * * @param haystack Haystack array * @param needle Needle array * @returns Index of the needle's start within the haystack, or `-1` if it is not found * * @example * ```typescript * indexOfArray([1, 2, 3], [2, 3]); // => 1 * ``` */ declare function indexOfArray(haystack: Item[], needle: Item[]): number; /** * Is the needle array at the start of the haystack array? * * @param haystack Haystack array * @param needle Needle array * @param callback Callback to get an item's value for matching * @returns `true` if the haystack starts with the needle, otherwise `false` * * @example * ```typescript * startsWithArray( * [{id: 1}, {id: 2}, {id: 3}], * [{id: 1}, {id: 2}], * item => item.id, * ); // => true * ``` */ declare function startsWithArray(haystack: Item[], needle: Item[], callback: (item: Item, index: number, array: Item[]) => unknown): boolean; /** * Is the needle array at the start of the haystack array? * * @param haystack Haystack array * @param needle Needle array * @param key Key to get an item's value for matching * @returns `true` if the haystack starts with the needle, otherwise `false` * * @example * ```typescript * startsWithArray( * [{id: 1}, {id: 2}, {id: 3}], * [{id: 1}, {id: 2}], * 'id', * ); // => true * ``` */ declare function startsWithArray(haystack: Item[], needle: Item[], key: keyof Item): boolean; /** * Is the needle array at the start of the haystack array? * * @param haystack Haystack array * @param needle Needle array * @returns `true` if the haystack starts with the needle, otherwise `false` * * @example * ```typescript * startsWithArray([1, 2, 3], [1, 2]); // => true * ``` */ declare function startsWithArray(haystack: Item[], needle: Item[]): boolean; //#endregion export { ArrayComparison, endsWithArray, getArrayComparison, includesArray, indexOfArray, startsWithArray };