Skip to content

Commit

Permalink
Merge pull request #57 from sakamossan/56-add-typing
Browse files Browse the repository at this point in the history
[#56] Fixed typings
  • Loading branch information
codermarcos authored Aug 21, 2023
2 parents 934754e + 8523326 commit 798dade
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "3.0.1",
"description": "Simple money mask developed with pure JavaScript. To run on Client Side and Server Side",
"main": "lib/simple-mask-money.js",
"types": "types/simple-mask-money.d.ts",
"scripts": {
"test:tdd": "npx mocha tests/**/*.test.js --require babel-register -w -b",
"test": "npx mocha tests/**/*.test.js --require babel-register",
Expand Down
30 changes: 15 additions & 15 deletions types/simple-mask-money.d.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
interface ISimpleMaskMoneyArgs {
afterFormat: (e: string) => {};
allowNegative: boolean = false;
beforeFormat: (e: string) => {};
negativeSignAfter: boolean = false;
decimalSeparator: string = ',';
fixed: boolean = true;
fractionDigits: number = 2;
afterFormat: (e: string) => {};
allowNegative: boolean;
beforeFormat: (e: string) => {};
negativeSignAfter: boolean;
decimalSeparator: string;
fixed: boolean;
fractionDigits: number;
prefix: string;
suffix: string;
thousandsSeparator: string = '.';
thousandsSeparator: string;
cursor: 'start' | 'move' | 'end';
}

interface ISimpleMaskMoney {
public static args: ISimpleMaskMoneyArgs;
public static formatToCurrency(value: number, args?: ISimpleMaskMoneyArgs): string;
public static formatToMask(value: number, args?: ISimpleMaskMoneyArgs): string;
public static formatToNumber(value: string, args?: ISimpleMaskMoneyArgs): number;
public static setMask(element: string | HTMLInputElement, args?: ISimpleMaskMoneyArgs): HTMLInputElement;
declare class SimpleMaskMoney {
static args: ISimpleMaskMoneyArgs;
static formatToCurrency(value: number | string, args?: ISimpleMaskMoneyArgs): string;
static formatToMask(value: number | string, args?: ISimpleMaskMoneyArgs): string;
static formatToNumber(value: string, args?: ISimpleMaskMoneyArgs): number;
static setMask(element: string | HTMLInputElement, args?: ISimpleMaskMoneyArgs): HTMLInputElement;
}

declare module 'simple-mask-money' {
export = ISimpleMaskMoney;
export = SimpleMaskMoney;
}

0 comments on commit 798dade

Please sign in to comment.