Skip to content

Commit 0a50a45

Browse files
committed
docs(snowflake): stripe like example
1 parent a8ffc0c commit 0a50a45

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/snowflake/examples/stripe-like.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/**
2+
* Stripe provides excellent documentation, and their use of human-readable IDs
3+
* makes it easier to identify resources at a glance.
4+
*
5+
* We can achieve similar readability by encoding our snowflake int64 IDs into Base62.
6+
*
7+
* For further reading, here's a great article by a Stripe developer:
8+
* https://dev.to/stripe/designing-apis-for-humans-object-ids-3o5a/comments
9+
*/
10+
111
import { Snowflake } from '@andrew_l/snowflake';
212
import { base62, bigIntFromBytes } from '@andrew_l/toolkit';
313

0 commit comments

Comments
 (0)