"use strict";
/*
 * @adonisjs/validator
 *
 * (c) Harminder Virk <virk@adonisjs.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.object = void 0;
const helpers_1 = require("../../Validator/helpers");
const DEFAULT_MESSAGE = 'object validation failed';
const RULE_NAME = 'object';
/**
 * Ensure value is a valid object
 */
exports.object = {
    compile: (0, helpers_1.wrapCompile)(RULE_NAME),
    validate(value, _, { errorReporter, pointer, arrayExpressionPointer }) {
        if (typeof value !== 'object' || Array.isArray(value) || value === null) {
            errorReporter.report(pointer, RULE_NAME, DEFAULT_MESSAGE, arrayExpressionPointer);
        }
    },
};
