import { sentenceCase } from 'change-case';
import { isInteger, isNil, mergeWith } from 'lodash';
import { titleCase } from 'title-case';
export function getPrettyShopifyObjectType(s) {
    return titleCase(sentenceCase(s));
}
;
export function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}
/**
 * Great to use when using Array.prototype.filter since the type guard will remove
 * nil types from the array
 * @param value
 * @returns
 */
export function isPresent(value) {
    return !isNil(value);
}
export * from './dateUtil';
const combineArrays = (objValue, srcValue) => {
    if (Array.isArray(objValue)) {
        return objValue.concat(srcValue);
    }
};
export function mergeWithCombinedArrays(...params) {
    return mergeWith(...params, combineArrays);
}
const overwriteMergeArray = (objValue, srcValue) => {
    if (Array.isArray(objValue)) {
        return srcValue;
    }
};
export function mergeWithOverwrittenArrays(...params) {
    return mergeWith(...params, overwriteMergeArray);
}
export function range(num) {
    return [
        ...Array(num)
            .keys()
    ];
}
export function getIntFromEnv(envVarName, defaultValue) {
    const envVar = process.env[envVarName];
    if (isNil(envVar)) {
        return defaultValue;
    }
    const parsedInt = Number.parseInt(envVar);
    return isInteger(parsedInt) ? parsedInt : defaultValue;
}
//# sourceMappingURL=index.js.map