1.0.11 • Published 2 years ago
node-imei-ts v1.0.11
node-imei
Description
imei generator/checker (via Luhn algorithm) forked from https://github.com/BadMachine/node-imei with minor changes made to make this package Typescript-compatible. Also added types definitions
Installation
$ npm install node-imei-tsUsage
var imei = require('node-imei-ts');
console.log(IMEI.random()); // returns string with random imei
console.log(IMEI.device("Apple","iPhone3G")); // returns string with imei by device TAC
console.log(IMEI.isValid("860921035123120")); // returns trueexport imei from 'node-imei-ts'
console.log(IMEI.random()); // returns string with random imei
console.log(IMEI.device("Apple","iPhone3G")); // returns string with imei by device TAC
console.log(IMEI.isValid("860921035123120")); // returns truerandom()
Returns a string with valid imei. Script makes string with 3 parts: 1st part is TAC (Type Allocation Code) 2nd part is random value from 100000 to 999999 3rd part is last digit(Luhn digit)
isValid(imei)
Returns a boolean value.
Also
codes.js contains json object with Type Allocation Codes.
If you want to extend the file
Just add new TACs in codes.js
More info and examples of TACs you can find at
wiki
or
OSMOCOM direct link to download TACs db in json