@atlaskit/pragmatic-drag-and-drop-hitbox
Version:
An optional package for Pragmatic drag and drop that enables the attaching of interaction information to a drop target
17 lines • 467 B
JavaScript
import { isShallowEqual } from './isShallowEqual';
/**
* Used to store a stable object, which returns a new object only if one of the values has changed
*/
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
export function stable(isEqual = isShallowEqual) {
let cache = null;
return value => {
if (cache && isEqual(cache.value, value)) {
return cache.value;
}
cache = {
value
};
return cache.value;
};
}