mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-18 07:35:02 +00:00
Initial dashboard work (auth flow)
This commit is contained in:
parent
9109e9a2c3
commit
c94c8849a5
18 changed files with 3808 additions and 31 deletions
16
src/utils.ts
16
src/utils.ts
|
@ -5,7 +5,6 @@ import {
|
|||
Guild,
|
||||
GuildAuditLogEntry,
|
||||
Member,
|
||||
MessageContent,
|
||||
TextableChannel,
|
||||
TextChannel,
|
||||
User,
|
||||
|
@ -61,8 +60,19 @@ export function errorMessage(str) {
|
|||
return `⚠ ${str}`;
|
||||
}
|
||||
|
||||
export function uclower(str) {
|
||||
return str[0].toLowerCase() + str.slice(1);
|
||||
export function get(obj, path, def?): any {
|
||||
let cursor = obj;
|
||||
const pathParts = path.split(".");
|
||||
for (const part of pathParts) {
|
||||
cursor = cursor[part];
|
||||
if (cursor === undefined) return def;
|
||||
if (cursor == null) return null;
|
||||
}
|
||||
return cursor;
|
||||
}
|
||||
|
||||
export function has(obj, path): boolean {
|
||||
return get(obj, path) !== undefined;
|
||||
}
|
||||
|
||||
export function stripObjectToScalars(obj, includedNested: string[] = []) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue