UNPKG

@snups/rjsf-utils

Version:
18 lines (17 loc) 809 B
/** * Compares two objects and returns the names of the fields that have changed. * This function iterates over each field of object `a`, using `_.isEqual` to compare the field value * with the corresponding field value in object `b`. If the values are different, the field name will * be included in the returned array. * * @param a - The first object, representing the original data to compare. * @param b - The second object, representing the updated data to compare. * @returns - An array of field names that have changed. * * @example * const a = { name: 'John', age: 30 }; * const b = { name: 'John', age: 31 }; * const changedFields = getChangedFields(a, b); * console.log(changedFields); // Output: ['age'] */ export default function getChangedFields(a: unknown, b: unknown): string[];