e118-iin-list
Advanced tools
Comparing version 1.7.0 to 2.0.0
#!/usr/bin/env node | ||
const { identifyIssuer } = require('./') | ||
const { isSome } = require('fp-ts/lib/Option') | ||
import { identifyIssuer } from './dist/identifyIssuer.js' | ||
@@ -9,8 +8,8 @@ const iccid = process.argv[process.argv.length - 1] | ||
const issuer = identifyIssuer(iccid) | ||
if (isSome(issuer)) { | ||
console.log(JSON.stringify(issuer.value, null, 2)) | ||
if (issuer !== undefined) { | ||
console.log(JSON.stringify(issuer, null, 2)) | ||
} else { | ||
console.error(`The vendor of your ICCID "${iccid}" could not be identified!`) | ||
console.error( | ||
`Please open a new issue by following this link: https://github.com/cellprobe/e118-iin-list/issues/new?title=${encodeURIComponent( | ||
`Please open a new issue by following this link: https://github.com/NordicSemiconductor/e118-iin-list-js/issues/new?title=${encodeURIComponent( | ||
`Could not identify ICCID ${iccid.replace(/.{6}$/, 'XXXXXX')}`, | ||
@@ -17,0 +16,0 @@ )}&body=${encodeURIComponent( |
@@ -1,7 +0,5 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const csv = require("csv-parser"); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const prettier = require("prettier"); | ||
import csv from 'csv-parser'; | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import * as prettier from 'prettier'; | ||
const results = []; | ||
@@ -50,3 +48,3 @@ const target = path.join(process.cwd(), 'src', 'list.ts'); | ||
`/* Auto-generated file. Do not change! */`, | ||
`import {IssuerList} from './types';`, | ||
`import type { IssuerList } from './types';`, | ||
`export const iinRegEx = /^89(${Object.keys(list).join('|')})/;`, | ||
@@ -53,0 +51,0 @@ `export const e118IINList: IssuerList = ${JSON.stringify(list, null, 2)} as const;`, |
@@ -1,3 +0,2 @@ | ||
import { Option } from 'fp-ts/lib/Option'; | ||
import { Issuer } from './types'; | ||
export declare const identifyIssuer: (iccid: string) => Option<Issuer>; | ||
import type { Issuer } from './types'; | ||
export declare const identifyIssuer: (iccid: string) => Issuer | undefined; |
@@ -1,12 +0,8 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.identifyIssuer = void 0; | ||
const Option_1 = require("fp-ts/lib/Option"); | ||
const list_1 = require("./list"); | ||
exports.identifyIssuer = (iccid) => { | ||
const iinMatch = list_1.iinRegEx.exec(iccid); | ||
import { iinRegEx, e118IINList } from './list.js'; | ||
export const identifyIssuer = (iccid) => { | ||
const iinMatch = iinRegEx.exec(iccid); | ||
if (!iinMatch) | ||
return Option_1.none; | ||
const issuer = list_1.e118IINList[iinMatch[1]]; | ||
return Option_1.some({ | ||
return undefined; | ||
const issuer = e118IINList[iinMatch[1]]; | ||
return { | ||
iin: issuer[0], | ||
@@ -18,3 +14,3 @@ issuerIdentifierNumber: issuer[1], | ||
...(issuer[5].length && { companyURLs: issuer[5] }), | ||
}); | ||
}; | ||
}; |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const Option_1 = require("fp-ts/lib/Option"); | ||
const identifyIssuer_1 = require("./identifyIssuer"); | ||
import { identifyIssuer } from './identifyIssuer'; | ||
describe('identifyIssuer', () => { | ||
@@ -9,3 +6,3 @@ it.each([ | ||
'89450421180216254864', | ||
Option_1.some({ | ||
{ | ||
iin: 894504, | ||
@@ -16,7 +13,7 @@ countryCode: 45, | ||
companyName: 'Telia Sonera A/S', | ||
}), | ||
}, | ||
], | ||
[ | ||
'8931089318104284409F', | ||
Option_1.some({ | ||
{ | ||
companyName: 'KPN Telecom B.V., Card Services', | ||
@@ -27,7 +24,7 @@ countryCode: 31, | ||
issuerIdentifierNumber: '08', | ||
}), | ||
}, | ||
], | ||
[ | ||
'89882806660004909182', | ||
Option_1.some({ | ||
{ | ||
iin: 8988280, | ||
@@ -39,12 +36,12 @@ countryCode: 882, | ||
companyURLs: ['http://1nce.com'], | ||
}), | ||
}, | ||
], | ||
])('should identify the issuer', (iccid, issuer) => { | ||
expect(identifyIssuer_1.identifyIssuer(iccid)).toEqual(issuer); | ||
expect(identifyIssuer(iccid)).toEqual(issuer); | ||
}); | ||
it('should not identify unknown issuers', () => { | ||
expect(identifyIssuer_1.identifyIssuer('123456')).toEqual(Option_1.none); | ||
expect(identifyIssuer('123456')).toBeUndefined(); | ||
}); | ||
it('should identify US issuers which use leading 0', () => { | ||
expect(identifyIssuer_1.identifyIssuer('8901260866666666666F')).toEqual(Option_1.some({ | ||
expect(identifyIssuer('8901260866666666666F')).toEqual({ | ||
iin: 891260, | ||
@@ -56,6 +53,6 @@ countryCode: 1, | ||
companyURLs: ['http://t-mobile.com'], | ||
})); | ||
}); | ||
}); | ||
it('should identify US issuers without leading 0', () => { | ||
expect(identifyIssuer_1.identifyIssuer('891260866666666666F')).toEqual(Option_1.some({ | ||
expect(identifyIssuer('891260866666666666F')).toEqual({ | ||
iin: 891260, | ||
@@ -67,4 +64,4 @@ countryCode: 1, | ||
companyURLs: ['http://t-mobile.com'], | ||
})); | ||
}); | ||
}); | ||
}); |
@@ -1,3 +0,2 @@ | ||
export * from './list'; | ||
export * from './types'; | ||
export * from './identifyIssuer'; | ||
export * from './identifyIssuer.js'; | ||
export * from './list.js'; |
@@ -1,15 +0,2 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./list"), exports); | ||
__exportStar(require("./types"), exports); | ||
__exportStar(require("./identifyIssuer"), exports); | ||
export * from './identifyIssuer.js'; | ||
export * from './list.js'; |
@@ -1,3 +0,3 @@ | ||
import { IssuerList } from './types'; | ||
import type { IssuerList } from './types'; | ||
export declare const iinRegEx: RegExp; | ||
export declare const e118IINList: IssuerList; |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; |
{ | ||
"name": "e118-iin-list", | ||
"version": "1.7.0", | ||
"version": "2.0.0", | ||
"description": "List of issuer identifier numbers for the international telecommunication charge card (ITU-T E.118)", | ||
"main": "dist/index.js", | ||
"type": "module", | ||
"typings": "dist/index.d.ts", | ||
"bin": "cli.js", | ||
"exports": { | ||
"import": "./dist/index.js" | ||
}, | ||
"scripts": { | ||
"test": "jest", | ||
"convert": "node dist/convert.js" | ||
"convert": "node dist/convert.js", | ||
"_postinstall": "husky install", | ||
"prepublishOnly": "pinst --disable", | ||
"postpublish": "pinst --enable" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/cellprobe/e118-iin-list.git" | ||
"url": "git+https://github.com/NordicSemiconductor/e118-iin-list-js.git" | ||
}, | ||
"keywords": [ | ||
"cellprobe", | ||
"e.118", | ||
"nrf-asset-tracker", | ||
"e118", | ||
"ITU-T", | ||
@@ -27,27 +33,16 @@ "IIN", | ||
"bugs": { | ||
"url": "https://github.com/cellprobe/e118-iin-list/issues" | ||
"url": "https://github.com/NordicSemiconductor/e118-iin-list-js/issues" | ||
}, | ||
"homepage": "https://github.com/cellprobe/e118-iin-list#readme", | ||
"dependencies": { | ||
"fp-ts": "^2.6.6" | ||
}, | ||
"homepage": "https://github.com/NordicSemiconductor/e118-iin-list-js#readme", | ||
"devDependencies": { | ||
"@bifravst/code-style": "^8.0.3", | ||
"@commitlint/cli": "^9.0.1", | ||
"@commitlint/config-angular": "^9.0.1", | ||
"@types/aws-sdk": "^2.7.0", | ||
"@types/jest": "^26.0.3", | ||
"@types/node": "^14.0.14", | ||
"csv-parser": "^2.3.3", | ||
"husky": "^4.2.5", | ||
"jest": "^26.1.0", | ||
"ts-jest": "^26.1.1", | ||
"typescript": "^3.9.5" | ||
"@commitlint/cli": "16.1.0", | ||
"@commitlint/config-angular": "16.0.0", | ||
"@nordicsemiconductor/asset-tracker-cloud-code-style": "11.0.19", | ||
"@types/jest": "27.4.0", | ||
"@types/node": "17.0.14", | ||
"csv-parser": "3.0.0", | ||
"jest": "27.4.7", | ||
"ts-jest": "27.1.3", | ||
"typescript": "4.5.5" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"commit-msg": "commitlint -e", | ||
"pre-commit": "lint-staged && npx jest --onlyChanged" | ||
} | ||
}, | ||
"lint-staged": { | ||
@@ -63,4 +58,4 @@ "*.ts": [ | ||
"engines": { | ||
"node": ">=14.0.0", | ||
"npm": ">=6.0.0" | ||
"node": ">=16", | ||
"npm": ">=8" | ||
}, | ||
@@ -85,19 +80,14 @@ "release": { | ||
"jest": { | ||
"testURL": "http://localhost", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js", | ||
"json" | ||
], | ||
"transform": { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
"testRegex": ".+\\.spec\\.ts$", | ||
"preset": "ts-jest/presets/default-esm", | ||
"globals": { | ||
"ts-jest": { | ||
"diagnostics": true | ||
"useESM": true | ||
} | ||
} | ||
} | ||
}, | ||
"moduleNameMapper": { | ||
"^(\\.{1,2}/.*)\\.js$": "$1" | ||
}, | ||
"testRegex": ".+\\.spec\\.ts$" | ||
}, | ||
"prettier": "@nordicsemiconductor/asset-tracker-cloud-code-style/.prettierrc" | ||
} |
# e118-iin-list [![npm version](https://img.shields.io/npm/v/e118-iin-list.svg)](https://www.npmjs.com/package/e118-iin-list) | ||
[![GitHub Actions](https://github.com/cellprobe/e118-iin-list/workflows/Test%20and%20Release/badge.svg)](https://github.com/cellprobe/e118-iin-list/actions) | ||
[![Mergify Status](https://img.shields.io/endpoint.svg?url=https://dashboard.mergify.io/badges/cellprobe/e118-iin-list&style=flat)](https://mergify.io) | ||
[![GitHub Actions](https://github.com/NordicSemiconductor/e118-iin-list-js/workflows/Test%20and%20Release/badge.svg)](https://github.com/NordicSemiconductor/e118-iin-list-js/actions) | ||
[![Mergify Status](https://img.shields.io/endpoint.svg?url=https://dashboard.mergify.io/badges/NordicSemiconductor/e118-iin-list-js&style=flat)](https://mergify.io) | ||
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) | ||
@@ -40,7 +40,6 @@ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) | ||
import { identifyIssuer } from "e118-iin-list"; | ||
import { isSome } from "fp-ts/lib/Option"; | ||
const issuer = identifyIssuer("89450421180216254864"); | ||
if (isSome(issuer)) { | ||
console.log(issuer.value.companyName); // Telia Sonera A/S | ||
if (issuer !== undefined) { | ||
console.log(issuer.companyName); // Telia Sonera A/S | ||
} | ||
@@ -63,3 +62,3 @@ ``` | ||
> _Note:_ if your ICCID is not recognized, please open a new issue | ||
> [in this repository](https://github.com/cellprobe/e118-iin-list/issues/new). | ||
> [in this repository](https://github.com/NordicSemiconductor/e118-iin-list-js/issues/new). | ||
@@ -66,0 +65,0 @@ ## ITU-T Recommendation E.118 Card numbering structure ([Source](https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-E.118-200605-I!!PDF-E&type=items)) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
9
0
0
Yes
284343
17
6897
110
1
- Removedfp-ts@^2.6.6
- Removedfp-ts@2.16.9(transitive)