Simplify code

This commit is contained in:
Jan Oberhauser 2021-10-07 17:12:06 -05:00
parent 29887c11c1
commit 3a49730675
2 changed files with 10 additions and 7 deletions

View file

@ -293,11 +293,14 @@ export const split = (subject: string): string[] =>
.map(s => s.replace(/\\([\s\S])/gm, ($0, $1) => $1))
;
const userBaseUri = (str?: string) => {
if (str === undefined) {
return str;
const userBaseUri = (uri?: string) => {
if (uri === undefined) {
return uri;
}
let end = str.length;
for (; end > 0 && str[end - 1] === '/'; --end) {}
return end < str.length ? str.substring(0, end) : str;
if (uri.endsWith('/')) {
return uri.slice(0, -1);
}
return uri;
};

View file

@ -95,7 +95,7 @@ export interface IRowResponse{
metadata: [
{
key: string,
name: string
name: string,
}
];
results: IRow[];