How to use the @lumino/algorithm.StringExt.cmp function in @lumino/algorithm

To help you get started, we’ve selected a few @lumino/algorithm 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 jupyterlab / lumino / packages / datastore / src / textfield.ts View on Github external
// in the cemetery and continue processing ids.
      if (j === metadata.ids.length || metadata.ids[j] !== ids[i]) {
        let count = metadata.cemetery[ids[i]] || 0;
        metadata.cemetery[ids[i]] = count + 1;
        i++
        continue;
      }

      // Set up the chunk index.
      let index = j;

      // Set up the chunk count.
      let count = 0;

      // Find the extent of the chunk.
      while (i < n && StringExt.cmp(ids[i], metadata.ids[j]) === 0) {
        count++;
        i++;
        j++;
      }

      // Add the chunk to the chunks array, or bump the id index.
      if (count > 0) {
        chunks.push({ index, count });
      } else {
        i++;
      }
    }

    // Return the computed chunks.
    return chunks;
  }
github jupyterlab / lumino / packages / datastore / src / listfield.ts View on Github external
// in the cemetery and continue processing ids.
      if (j === metadata.ids.length || metadata.ids[j] !== ids[i]) {
        let count = metadata.cemetery[ids[i]] || 0;
        metadata.cemetery[ids[i]] = count + 1;
        i++;
        continue;
      }

      // Set up the chunk index.
      let index = j;

      // Set up the chunk count.
      let count = 0;

      // Find the extent of the chunk.
      while (i < n && StringExt.cmp(ids[i], metadata.ids[j]) === 0) {
        count++;
        i++;
        j++;
      }

      // Add the chunk to the chunks array, or bump the id index.
      if (count > 0) {
        chunks.push({ index, count });
      } else {
        i++;
      }
    }

    // Return the computed chunks.
    return chunks;
  }
github jupyterlab / lumino / packages / datastore / src / table.ts View on Github external
function recordIdCmp<s>(record: Record<s>, id: string): number {
    return StringExt.cmp(record.$id, id);
  }
</s></s>
github jupyterlab / lumino / packages / datastore / src / table.ts View on Github external
function recordCmp<s>(a: Record<s>, b: Record<s>): number {
    return StringExt.cmp(a.$id, b.$id);
  }
</s></s></s>
github jupyterlab / lumino / packages / datastore / src / datastore.ts View on Github external
function recordCmp<s>(a: Table<s>, b: Table<s>): number {
    return StringExt.cmp(a.schema.id, b.schema.id);
  }
</s></s></s>
github jupyterlab / lumino / packages / datastore / src / datastore.ts View on Github external
function recordIdCmp<s>(table: Table<s>, id: string): number {
    return StringExt.cmp(table.schema.id, id);
  }
</s></s>