Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update numbro.d.ts to use export = instead of export default #232

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 99 additions & 95 deletions numbro.d.ts
Original file line number Diff line number Diff line change
@@ -1,101 +1,105 @@
// Definitions by: Dan Poggi <https://github.com/dpoggi>

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<NumbroCulture>;

/**
* 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<NumbroCulture>;

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<NumbroCulture>;

/**
* 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<NumbroCulture>;

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;



Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one empty line feels enough 😄

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;