cloud-report
Version:
Collects and analyzes cloud resources
34 lines (33 loc) • 931 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const Moment = require("moment");
class CommonUtil {
static wait(timeInMills) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(), timeInMills);
});
}
static removeDuplicates(array) {
if (!array) {
return [];
}
return array.filter((current, index) => {
return array.indexOf(current) === index;
});
}
static daysFrom(date) {
return Math.floor(Moment.duration(Moment().diff(Moment(date))).asDays());
}
static uniqId() {
return `${Date.now()}_${Math.floor(Math.random() * 10000000)}`;
}
static toArray(obj) {
if (Array.isArray(obj)) {
return obj;
}
else {
return [obj];
}
}
}
exports.CommonUtil = CommonUtil;