Enforce ts tab indents for accessibility
This commit is contained in:
parent
e6dda7b88b
commit
48f2303216
3 changed files with 231 additions and 230 deletions
|
@ -43,6 +43,7 @@ module.exports = {
|
||||||
"error",
|
"error",
|
||||||
"always"
|
"always"
|
||||||
],
|
],
|
||||||
"no-trailing-spaces": ["error"]
|
"no-trailing-spaces": ["error"],
|
||||||
|
"indent": ["error", "tab"], // we use tabs for accessibility
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,7 +17,7 @@ const assertOperand = function (operand: unknown) {
|
||||||
throw new TypeError('Operand must be a number');
|
throw new TypeError('Operand must be a number');
|
||||||
};
|
};
|
||||||
|
|
||||||
type MoneyAsJson = {amount: number, currency: string}
|
type MoneyAsJson = { amount: number, currency: string }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a monetary amount. For safety, all Money objects are immutable. All of the functions in this class create a new Money object.
|
* Represents a monetary amount. For safety, all Money objects are immutable. All of the functions in this class create a new Money object.
|
||||||
|
@ -28,7 +28,7 @@ type MoneyAsJson = {amount: number, currency: string}
|
||||||
*/
|
*/
|
||||||
export class Money {
|
export class Money {
|
||||||
|
|
||||||
readonly currency:string
|
readonly currency: string
|
||||||
|
|
||||||
protected constructor(readonly amount: number, currency: string) {
|
protected constructor(readonly amount: number, currency: string) {
|
||||||
this.currency = currency.toLowerCase();
|
this.currency = currency.toLowerCase();
|
||||||
|
@ -50,10 +50,10 @@ export class Money {
|
||||||
* @memberof Money
|
* @memberof Money
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static fromCents(amount:MoneyAsJson): Money;
|
static fromCents(amount: MoneyAsJson): Money;
|
||||||
static fromCents(amount:Money): Money;
|
static fromCents(amount: Money): Money;
|
||||||
static fromCents(amount: number, currency: string) : Money;
|
static fromCents(amount: number, currency: string): Money;
|
||||||
static fromCents(amount: number|Money|MoneyAsJson, currency?: string): Money {
|
static fromCents(amount: number | Money | MoneyAsJson, currency?: string): Money {
|
||||||
|
|
||||||
if (typeof amount === 'number')
|
if (typeof amount === 'number')
|
||||||
return new Money(amount, currency);
|
return new Money(amount, currency);
|
||||||
|
@ -69,7 +69,7 @@ export class Money {
|
||||||
* @static
|
* @static
|
||||||
* @memberof Money
|
* @memberof Money
|
||||||
*/
|
*/
|
||||||
static fromSMU=Money.fromCents
|
static fromSMU = Money.fromCents
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the two instances of Money are equal, false otherwise.
|
* Returns true if the two instances of Money are equal, false otherwise.
|
||||||
|
@ -120,7 +120,7 @@ export class Money {
|
||||||
* @param {(x:number) => number} [fn=Math.round]
|
* @param {(x:number) => number} [fn=Math.round]
|
||||||
* @returns {Money}
|
* @returns {Money}
|
||||||
*/
|
*/
|
||||||
multiply(multiplier: number, roundingFunction: (x:number) => number): Money {
|
multiply(multiplier: number, roundingFunction: (x: number) => number): Money {
|
||||||
if (!isFunction(roundingFunction))
|
if (!isFunction(roundingFunction))
|
||||||
roundingFunction = Math.round;
|
roundingFunction = Math.round;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue