@veecode-platform/plugin-kong-service-manager
Version:
25 lines (23 loc) • 534 B
JavaScript
function convertToArrayOfObjects(arr) {
if (!arr) return [];
return arr.map((value, index) => ({
id: (index + 1).toString(),
value
}));
}
function convertToObjArray(obj) {
const result = [];
if (!obj) {
return result;
}
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
obj[key].forEach((value) => {
result.push({ id: key, value });
});
}
}
return result;
}
export { convertToArrayOfObjects, convertToObjArray };
//# sourceMappingURL=convertToArrayOfObjects.esm.js.map