From c4baf94d3ab4a0928c18ffbb0a6b688d1da84776 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Fri, 14 Jul 2017 10:15:07 +0200 Subject: [PATCH] Move default value in account constructor. --- src/accounts/account.controller.ts | 8 +------- src/accounts/account.ts | 4 ++++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/accounts/account.controller.ts b/src/accounts/account.controller.ts index cdccb7a..aeb54cf 100644 --- a/src/accounts/account.controller.ts +++ b/src/accounts/account.controller.ts @@ -58,13 +58,7 @@ export class AccountController { * Add an empty account. */ add() { - var account = new Account({ - // eslint-disable-next-line camelcase - authorized_overdraft: 0 - }); - - // Insert account at the begining of the array. - return this.modify(account); + return this.modify(new Account()); }; /* diff --git a/src/accounts/account.ts b/src/accounts/account.ts index 73bc800..8e80565 100644 --- a/src/accounts/account.ts +++ b/src/accounts/account.ts @@ -8,4 +8,8 @@ export class Account { authorized_overdraft: number; balances: AccountBalances; + + constructor() { + this.authorized_overdraft = 0; + } }