"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertKeysToCamelCase = exports.notEmpty = exports.allMissingProperties = exports.findMissingProperty = void 0;
/*
  search in given object for property names, returns first property name not found, or undefined if nothing found
*/
function findMissingProperty(obj, keys) {
    return keys.find((key) => !obj[key]);
}
exports.findMissingProperty = findMissingProperty;
/*
  search in given object for property names, returns all property names not found
*/
function allMissingProperties(obj, keys) {
    return keys.filter((key) => !obj[key]);
}
exports.allMissingProperties = allMissingProperties;
/*
 return true if the given value is truthey, while asserting the type
 can be used in filters etc to remove nulls in a way the compiler accepts
*/
function notEmpty(value) {
    return !!value;
}
exports.notEmpty = notEmpty;
function toCamelCase(str) {
    return str.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
}
//modifies an object such that its property names are converted from snake_case to camelCase
function convertKeysToCamelCase(obj) {
    if (Array.isArray(obj)) {
        return obj.map(convertKeysToCamelCase);
    }
    else if (obj !== null && typeof obj === "object") {
        return Object.fromEntries(Object.entries(obj).map(([key, value]) => [toCamelCase(key), convertKeysToCamelCase(value)]));
    }
    return obj;
}
exports.convertKeysToCamelCase = convertKeysToCamelCase;

//# sourceMappingURL=../maps/core/ObjectUtilities.js.map
