Skip to content

Commit 59d884d

Browse files
authored
Merge pull request #4 from The-Ticking-Clockwork/devel
Merge fix for Nim 2.2.0
2 parents 952412e + 62bb09c commit 59d884d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/nulid.nim

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ type
6060
ULIDGenerator* = ref object
6161
## A `ULID` generator object, contains details needed to follow the spec.
6262
## A generator was made to be compliant with the ULID spec and also to be
63-
## threadsafe not use globals that could change.
63+
## threadsafe.
6464
when NoLocks:
6565
lastTime: int64 # Timestamp of last ULID, 48 bits
6666
when not defined(js):
@@ -330,9 +330,12 @@ func `$`*(ulid: ULID): string =
330330
result = JsBigInt.encode(ulid.toInt128(), 26)
331331

332332
# std/json support
333-
proc `%`*(u: ULID): JsonNode = newJString($u)
333+
proc `%`*(u: ULID): JsonNode =
334+
## Serializes a `ULID` to JSON.
335+
newJString($u)
334336

335337
proc to*(j: JsonNode, _: typedesc[ULID]): ULID =
338+
## Deserializes a `ULID` from JSON.
336339
if j.kind != JString:
337340
raise newException(JsonKindError, "Expected a string!")
338341

0 commit comments

Comments
 (0)