@qavajs/steps-memory
Version:
steps to perform memory validation
38 lines • 1.51 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.dataTable2Object = dataTable2Object;
exports.dataTable2Array = dataTable2Array;
/**
* Transform key-value data table to JS object
* @param context
* @param dataTable
* @return {Object}
*/
function dataTable2Object(context, dataTable) {
return __awaiter(this, void 0, void 0, function* () {
const obj = {};
for (const [key, value] of dataTable.raw()) {
obj[key] = yield context.getValue(value);
}
return obj;
});
}
/**
* Transform key-value data table to array
* @param context
* @param dataTable
* @return {any[]}
*/
function dataTable2Array(context, dataTable) {
return Promise.all(dataTable.raw().map(([value]) => context.getValue(value)));
}
//# sourceMappingURL=utils.js.map
;