Skip to content

Instantly share code, notes, and snippets.

@joetannenbaum
Created February 6, 2017 17:25
Show Gist options
  • Save joetannenbaum/88957fda88cbea543718cb5e43a8c4e2 to your computer and use it in GitHub Desktop.
Save joetannenbaum/88957fda88cbea543718cb5e43a8c4e2 to your computer and use it in GitHub Desktop.
import Hashids from 'hashids'
class HashIds {
evaluate() {
const hasher = new Hashids(this.salt, this.padding)
return hasher.encode(this.id)
}
}
HashIds.identifier = 'shop.sammich.HashIds'
HashIds.title = 'Hash IDs'
HashIds.inputs = [
InputField('id', 'ID', 'Number'),
InputField('padding', 'Padding', 'Number', {
persist: true,
defaultValue: 10,
}),
InputField('salt', 'Salt', 'String', {
persist: true,
defaultValue: 'salty',
}),
]
registerDynamicValueClass(HashIds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment