From 3ddedb4245eb7568d3ef87d73b0b8c198f65da15 Mon Sep 17 00:00:00 2001 From: Pau Rodriguez-Estivill Date: Mon, 3 Dec 2018 11:03:04 +0100 Subject: [PATCH] Add example in README --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 3f0f75e..28f25a8 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,17 @@ var id = hashids.encodeHex('507f1f77bcf86cd799439011'); // y42LW46J9luq3Xq9XMly var hex = hashids.decodeHex(id); // 507f1f77bcf86cd799439011 ``` +**Encode bigint numbers:** + +Useful if you want to encode [PostgreSQL](https://www.postgresql.org/)'s bigint. Note that currently pg javascript driver handles bigint as string since it's support is a current draft. + +```javascript +var hashids = new Hashids(); + +var id = hashids.encodeBI('50374626472636434472463271'); // ww2Vn9oypBtv1PZ2Rpp +var hex = hashids.decodeBI(id); // 50374626472636434472463271 +``` + Pitfalls -------