naise-pos-android-mobile/src/helpers/common.js
2023-04-14 23:33:18 +07:00

17 lines
405 B
JavaScript

export const cutStringProduct = string => {
let length = 0;
let res;
if (string !== undefined) {
length = string.length;
if (length === 1) {
res = string[0].toUpperCase();
} else if (string[1] === ' ') {
res = string[0].toUpperCase() + '' + string[2].toLowerCase();
} else {
res = string[0].toUpperCase() + '' + string[1].toLowerCase();
}
}
return res;
};