#include "JsonLogic.h"

namespace json_logic
{
    Json JsonLogic::operation_logic_truthy(JsonArrayView values, JsonView data) const
    {
        if (values.size() != 1)
            return Fail(__FUNCTION__, "Expected 1 argument, but received " +
                                          std::to_string(values.size()));
        const Json value = ApplyInternal(values[0], data);
        if (HasError()) return Json{};
        return MakeBoolean(Truthy(value));
    }
}
