Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function setItem (value: T, map: ValueMap, tree: Sorted, select: SelectorFn|undefined): boolean {
var entry: SortedSetItem|undefined;
update(arg => {
if(isUndefined(arg)) {
return entry = {
index: ++_nextIndex,
view: isDefined(select) ? select(value) : void 0,
value
};
}
}, value, map);
if(isDefined(entry)) {
set, null>(entry, null, tree);
return true;
}
return false;
}