tessl install tessl/npm-ulid@3.0.0A 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%
Build a utility that converts Unix timestamps (in milliseconds) into lexicographically sortable string representations. This is useful for creating time-based identifiers that maintain natural sort order.
Your implementation should:
Create a module that exports a function to encode timestamps. The function should:
The following test cases should pass:
@generates
/**
* Encodes a timestamp into a lexicographically sortable string representation.
*
* @param timestamp - The timestamp in milliseconds to encode
* @param length - The desired length of the encoded string (default: 10)
* @returns A string representation of the timestamp
* @throws Error if the timestamp is invalid (negative, NaN, or too large)
*/
export function encodeTimestamp(timestamp: number, length?: number): string;Provides unique identifier generation with lexicographic sorting capabilities.
@satisfied-by