tmdbrjs
Version:
A TypeScript wrapper for The Movie Database (TMDB) API
21 lines • 711 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyCaseMiddleware = applyCaseMiddleware;
function applyCaseMiddleware(input, caseFunction) {
if (Array.isArray(input)) {
return input.map((i) => applyCaseMiddleware(i, caseFunction));
}
else if (typeof input === 'object' && input !== null) {
const newObj = {};
for (const key in input) {
if (Object.prototype.hasOwnProperty.call(input, key)) {
newObj[caseFunction(key)] = applyCaseMiddleware(input[key], caseFunction);
}
}
return newObj;
}
else {
return input;
}
}
//# sourceMappingURL=applyCaseMiddleware.js.map