ticket-code
ticket-code is generate ticket codes library for Node.js
Installation
$ npm install ticket-code
Usage
A simple checksum code is added to verify the generated code value. For this purpose, it is recommended to specify numerical seed value.
var ticketCode = var codeLength = 15 // optional (default 10)var checksumSeed = 5 // requiredvar checksumIdx = 7 // optional (default Math.floor(code length / 2)) var code = ticketCode // NPP3YHPEQMCY75W// ... ticketCode // trueticketCode // false
Test
Test with mocha
$ grunt
like watch
$ grunt watch
Contributing
Bug reports and pull requests are welcome on Github at https://github.com/egg-/ticket-code
- Fork it
- Create your feature branch.
- Commit your changes.
- Push to the branch.
- Create a new Pull Request.
License
ticket-code is licensed under the MIT license.