feat: rotate ui

This commit is contained in:
Ibrahima G. Coulibaly
2024-07-14 00:23:30 +01:00
parent 350061d79e
commit 46859592cf
30 changed files with 723 additions and 510 deletions

View File

@@ -1,31 +1,30 @@
import { reverseString } from 'utils/string';
export function stringReverser(
input: string,
multiLine: boolean,
emptyItems: boolean,
trim: boolean
input: string,
multiLine: boolean,
emptyItems: boolean,
trim: boolean
) {
let array: string[] = [];
let result: string[] = [];
let array: string[] = [];
let result: string[] = [];
// split the input in multiLine mode
if (multiLine) {
array = input.split('\n');
}
else {
array.push(input);
}
// split the input in multiLine mode
if (multiLine) {
array = input.split('\n');
} else {
array.push(input);
}
// handle empty items
if (emptyItems){
array = array.filter(Boolean);
}
// Handle trim
if (trim) {
array = array.map(line => line.trim());
}
// handle empty items
if (emptyItems) {
array = array.filter(Boolean);
}
// Handle trim
if (trim) {
array = array.map((line) => line.trim());
}
result = array.map(element => reverseString(element));
return result.join('\n');
}
result = array.map((element) => reverseString(element));
return result.join('\n');
}