vinkla/hashids

Negative numbers

joshbruce opened this issue · 2 comments

Hey, long time user, first time poster.

Curious if there are any plans to support negative ids?

It's an odd use case and not something I can't get around, but would be nice to get hashes from either side of zero to divide a larger set of things.

Thanks. Appreciate the library.

jd327 commented

@joshbruce Sorry for the late reply. There's no plans atm to support negative numbers. However, you could abstract by prepending your own designated number, like [1, 2, -3] could become [1, 2, 0, 3]. Of course there are other downsides to that.

Thanks @ivanakimov, appreciate that alternative. I figured out an alternative to ultimately hit the same goal.