~statianzo/janet-nanoid

34a82b9a606f9a55707aaeb1df5eb2fbae6115a5 — Jason Staten 2 years ago 78afc84
docs and stats
2 files changed, 11 insertions(+), 5 deletions(-)

M README.md
M nanoid.janet
M README.md => README.md +2 -0
@@ 46,3 46,5 @@ secure random bytes.
(nanoid/gen-non-secure :size 5)
# "vWgzu"
```

![goatcounter](https://janet-nanoid.goatcounter.com/count?p=/README.md)

M nanoid.janet => nanoid.janet +9 -5
@@ 4,8 4,10 @@

(def- masks [15 31 63 127 255])

(defn gen [&keys {:size size
                  :alphabet alphabet}] 
(defn gen
  "Generate secure random ID. Default size of 21."
  [&keys {:size size
          :alphabet alphabet}]
  (default size 21)
  (default alphabet DEFAULT_ALPHABET)



@@ 24,9 26,11 @@
    (string/from-bytes ;result)))


(defn gen-non-secure [&keys {:size size
                             :alphabet alphabet
                             :rng rng}]
(defn gen-non-secure
  "Generate pseudorandom ID. Default size of 21."
  [&keys {:size size
          :alphabet alphabet
          :rng rng}]
  (default size 21)
  (default alphabet DEFAULT_ALPHABET)
  (default rng DEFAULT_RNG)