Merge pull request #22515 from gatimus/add-provinces

add provinces package
This commit is contained in:
Paul van Brenk
2017-12-28 10:58:03 -08:00
committed by GitHub
4 changed files with 81 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
// Type definitions for provinces 1.11
// Project: https://github.com/substack/provinces
// Definitions by: My Self <https://github.com/gatimus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare global {
/**
* @see {@link https://github.com/substack/provinces#data-format}
*/
interface Province {
/**
* full name of the province or state
*/
name: string;
/**
* country abbreviation
*/
country: string;
/**
* optional 2 or 3 character short name
*/
short?: string;
/**
* optional array of additional names and abbreviations
*/
alt?: string[];
/**
* optional region of a country (for example: "Wales")
*/
region?: string;
}
}
/**
* @see {@link https://github.com/substack/provinces#methods}
*/
declare const provinces: Province[];
export = provinces;
+16
View File
@@ -0,0 +1,16 @@
import * as provinces from 'provinces';
provinces.forEach((province: Province) => {
// https://github.com/substack/provinces#data-format
let name: string;
let country: string;
let short: string;
let alt: string[];
let region: string;
name = province.name;
country = province.country;
short = province.short ? province.short : '';
alt = province.alt ? province.alt : [];
region = province.region ? province.region : '';
});
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"provinces-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}