Merge remote-tracking branch 'upstream/types-2.0' into types-2.0

This commit is contained in:
Lukas Zech
2016-11-15 10:39:24 +01:00
7 changed files with 93 additions and 34 deletions
+10
View File
@@ -15,11 +15,21 @@ declare namespace libphonenumber {
interface PhoneNumber {
}
export module PhoneNumberUtil {
export enum ValidationResult {
IS_POSSIBLE,
INVALID_COUNTRY_CODE,
TOO_SHORT,
TOO_LONG
}
}
export class PhoneNumberUtil {
static getInstance(): PhoneNumberUtil
parse(number: string, region: string): PhoneNumber;
isValidNumber(phoneNumber: PhoneNumber): boolean;
isPossibleNumber(phoneNumber: PhoneNumber): boolean;
isPossibleNumberWithReason(phoneNumber: PhoneNumber): PhoneNumberUtil.ValidationResult;
isValidNumberForRegion(phoneNumber: PhoneNumber, region: string): boolean;
getRegionCodeForNumber(phoneNumber: PhoneNumber): string;
isNANPACountry(regionCode: string): boolean;
+7
View File
@@ -0,0 +1,7 @@
// Type definitions for keymirror 0.1.1
// Project: https://github.com/STRML/keyMirror
// Definitions by: Johannes Fahrenkrug <https://github.com/jfahrenkrug>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function KeyMirror(obj: {}): { [key: string]: string };
export = KeyMirror;
+3
View File
@@ -0,0 +1,3 @@
import keyMirror = require('keymirror');
keyMirror({key1: null, key2: null});
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"keymirror-tests.ts"
]
}
+5 -29
View File
@@ -9,7 +9,7 @@ export = xml2js;
declare namespace xml2js {
function parseString(xml: string, callback: (err: any, result: any) => void): void;
function parseString(xml: string, options: Options, callback: (err: any, result: any) => void): void;
function parseString(xml: string, options: OptionsV2, callback: (err: any, result: any) => void): void;
var defaults: {
'0.1': Options;
@@ -17,41 +17,15 @@ declare namespace xml2js {
}
class Builder {
constructor(options?: BuilderOptions);
constructor(options?: OptionsV2);
buildObject(rootObj: any): string;
}
class Parser {
constructor(options?: Options);
processAsync(): any;
assignOrPush(obj: any, key: string, newValue: any): any;
reset(): any;
constructor(options?: OptionsV2);
parseString(str: string, cb?: Function): void;
}
interface RenderOptions {
indent?: string;
newline?: string;
pretty?: boolean;
}
interface XMLDeclarationOptions {
encoding?: string;
standalone?: boolean;
version?: string;
}
interface BuilderOptions {
doctype?: any;
headless?: boolean;
indent?: string;
newline?: string;
pretty?: boolean;
renderOpts?: RenderOptions;
rootName?: string;
xmldec?: XMLDeclarationOptions;
}
interface Options {
async?: boolean;
attrkey?: string;
@@ -66,6 +40,7 @@ declare namespace xml2js {
explicitChildren?: boolean;
explicitRoot?: boolean;
ignoreAttrs?: boolean;
includeWhiteChars?: boolean;
mergeAttrs?: boolean;
normalize?: boolean;
normalizeTags?: boolean;
@@ -96,3 +71,4 @@ declare namespace xml2js {
cdata?: boolean;
}
}
+2 -2
View File
@@ -3,7 +3,7 @@
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -16,4 +16,4 @@
"index.d.ts",
"xml2js-tests.ts"
]
}
}
+47 -3
View File
@@ -1,9 +1,35 @@
import xml2js = require('xml2js');
xml2js.parseString("<root>Hello xml2js!</root>", (err: any, result: any) => { });
xml2js.parseString('<root>Hello xml2js!</root>', (err: any, result: any) => { });
xml2js.parseString("<root>Hello xml2js!</root>", {trim: true}, (err: any, result: any) => { });
xml2js.parseString('<root>Hello xml2js!</root>', {trim: true}, (err: any, result: any) => { });
xml2js.parseString('<root>Hello xml2js!</root>', {
attrkey: '$',
charkey: '_',
explicitCharkey: false,
trim: false,
normalizeTags: false,
explicitRoot: true,
emptyTag: '',
explicitArray: true,
ignoreAttrs: false,
mergeAttrs: false,
validator: undefined,
xmlns: false,
explicitChildren: false,
childkey: '$$',
preserveChildrenOrder: false,
charsAsChildren: false,
includeWhiteChars: false,
async: false,
strict: true,
attrNameProcessors: undefined,
attrValueProcessors: undefined,
tagNameProcessors: undefined,
valueProcessors: undefined
}, (err: any, result: any) => { });
var builder = new xml2js.Builder({
renderOpts: {
@@ -11,6 +37,23 @@ var builder = new xml2js.Builder({
}
});
var builder = new xml2js.Builder({
rootName: 'root',
renderOpts: {
pretty: true,
indent: ' ',
newline: '\n'
},
xmldec: {
version: '1.0',
encoding: 'UTF-8',
standalone: true
},
doctype: { ext: 'hello.dtd' },
headless: false,
cdata: false
});
var outString = builder.buildObject({
'hello': 'xml2js!'
});
@@ -22,4 +65,5 @@ v1Defaults.async = true;
var v2Defaults = xml2js.defaults['0.2'];
v2Defaults.async = false;
v2Defaults.chunkSize = 20000;
v2Defaults.chunkSize = 20000;