# node-imei-ts

> imei generator/checker fork from https://github.com/BadMachine/node-imei with added TS compatibility

Latest version **1.0.11** (published 2023-09-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install node-imei-ts
pnpm add node-imei-ts
yarn add node-imei-ts
bun add node-imei-ts
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2023-09-15 |
| First published | 2023-09-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ME |
| Maintainers | breakit |
| Keywords | imei, imeigen, imeicheck |

## Links

- npm: https://www.npmjs.com/package/node-imei-ts
- Repository: https://github.com/ToolSense/node-imei
- Homepage: https://github.com/ToolSense/node-imei#readme
- Issues: https://github.com/ToolSense/node-imei/issues
- npm.io page: https://npm.io/package/node-imei-ts

## Recent versions

- 1.0.11 (latest) — 2023-09-15
- 1.0.10 — 2023-09-15
- 1.0.9 — 2023-09-15
- 1.0.8 — 2023-09-15
- 1.0.7 — 2023-09-15
- 1.0.6 — 2023-09-15
- 1.0.5 — 2023-09-15
- 1.0.4 — 2023-09-15

## README

# node-imei
## Description
imei generator/checker (via Luhn algorithm) forked from [https://github.com/BadMachine/node-imei](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-ts
    
## Usage
``` javascript
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 true
```

``` typescript
export 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 true
```

### random()
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 TAC`s in codes.js
More info and examples of TAC`s you can find at 
[wiki](https://en.wikipedia.org/wiki/Type_Allocation_Code)
or
[OSMOCOM direct link to download TACs db in json](http://tacdb.osmocom.org/export/tacdb.json)

# License

  [MIT](LICENSE)

---
_Source: https://npm.io/package/node-imei-ts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
