@0xcert/utils
Version:
General utility module with common helper functions.
31 lines • 776 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.toTuple = void 0;
function toTuple(obj) {
if (!(obj instanceof Object)) {
return [];
}
const output = [];
let i = 0;
Object.keys(obj).forEach((k) => {
if (obj[k] instanceof Object) {
output[i] = toTuple(obj[k]);
}
else if (obj[k] instanceof Array) {
let j1 = 0;
const temp1 = [];
obj[k].forEach((ak) => {
temp1[j1] = toTuple(obj[k]);
j1++;
});
output[i] = temp1;
}
else {
output[i] = obj[k];
}
i++;
});
return output;
}
exports.toTuple = toTuple;
//# sourceMappingURL=to-tuple.js.map
;