Helper function to calculate num owners introduced

This commit is contained in:
apanizo 2018-10-03 17:39:09 +02:00
parent 249c2526ed
commit 75edd7262e
1 changed files with 6 additions and 0 deletions

View File

@ -6,3 +6,9 @@ export const FIELD_DAILY_LIMIT: string = 'limit'
export const getOwnerNameBy = (index: number) => `owner${index}Name`
export const getOwnerAddressBy = (index: number) => `owner${index}Address`
export const getNumOwnersFrom = (values: Object) => {
const accounts = Object.keys(values).sort().filter(key => /^owner\d+Name$/.test(key))
return accounts.length
}