UNPKG

@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

18 lines • 558 B
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() { var isEqual = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : isShallowEqual; var cache = null; return function (value) { if (cache && isEqual(cache.value, value)) { return cache.value; } cache = { value: value }; return cache.value; }; }