CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-ulid

tessl install tessl/npm-ulid@3.0.0

A universally-unique, lexicographically-sortable, identifier generator

Agent Success

Agent success rate when using this tile

78%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.34x

Baseline

Agent success rate without this tile

58%

task.mdevals/scenario-1/

Sequential Base32 ID Generator

Build a generator that produces sequential Base32-encoded identifiers. The generator should start from a given Base32 string and produce subsequent identifiers in order.

Requirements

Your implementation should:

  1. Accept an initial Base32-encoded string as a starting point
  2. Generate the next identifier in sequence each time it's called
  3. Handle carry-over correctly when incrementing (e.g., 'Z' wraps to '0' and carries to the next position)
  4. Use Crockford's Base32 encoding

Test Cases

  • Starting with "0000", calling next() three times produces "0001", "0002", "0003" @test
  • Starting with "000Z", calling next() produces "0010" (handles carry-over correctly) @test
  • Starting with "ZZZY", calling next() produces "ZZZZ" (simple increment) @test

Implementation

@generates

API

/**
 * Creates a sequential Base32 identifier generator
 * @param initial - Starting Base32 string
 * @returns Generator function that produces the next identifier
 * @throws Error if initial string contains invalid Base32 characters
 */
export function createSequentialGenerator(initial: string): () => string;

Dependencies { .dependencies }

ulid { .dependency }

Provides Base32 manipulation utilities for identifier generation.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/ulid@3.0.x
tile.json