@adobe/uxp-optimized
Version:
Library of react components optimized for Adobe's Unified Extensibility Platform
7 lines (6 loc) • 397 B
TypeScript
/**
* Returns a new array that contains as many values as possible
* within the same location as previous array.
* We also try to reuse indexes by type and never return a array smaller than the old array unless items have been completely removed.
*/
export default function getStableArray<T>(oldValues: T[], newSet: Set<T>, oldTypes?: (value: T) => any, newTypes?: (value: T) => any): T[];