Compare commits

..

4 commits
v1.3.0 ... main

Author SHA1 Message Date
Luyten Orion 59d884d18f
Merge pull request #4 from The-Ticking-Clockwork/devel
Merge fix for Nim 2.2.0
2025-02-19 18:29:22 +00:00
Luyten-Orion 62bb09c7f0 Update dependencies (and fix Nim 2.2.0) 2025-02-19 18:26:46 +00:00
Luyten-Orion 952412e5f5 Update dependencies (and fix Nim 2.2.0) 2025-02-19 18:05:16 +00:00
Yu-Vitaqua-fer-Chronos a5d234e0c2 Doc edits 2024-01-25 21:57:01 +00:00
3 changed files with 11 additions and 6 deletions

View file

@ -47,10 +47,10 @@ jobs:
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.deploy-dir }}
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4

View file

@ -1,6 +1,6 @@
# Package
version = "1.3.0"
version = "1.3.1"
author = "Yu Vitaqua fer Chronos"
description = "An implementation of ULID!"
license = "CC0"
@ -11,4 +11,4 @@ srcDir = "src"
requires "nim >= 2.0.0"
requires "nint128 >= 0.3.2"
requires "crockfordb32 >= 1.1.0"
requires "crockfordb32 >= 2.0.0"

View file

@ -1,3 +1,5 @@
{.define: crockfordb32NintSupport.}
import std/[
times,
json
@ -58,7 +60,7 @@ type
ULIDGenerator* = ref object
## A `ULID` generator object, contains details needed to follow the spec.
## A generator was made to be compliant with the ULID spec and also to be
## threadsafe not use globals that could change.
## threadsafe.
when NoLocks:
lastTime: int64 # Timestamp of last ULID, 48 bits
when not defined(js):
@ -328,9 +330,12 @@ func `$`*(ulid: ULID): string =
result = JsBigInt.encode(ulid.toInt128(), 26)
# std/json support
proc `%`*(u: ULID): JsonNode = newJString($u)
proc `%`*(u: ULID): JsonNode =
## Serializes a `ULID` to JSON.
newJString($u)
proc to*(j: JsonNode, _: typedesc[ULID]): ULID =
## Deserializes a `ULID` from JSON.
if j.kind != JString:
raise newException(JsonKindError, "Expected a string!")