Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

hashids

License Build Status

What is hashids-io

hashid-io is an implementation of hashids for io language.

this libary can be helped to get a unique string from the number.

Getting Started

Install from Git

$ git clone https://github.com/KennethanCeyer/hashids-io.git

Quick example

# get hashids object
h := hashids()

# encode
id := h encode(1, 2, 3, 4)
id println # v2fWhzi1

# also you can packing param numbers (salt sugaring)
id := h encode(list(1, 2, 3, 4))
id println # v2fWhzi1

# decode
numbers := h decode(id)
numbers println # list(1, 2, 3, 4)

Advanced example

encode/decode with salt

salt := "this is my salt key"
h := hashids(salt)

# encode
id := h encode(1, 2, 3, 4)
id println # zZHmu0hB

# decode
numbers := h decode(id)
numbers println # list(1, 2, 3, 4)

encode/decode with minLength padding

h := hashids(nil, 8)

# encode
id := h encode(1, 2, 3, 4)
id println #v2fWhzi1

# decode
numbers := h decode(id)
numbers println # list(1, 2, 3, 4)

Test

hashid-io supports the unit test using by jasmine.

# test using shell
$ sh ./run_test.sh

License

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


MIT License. See the LICENSE file. You can use Hashids in open source projects and commercial products. Don't break the Internet. Kthxbye.

About

👻 the implementation of hashids for io lang.

Topics

Resources

License

Releases

No releases published

Packages

No packages published