![License](https://img.shields.io/github/license/mikeu/mmsi.js)
mmsi.js
A javascript library for parsing MMSI numbers (Maritime Mobile Service Identities) to validate format and extract
information such as country or other jurisdiction of registration.
About
From Wikipedia:
A Maritime Mobile Service Identity (MMSI) is a series of nine digits which are sent in digital form
over a radio frequency channel in order to uniquely identify ship stations, ship earth stations,
coast stations, coast earth stations, and group calls.
With mmsi.js you can determine whether a given number or string is in the format of a valid MMSI and,
if so, extract the
Maritime Identification Digits
from it, along with the corresponding country name and code.
Note that this library makes no attempt to verify that a given MMSI is actually in active use, or registered to a real vessel.
Installation
npm install mmsi.js
Usage
import { MMSI } from 'mmsi.js';
const mmsi = new MMSI(1234567890);
console.log(mmsi.isValid);
mmsi.identity = "ABCDEFGHI";
console.log(mmsi.isValid);
mmsi.identity = 123;
console.log(mmsi.isValid);
console.log(mmsi.formatted);
mmsi.identity = "410123456";
console.log(mmsi.midCode);
const jurisdiction = mmsi.jurisdiction;
console.log(jurisdiction.code);
console.log(jurisdiction.name);
console.log(jurisdiction.fullName);
License
This project is licensed under the MIT License - see the
LICENSE
file for details.