How to use the monet.Identity function in monet

To help you get started, we’ve selected a few monet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kepta / idly / packages / idly-state / src / osmState / index.ts View on Github external
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];
};
github kepta / idly / packages / idly-state / src / index.ts View on Github external
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();
}
github kepta / idly / packages / idly-state / src / osmState / index.ts View on Github external
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();
github kepta / idly / packages / idly-common / src / state2 / table / oneToMany.ts View on Github external
export const oneToManyTableRemoveIndex = (
  table: OneToManyTable,
  index: string,
  value: T
): boolean | undefined =>
  I(tableGet(table, index))
    .map(s => s && s.delete(value))
    .get();