feature (sso): authentication middleware

This commit is contained in:
Mickael Kerjean
2021-12-24 02:41:40 +11:00
parent bed13a0bc8
commit e5800c6c3b
33 changed files with 876 additions and 193 deletions

View File

@ -24,7 +24,16 @@ export function format(str = "") {
return str.split("_")
.map((word, index) => {
if (index != 0) return word;
return word[0].toUpperCase() + word.substring(1);
return (word[0] || "").toUpperCase() + word.substring(1);
})
.join(" ");
}
export function objectGet(obj, paths) {
let value = obj;
for (let i=0; i<paths.length; i++) {
if (typeof value !== "object" || value === null) return null;
value = value[paths[i]];
}
return value;
}