import { UnexpectedIndexError } from '../types/errors';
export const getArrayValue = (obj, key, errorMessage) => {
    if (obj === undefined) {
        throw new UnexpectedIndexError(errorMessage || `Cannot get key "${key}" value from empty array`);
    }
    const value = obj[key];
    if (value === undefined) {
        // eslint-disable-next-line no-console
        console.trace();
        throw new UnexpectedIndexError(errorMessage || `Cannot get key "${key}" value from array`);
    }
    return value;
};
export const getObjectValue = (obj, key, errorMessage) => {
    if (obj === undefined) {
        throw new UnexpectedIndexError(errorMessage || `Cannot get key "${key}" value from empty object`);
    }
    const value = obj[key];
    if (value === undefined) {
        // eslint-disable-next-line no-console
        console.trace();
        throw new UnexpectedIndexError(errorMessage || `Cannot get key "${key}" value from object`);
    }
    return value;
};
export const hasProperty = (obj, property) => typeof obj === 'object' && obj !== null && property in obj;
//# sourceMappingURL=accessors.js.map