forked from chmod77/react-native_wallet_sdk_sample
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelpers.js
More file actions
27 lines (26 loc) · 706 Bytes
/
Copy pathHelpers.js
File metadata and controls
27 lines (26 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* Copyright (c) 2019 CYBAVO, Inc.
* https://www.cybavo.com
*
* All rights reserved.
*/
import { Toast } from 'native-base';
export function toastError(error) {
Toast.show({ text: error.message, type: 'warning', duration: 3000 });
}
export function hasValue(str) {
return str != null && str.length > 0;
}
export function getFullName(givenName, familyName) {
if (!hasValue(givenName) && !hasValue(familyName)) {
return '';
}
const regex = /^[\u4e00-\u9eff]+$/gu;
let m1 = givenName.match(regex);
let m2 = familyName.match(regex);
if (m1 && m1.length > 0 && m2 && m2.length > 0) {
return `${familyName}${givenName}`;
} else {
return `${givenName} ${familyName}`;
}
}