new commands update for the bot
This commit is contained in:
12
src/utils/helpers.js
Normal file
12
src/utils/helpers.js
Normal file
@@ -0,0 +1,12 @@
|
||||
// src/utils/helpers.js
|
||||
function safeGet(obj, path, defaultValue = null) {
|
||||
try {
|
||||
return path.split('.').reduce((acc, part) => acc && acc[part], obj) ?? defaultValue;
|
||||
} catch (e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
safeGet
|
||||
};
|
||||
Reference in New Issue
Block a user