From 3cf15b1d7663215364df51320c159aa3d53042bd Mon Sep 17 00:00:00 2001 From: Olmo del Corral Date: Sun, 5 Feb 2017 20:23:48 +0100 Subject: [PATCH 1/2] update numbro.d.ts to use export = instead of export default --- numbro.d.ts | 194 +++++++++++++++++++++++++++------------------------- 1 file changed, 99 insertions(+), 95 deletions(-) diff --git a/numbro.d.ts b/numbro.d.ts index 4474200f..bc73a785 100644 --- a/numbro.d.ts +++ b/numbro.d.ts @@ -1,101 +1,105 @@ // Definitions by: Dan Poggi -interface NumbroStatic { - (value?: any): Numbro; - - version: string; - isNumbro(value: any): value is Numbro; - - setCulture(newCultureCode: string, fallbackCultureCode?: string): void; - culture(): string; - culture(cultureCode: string): void; - culture(cultureCode: string, newCulture: NumbroCulture): NumbroStatic; - cultureData(cultureCode?: string): NumbroCulture; - cultures(): Array; - - /** - * Language functions - * - * @deprecated Since version 1.6.0. Will be removed in version 2.0. Use the - * culture versions instead. - */ - setLanguage(newCultureCode: string, fallbackCultureCode?: string): void; - language(): string; - language(cultureCode: string): void; - language(cultureCode: string, newCulture: NumbroCulture): NumbroStatic; - languageData(cultureCode?: string): NumbroCulture; - languages(): Array; - - zeroFormat(newFormat: string): void; - defaultFormat(newFormat: string): void; - defaultCurrencyFormat(newFormat: string): void; - - validate(value: string, cultureCode?: string): boolean; - - loadCulturesInNode(): void; - - /** - * @deprecated Since version 1.6.0. Will be removed in version 2.0. Use the - * culture version instead. - */ - loadLanguagesInNode(): void; -} - -export interface Numbro { - clone(): Numbro; - - format(formatString?: string, roundingFunction?: RoundingFunction): string; - formatCurrency(formatString?: string, roundingFunction?: RoundingFunction): string; - unformat(formattedNumber: string): number; - - binaryByteUnits(): string; - byteUnits(): string; - decimalByteUnits(): string; - - value(): number; - valueOf(): number; +declare function numbro(value?: any): numbro.Numbro; + +declare namespace numbro { + + export const version: string; + export function isNumbro(value: any): value is Numbro; + + export function setCulture(newCultureCode: string, fallbackCultureCode ?: string): void; + export function culture(): string; + export function culture(cultureCode: string): void; + export function culture(cultureCode: string, newCulture: NumbroCulture): typeof numbro; + export function cultureData(cultureCode ?: string): NumbroCulture; + export function cultures(): Array; + + /** + * Language functions + * + * @deprecated Since version 1.6.0. Will be removed in version 2.0. Use the + * culture versions instead. + */ + export function setLanguage(newCultureCode: string, fallbackCultureCode ?: string): void; + export function language(): string; + export function language(cultureCode: string): void; + export function language(cultureCode: string, newCulture: NumbroCulture): typeof numbro; + export function languageData(cultureCode ?: string): NumbroCulture; + export function languages(): Array; + + export function zeroFormat(newFormat: string): void; + export function defaultFormat(newFormat: string): void; + export function defaultCurrencyFormat(newFormat: string): void; + + export function validate(value: string, cultureCode ?: string): boolean; + + export function loadCulturesInNode(): void; + + /** + * @deprecated Since version 1.6.0. Will be removed in version 2.0. Use the + * culture version instead. + */ + export function loadLanguagesInNode(): void; + + + + interface Numbro { + clone(): Numbro; + + format(formatString?: string, roundingFunction?: RoundingFunction): string; + formatCurrency(formatString?: string, roundingFunction?: RoundingFunction): string; + unformat(formattedNumber: string): number; + + binaryByteUnits(): string; + byteUnits(): string; + decimalByteUnits(): string; + + value(): number; + valueOf(): number; + + set(value: number): this; + add(value: number): this; + subtract(value: number): this; + multiply(value: number): this; + divide(value: number): this; + + difference(value: number): number; + } + + export interface NumbroCulture { + langLocaleCode: string; + cultureCode: string; + delimiters: { + thousands: string; + decimal: string; + }; + abbreviations: { + thousand: string; + million: string; + billion: string; + trillion: string; + }; + ordinal(num: number): string; + currency: { + symbol: string; + position: string; + }; + defaults: { + currencyFormat: string; + }; + formats: { + fourDigits: string; + fullWithTwoDecimals: string; + fullWithTwoDecimalsNoCurrency: string; + fullWithNoDecimals: string; + }; + } + + export interface RoundingFunction { + (x: number): number; + } - set(value: number): this; - add(value: number): this; - subtract(value: number): this; - multiply(value: number): this; - divide(value: number): this; - - difference(value: number): number; -} - -export interface NumbroCulture { - langLocaleCode: string; - cultureCode: string; - delimiters: { - thousands: string; - decimal: string; - }; - abbreviations: { - thousand: string; - million: string; - billion: string; - trillion: string; - }; - ordinal(num: number): string; - currency: { - symbol: string; - position: string; - }; - defaults: { - currencyFormat: string; - }; - formats: { - fourDigits: string; - fullWithTwoDecimals: string; - fullWithTwoDecimalsNoCurrency: string; - fullWithNoDecimals: string; - }; } -export interface RoundingFunction { - (x: number): number; -} +export = numbro; -declare const numbro: NumbroStatic; -export default numbro; From fe4144add2c49234f1fbe0fda36c98a451ecf711 Mon Sep 17 00:00:00 2001 From: Olmo del Corral Date: Mon, 13 Feb 2017 19:03:44 +0100 Subject: [PATCH 2/2] remove extra spaces --- numbro.d.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/numbro.d.ts b/numbro.d.ts index bc73a785..3acb87e5 100644 --- a/numbro.d.ts +++ b/numbro.d.ts @@ -41,8 +41,6 @@ declare namespace numbro { */ export function loadLanguagesInNode(): void; - - interface Numbro { clone(): Numbro; @@ -98,8 +96,6 @@ declare namespace numbro { export interface RoundingFunction { (x: number): number; } - } -export = numbro; - +export = numbro; \ No newline at end of file