Skip to content

KennethanCeyer/hashids-io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published