diff options
author | wangyuerg <wangyuerg@chinamobile.com> | 2020-09-04 18:30:46 +0800 |
---|---|---|
committer | Yue Wang <wangyuerg@chinamobile.com> | 2020-09-07 01:46:37 +0000 |
commit | 926b57b4d540c73f1930e6d2d2070e5ac6939e5d (patch) | |
tree | 0e7cbc7ef248ededda4e1a96ca10cd31347dcc55 /usecaseui-portal/src/app/shared/utils | |
parent | c271c4e5c5f63753f7545bea64b7d24551fb3d2c (diff) |
fix: change type and key of parameters
Change-Id: I51f96580758f10c9bc7bcc7d909b5d7b3bb5d7e9
Signed-off-by: wangyuerg <wangyuerg@chinamobile.com>
Issue-ID: USECASEUI-444
Diffstat (limited to 'usecaseui-portal/src/app/shared/utils')
-rw-r--r-- | usecaseui-portal/src/app/shared/utils/utils.ts | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/usecaseui-portal/src/app/shared/utils/utils.ts b/usecaseui-portal/src/app/shared/utils/utils.ts index ad6a2f10..6864d60d 100644 --- a/usecaseui-portal/src/app/shared/utils/utils.ts +++ b/usecaseui-portal/src/app/shared/utils/utils.ts @@ -79,7 +79,7 @@ export class Util { return false; } else if (isNaN(parseInt(value))) { return false; - } else if (Number(value) >= 0 && Number(value)%1 !== 0){ + } else if (Number(value) < 0 || (Number(value)%1 !== 0)){ return false; } else { return true; @@ -90,7 +90,7 @@ export class Util { } isEmpty (a: any): boolean { const type = this.judgeType(a); - if (type === 'object Null' || type === '[object undefined]' || a === false || a === '') { + if (type === 'object Null' || type === '[object undefined]' || a === '') { return true; } else { return false; @@ -122,4 +122,12 @@ export class Util { } return true; } + pick(obj: object, arr: Array<string>): Object { + return arr.reduce((iter, val) => { + if(val in obj) { + iter[val] = obj[val]; + } + return iter; + }, {}); + } }
\ No newline at end of file |