import { serial } from "https://deno.land/x/ayonli_jsext@v0.9.72/number/index.ts";
Creates a generator that produces sequential numbers from 1
to
Number.MAX_SAFE_INTEGER
, useful for generating unique IDs.
Examples
Example 1
Example 1
import { serial } from "@ayonli/jsext/number";
const idGenerator = serial();
console.log(idGenerator.next().value); // 1
console.log(idGenerator.next().value); // 2
console.log(idGenerator.next().value); // 3