Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const osmStateShred: OsmStateShredType = ([state, log]) => {
const newState = Identity(setClone(logGetEveryId(log)))
.map(idsToSave => setAddIterable(logGetBaseIds(log), idsToSave))
.map(idsToSave => expandIdsAndRelated(idsToSave, state.getElementTable()))
.map(entityTable => State.create(entityTable))
.get();
// @TOFIX reliance on ''
newState.getQuadkeysTable().set('', setClone(logGetEveryId(log)));
return [newState, log];
};
export function stateGetVisibles(
state: OsmState,
quadkeys: string[]
): DerivedTable {
consistencyChecker(state);
return Identity(
setClone(virginGetInQuadkeys(state.virgin.quadkeysTable, quadkeys))
)
.map(visibleIds => setBulkDelete(logGetBaseIds(state.log), visibleIds))
.map(visibleIds => setAddIterable(logGetCurrentIds(state.log), visibleIds))
.map(visibleIds => getRenderableEntities(visibleIds, state))
.map(entityTable => derivedTableUpdate(entityTable, state.derivedTable))
.get();
}
export const osmStateGetVisible: OsmStateGetVisible = (
[state, log],
quadkeys
) =>
Identity(setClone(state.getVisible(quadkeys)))
.map(visible => setBulkDelete(logGetBaseIds(log), visible))
.map(visible => setAddIterable(logGetCurrentIds(log), visible))
.map(visible => expandIdsAndRelated(visible, state.getElementTable()))
.map(entityTable => derivedTableUpdate(entityTable, state.getMetaTable()))
.get();
export const oneToManyTableRemoveIndex = (
table: OneToManyTable,
index: string,
value: T
): boolean | undefined =>
I(tableGet(table, index))
.map(s => s && s.delete(value))
.get();