"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.reorderObject = exports.sanitizeString = exports.convertToArray = exports.setDelay = exports.createFilteredObject = void 0;
const lodash_1 = __importDefault(require("lodash"));
const createFilteredObject = (originalObject, inclusionList) => {
    const filteredObject = lodash_1.default.pick(originalObject, inclusionList);
    return filteredObject;
};
exports.createFilteredObject = createFilteredObject;
const setDelay = (ms) => {
    return new Promise((resolve) => {
        setTimeout(resolve, ms);
    });
};
exports.setDelay = setDelay;
const convertToArray = (selectedBorrowerIds) => {
    return typeof selectedBorrowerIds === 'string' ? [selectedBorrowerIds] : selectedBorrowerIds;
};
exports.convertToArray = convertToArray;
const sanitizeString = (stringToSanitize) => {
    const regexString = /[\/\\:?*"<>|']/g;
    return stringToSanitize.replace(regexString, '_');
};
exports.sanitizeString = sanitizeString;
const reorderObject = (obj, keyOrder) => {
    const reorderedObject = {};
    keyOrder.forEach(key => {
        if (obj.hasOwnProperty(key)) {
            reorderedObject[key] = obj[key];
        }
    });
    return reorderedObject;
};
exports.reorderObject = reorderObject;
