* Return a string representing the specified number. * * @param {Number} num The number to convert. * @returns {String} The string representation of the number. * @api public
(num)
| 4549 | * @api public |
| 4550 | */ |
| 4551 | function encode(num) { |
| 4552 | var encoded = ''; |
| 4553 | |
| 4554 | do { |
| 4555 | encoded = alphabet[num % length] + encoded; |
| 4556 | num = Math.floor(num / length); |
| 4557 | } while (num > 0); |
| 4558 | |
| 4559 | return encoded; |
| 4560 | } |
| 4561 | |
| 4562 | /** |
| 4563 | * Return the integer value specified by the given string. |