talentlms-sdk
Version:
Nodejs SDK for accessing the TalentLMS API
43 lines (37 loc) • 856 B
JavaScript
;
/**
* Some common and simple utilities used across most projects
*/
const utils = {
/**
* Returns true if the app is running in debug mode, false otherwise
*/
isDebug: () => {
return process.argv.includes('--debug');
},
/**
* Returns true if the app is running in test mode, false otherwise
*/
isTest: () => {
return process.argv.includes('--test');
},
/**
* Returns true if the app is running in quick mode, false otherwise
*/
isQuick: () => {
return process.argv.includes('--quick');
},
/**
* Pauses execution for the provided number of milliseconds
*
* @param {number} ms The number of milliseconds to wait
*/
wait: async (ms) => {
return new Promise((resolve) => {
setTimeout(() => {
resolve();
}, ms);
});
}
};
module.exports = utils;