is-pandigital
Test if a number is pandigital: made up of the digits 1-9, once each
Install
$ npm install is-pandigital
var isPandigital = require('is-pandigital');
Usage
console.log(isPandigital(192384576));
console.log(isPandigital(918273645));
console.log(isPandigital(9136485234));
console.log(isPandigital(9183645));
Optionally, pass in a second number to specify a base (defaults to 9):
console.log(isPandigital(1234, 4));
console.log(isPandigital(425631, 6));
console.log(isPandigital(918273645, 2));
Tests
To run the test suite, first install the dependencies, then run npm test
:
$ npm install
$ npm test
To test code coverage:
$ npm run cover