-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from vend/typescript
Add TypeScript types, update bignumber.js
- Loading branch information
Showing
3 changed files
with
2,738 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
declare module 'vend-number' { | ||
import { BigNumber, RoundingMode } from 'bignumber.js' | ||
|
||
interface Stringable { | ||
toString(): string | ||
} | ||
|
||
declare export default class VendNumber extends BigNumber { | ||
constructor (value?: Stringable) | ||
|
||
static readonly ROUNDING_MODES: { | ||
ROUND_UP: RoundingMode, | ||
ROUND_DOWN: RoundingMode, | ||
ROUND_CEIL: RoundingMode, | ||
ROUND_FLOOR: RoundingMode, | ||
ROUND_HALF_UP: RoundingMode, | ||
ROUND_HALF_DOWN: RoundingMode, | ||
ROUND_HALF_EVEN: RoundingMode, | ||
ROUND_HALF_CEIL: RoundingMode, | ||
ROUND_HALF_FLOOR: RoundingMode | ||
} | ||
|
||
static vn(value?: Stringable): VendNumber | ||
static round(value?: Stringable, decimalPoints?: number, roundingMode?: RoundingMode): string | ||
static add(...values: Stringable[]): number | ||
static subtract(...values: Stringable[]): number | ||
static multiply(...values: Stringable[]): number | ||
static divide(...values: Stringable[]): number | ||
static sumBy<T, K extends keyof T>(collection: T[], property: K, decimalPoints: number): string | ||
static isFinite(value: number | string | BigNumber): boolean | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.