How to use the @collectable/red-black-tree.iterateFromFirst function in @collectable/red-black-tree

To help you get started, we’ve selected a few @collectable/red-black-tree 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 frptools / collectable / packages / sorted-map / src / internals / iterate.ts View on Github external
export function iterate (map: SortedMapStructure): IterableIterator, V>> {
  return iterateFromFirst(map._sorted);
}
github frptools / collectable / packages / sorted-map / src / internals / iterate.ts View on Github external
export function iteratePairs (map: SortedMapStructure): IterableIterator<[K, V]> {
  return new MappableIterator, V>, [K, V]>(iterateFromFirst(map._sorted), toPair);
}
github frptools / collectable / packages / sorted-set / src / functions / isEqual.ts View on Github external
export function isEqual (set: SortedSetStructure, other: SortedSetStructure): boolean {
  if(set === other) return true;
  if(size(set) !== size(other) ||
     set._select !== other._select ||
     set._compare !== other._compare) return false;

  var a = set._tree, b = other._tree;
  var ita = iterateFromFirst(a), itb = iterateFromFirst(b);
  do {
    var ca = ita.next();
    var cb = itb.next();
    if(!equals(ca.value.value, cb.value.value)) return false;
  } while(!ca.done);

  return true;
}
github frptools / collectable / packages / sorted-map / src / functions / isEqual.ts View on Github external
export function isEqual (set: SortedMapStructure, other: SortedMapStructure): boolean {
  if(set === other) return true;
  if(size(set) !== size(other) ||
     set._select !== other._select ||
     set._compare !== other._compare) return false;

  var a = set._sorted, b = other._sorted;
  var ita = iterateFromFirst(a), itb = iterateFromFirst(b);
  do {
    var ca = ita.next();
    var cb = itb.next();
    if(!equals(ca.value.value, cb.value.value)) return false;
  } while(!ca.done);

  return true;
}

@collectable/red-black-tree

[Collectable.js] Immutable Red-Black Tree

MIT
Latest version published 3 years ago

Package Health Score

46 / 100
Full package analysis

Similar packages