How to use @collectable/red-black-tree - 10 common examples

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;
}
github frptools / collectable / packages / sorted-map / src / internals / iterate.ts View on Github external
export function iterateKeys (map: SortedMapStructure): IterableIterator {
  return new MappableIterator, K>(keys(map._sorted), toKey);
}
github frptools / collectable / packages / sorted-set / src / internals / iterate.ts View on Github external
export function iterate (set: SortedSetStructure): IterableIterator> {
  return keys(set._tree);
}
github frptools / collectable / packages / sorted-set / src / internals / iterate.ts View on Github external
export function iterateValues (set: SortedSetStructure): IterableIterator {
  return new MappableIterator, T>(keys(set._tree), valueOf);
}
github frptools / collectable / packages / sorted-map / src / functions / size.ts View on Github external
export function size (map: SortedMapStructure): number {
  return _size(map._sorted);
}
github frptools / collectable / packages / sorted-set / src / functions / size.ts View on Github external
export function size (set: SortedSetStructure): number {
  return _size(set._tree);
}
github frptools / collectable / packages / sorted-set / src / functions / get.ts View on Github external
export function get (index: number, set: SortedSetStructure): T|undefined {
  var entry = keyAt(index, set._tree);
  return isUndefined(entry) ? void 0 : entry.value;
}

@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