https://github.com/linhub15/short-guid
Typescript port of CSharpVitamins.ShortGuid
https://github.com/linhub15/short-guid
deno typescript
Last synced: 2 months ago
JSON representation
Typescript port of CSharpVitamins.ShortGuid
- Host: GitHub
- URL: https://github.com/linhub15/short-guid
- Owner: linhub15
- Created: 2022-08-08T15:51:26.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-11-20T17:21:26.000Z (over 2 years ago)
- Last Synced: 2025-02-22T03:15:45.173Z (over 1 year ago)
- Topics: deno, typescript
- Language: TypeScript
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Typescript port of CSharpVitamins.ShortGuid
C# Equivalent
Use this if you need to generate ShortGuids in JS and want to convert
them back to `Guid` using CSharpVitamins.ShortGuid.
Can only be used with Deno for now.
### Usage - Deno
```typescript
import { decode, encode } from "https://raw.githubusercontent.com/linhub15/short-guid/main/mod.ts";
console.log(encode()); // 00amyWGct0y_ze4lIsj2Mw
console.log(decode(shortGuid)); // "c9a646d3-9c61-4cb7-bfcd-ee2522c8f633"
```
### Tests
`deno test`
### Benchmarks
`deno bench`
```
cpu: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz
runtime: deno 1.28.3 (x86_64-unknown-linux-gnu)
benchmark time (avg) (min … max) p75 p99 p995
------------------------------------------------- -----------------------------
encode() 6.18 µs/iter (6.01 µs … 6.66 µs) 6.25 µs 6.66 µs 6.66 µs
decode() 1.42 µs/iter (1.37 µs … 1.62 µs) 1.42 µs 1.62 µs 1.62 µs
```