iso-by-coords
TypeScript icon, indicating that this package has built-in type declarations

2.0.3 • Public • Published

iso-by-coords

npm NPM David

Usage

TypeScript

import configureCountryIso from 'iso-by-coords';
import {CountryISO} from 'iso-by-coords/lib/typings';
import getMap from 'countries-maritime-10m-extended';
 
const {getIsoCodes: getIsoCodesAlpha2} = configureCountryIso({
    iso: CountryISO.ALPHA_2,
    map: getMap()
});
 
const {getIsoCodes: getIsoCodesAlpha3} = configureCountryIso({
    iso: CountryISO.ALPHA_3,
    map: getMap()
});
 
getIsoCodesAlpha2(50.95148037338329, 5.350969164113395); // returns  [BE]
getIsoCodesAlpha3(50.95148037338329, 5.350969164113395); // returns [BEL]

JavaScript

const configureCountryIso = require('iso-by-coords').default;
const getMap = require('countries-maritime-10m-extended');
 
const {getIsoCodes: getIsoCodesAlpha2} = configureCountryIso({
    iso: 'A2',
    map: getMap()
});
 
const {getIsoCodes: getIsoCodesAlpha3} = configureCountryIso({
    iso: 'A3',
    map: getMap()
});
 
getIsoCodesAlpha2(50.95148037338329, 5.350969164113395); // returns  [BE]
getIsoCodesAlpha3(50.95148037338329, 5.350969164113395); // returns [BEL]

Package Sidebar

Install

npm i iso-by-coords

Weekly Downloads

51

Version

2.0.3

License

MIT

Unpacked Size

7.1 kB

Total Files

9

Last publish

Collaborators

  • niisama