ipfs-http-client
Version:
A client library for the IPFS HTTP API
24 lines (20 loc) • 532 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
function objectToCamel(obj) {
if (obj == null) {
return obj;
}
const caps = /^[A-Z]+$/;
const output = {};
return Object.keys(obj).reduce((camelObj, k) => {
if (caps.test(k)) {
camelObj[k.toLowerCase()] = obj[k];
} else if (caps.test(k[0])) {
camelObj[k[0].toLowerCase() + k.slice(1)] = obj[k];
} else {
camelObj[k] = obj[k];
}
return camelObj;
}, output);
}
exports.objectToCamel = objectToCamel;