/// /// import { clone, Operation } from "jiff"; import { Path, TrackedOptions } from "./@types"; /** * Resets given object to its original satate using given array of operations. Different from [JSON Patch](http://jsonpatch.com/) standard, uses more relaxed rules. * For example rejected operations does stop further execution, values to be replaced in arrays are searched in different index positions etc. * Please note: This function mutates `data` object. * @param {Object} [data] - Data to be reset. * @param {Array} [history=[]] - Array of operations to execute. * @param {OperationOptions} [options] - Options * @param {boolean} [options.force=false] - Forces operation even it is not safe. * @param {boolean} [options.exact=false] - Modifies find algorithm for arrays. If true, function searches given value in given exact position. Otherwise searches all array. * @param {boolean} [options.checkDuplicate=true] - Checks duplicate values in array. If true, when duplicate value is present, add/replace operation is skipped. * @param {boolean} [options.addNotFound=true] - If true, during replace, adds given value even replaced key is not present in array or object. * @param {boolean} [options.clean=true] - If true, removes empty objects, empty arrays, empty strings, null and undefined values from objects and arrays. * @returns {Array|undefined} - Returns array of operations which are skipped, `undefined` if all operations are applied. */ export declare function reset(data?: object, history?: Operation[], {exact, checkDuplicate, force, addNotFound, clean, logger, name}?: TrackedOptions): Operation[] | undefined; /** * Compares two objects and returns operations needed to reset current object into original object. * @param {object} [currentObject={}] - Object to be used in `reset` function. * @param {object} [originalObject={}] - Original object to get after reset operation. * @returns {Array} - Array of operations to apply to current object to get original object. */ export declare function diff(currentObject?: object, originalObject?: object): Operation[]; /** * Checks whether value at given path is safe to change by comparing cuurent object to original object. May be used to * test whether values in given path are created/modified by user and safe to change. Like "in" operator, returns true * if there is no entry for given path. However, differently, it returns true if value exist in modified object but * it is different from original, assuming it is modified using this library and may be changed further. * @param {object} currentObject - Current object. * @param {object} originalObject - Original object. * @param {Array|string|number} path - Path to get result for. * @returns {boolean} - Whether given path has same value as original path. */ export declare function mayChange(currentObject: object, originalObject: object, path: Path): boolean; export { Path, TrackedOptions, clone, Operation };