UNPKG

homebridge-zaptec

Version:
36 lines 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.camelCaseResponse = void 0; function camelCaseResponse(o) { let newO; let origKey; let newKey; let value; if (o instanceof Array) { return o.map(function (value) { if (typeof value === "object") { value = camelCaseResponse(value); } return value; }); } else { newO = {}; for (origKey in o) { if (o.hasOwnProperty(origKey)) { newKey = (origKey.charAt(0).toLowerCase() + origKey.slice(1) || origKey).toString(); if (origKey.match(/^[A-Z_]+$/g)) { newKey = origKey; } value = o[origKey]; if (value instanceof Array || (value !== null && value.constructor === Object)) { value = camelCaseResponse(value); } newO[newKey] = value; } } } return newO; } exports.camelCaseResponse = camelCaseResponse; //# sourceMappingURL=camel-case-response.js.map