Compare commits

..

No commits in common. "main" and "v1.3.0" have entirely different histories.
main ... v1.3.0

3 changed files with 6 additions and 11 deletions

View file

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

View file

@ -1,6 +1,6 @@
# Package
version = "1.3.1"
version = "1.3.0"
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 >= 2.0.0"
requires "crockfordb32 >= 1.1.0"

View file

@ -1,5 +1,3 @@
{.define: crockfordb32NintSupport.}
import std/[
times,
json
@ -60,7 +58,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.
## threadsafe not use globals that could change.
when NoLocks:
lastTime: int64 # Timestamp of last ULID, 48 bits
when not defined(js):
@ -330,12 +328,9 @@ func `$`*(ulid: ULID): string =
result = JsBigInt.encode(ulid.toInt128(), 26)
# std/json support
proc `%`*(u: ULID): JsonNode =
## Serializes a `ULID` to JSON.
newJString($u)
proc `%`*(u: ULID): JsonNode = newJString($u)
proc to*(j: JsonNode, _: typedesc[ULID]): ULID =
## Deserializes a `ULID` from JSON.
if j.kind != JString:
raise newException(JsonKindError, "Expected a string!")