import { PlainObject } from './validator.functions'; /** * Utility function library: * * addClasses, copy, forEach, forEachCopy, hasOwn, mergeFilteredObject, * uniqueItems, commonItems, fixTitle, toTitleCase */ /** * 'addClasses' function * * Merges two space-delimited lists of CSS classes and removes duplicates. */ export declare function addClasses(oldClasses: string | string[] | Set, newClasses: string | string[] | Set): string | string[] | Set; /** * 'copy' function * * Makes a shallow copy of a JavaScript object, array, Map, or Set. * If passed a JavaScript primitive value (string, number, boolean, or null), * it returns the value. */ export declare function copy(object: any, errors?: boolean): any; /** * 'forEach' function * * Iterates over all items in the first level of an object or array * and calls an iterator funciton on each item. * * The iterator function is called with four values: * 1. The current item's value * 2. The current item's key * 3. The parent object, which contains the current item * 4. The root object * * Setting the optional third parameter to 'top-down' or 'bottom-up' will cause * it to also recursively iterate over items in sub-objects or sub-arrays in the * specified direction. */ export declare function forEach(object: any, fn: (v: any, k?: string | number, c?: any, rc?: any) => any, recurse?: boolean | string, rootObject?: any, errors?: boolean): void; /** * 'forEachCopy' function * * Iterates over all items in the first level of an object or array * and calls an iterator function on each item. Returns a new object or array * with the same keys or indexes as the original, and values set to the results * of the iterator function. * * Does NOT recursively iterate over items in sub-objects or sub-arrays. */ export declare function forEachCopy(object: any, fn: (v: any, k?: string | number, o?: any, p?: string) => any, errors?: boolean): any; /** * 'hasOwn' utility function * * Checks whether an object or array has a particular property. */ export declare function hasOwn(object: any, property: string): boolean; /** * 'mergeFilteredObject' utility function * * Shallowly merges two objects, setting key and values from source object * in target object, excluding specified keys. * * Optionally, it can also use functions to transform the key names and/or * the values of the merging object. */ export declare function mergeFilteredObject(targetObject: PlainObject, sourceObject: PlainObject, excludeKeys?: string[], keyFn?: (key: string) => string, valFn?: (val: any) => any): PlainObject; /** * 'uniqueItems' function * * Accepts any number of string value inputs, * and returns an array of all input vaues, excluding duplicates. */ export declare function uniqueItems(...items: any[]): string[]; /** * 'commonItems' function * * Accepts any number of strings or arrays of string values, * and returns a single array containing only values present in all inputs. */ export declare function commonItems(...arrays: any[]): string[]; /** * 'fixTitle' function */ export declare function fixTitle(name: string): string; /** * 'toTitleCase' function * * Intelligently converts an input string to Title Case. * * Accepts an optional second parameter with a list of additional * words and abbreviations to force into a particular case. * * This function is built on prior work by John Gruber and David Gouch: * http://daringfireball.net/2008/08/title_case_update * https://github.com/gouch/to-title-case */ export declare function toTitleCase(input: string, forceWords?: string | string[]): string;