17 lines
405 B
JavaScript
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;
|
|
};
|