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

24 lines (23 loc) • 672 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.stable = stable; var _isShallowEqual = require("./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 function stable() { var isEqual = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _isShallowEqual.isShallowEqual; var cache = null; return function (value) { if (cache && isEqual(cache.value, value)) { return cache.value; } cache = { value: value }; return cache.value; }; }