From e371d217f4e69f578bdf1a27df17a8317734c0eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20G=C3=B6ransson?= Date: Thu, 27 Aug 2026 23:50:23 +0200 Subject: [PATCH] Say what the objectid category actually is, and re-flow the registry comment --- README.md | 6 +++--- builtins.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a1342f5..216fa3b 100644 --- a/README.md +++ b/README.md @@ -178,9 +178,9 @@ Swedish personnummer): `address`, `color`, `company`, `date`, `email`, `ip`, `data/misc` carries locale-neutral categories — universal data that isn't tied to a language or region: -- ids & networking: `uuid` (a proper random v4), `mac`, `objectid` (MongoDB - ObjectID, 24 hex chars), `creditcard` (per-network numbers ending in a valid - `{luhn()}` digit) +- ids & networking: `uuid` (a proper random v4), `mac`, `objectid` (24 hex chars, + MongoDB ObjectID-shaped — the leading bytes are random, not a real timestamp), + `creditcard` (per-network numbers ending in a valid `{luhn()}` digit) - reference codes: `currency` (ISO 4217), `country` (ISO 3166), `language` (ISO 639), `timezone` (IANA) - web & systems: `mimetype`, `httpstatus`, `useragent` diff --git a/builtins.go b/builtins.go index c0d3aa5..a26405a 100644 --- a/builtins.go +++ b/builtins.go @@ -20,9 +20,9 @@ const ( // the digits emitted so far in the current expansion (luhn, mod11, ean — place // them after their payload); generators read only the rng (uuid, ulid, ...). All // must stay pure over (rng, emitted, args) so a seeded faker is reproducible — a -// time-based id (uuid v7, ulid) draws its timestamp from the rng, not -// the wall clock. Add a builtin only for what data can't express: a random v4 -// UUID already ships as data (data/misc/uuid.json), so the builtin is v7. +// time-based id (uuid v7, ulid) draws its timestamp from the rng, not the wall +// clock. Add a builtin only for what data can't express: a random v4 UUID and a +// 24-hex ObjectID both ship as data, so the uuid builtin is v7. var builtins = map[string]builtin{ "luhn": {arity: 0, call: func(_ *session, e string, _ map[string]node, _ []string) string { return string(rune('0' + luhnCheck(e)))