|
|
@ -4,6 +4,7 @@ const assureArray = require("assure-array");
|
|
|
|
const isPlainObj = require("is-plain-obj");
|
|
|
|
const isPlainObj = require("is-plain-obj");
|
|
|
|
const defaultValue = require("default-value");
|
|
|
|
const defaultValue = require("default-value");
|
|
|
|
const flat = require("array.prototype.flat");
|
|
|
|
const flat = require("array.prototype.flat");
|
|
|
|
|
|
|
|
const flatMap = require("array.prototype.flatmap");
|
|
|
|
|
|
|
|
|
|
|
|
const matchSpecial = require("@validatem/match-special");
|
|
|
|
const matchSpecial = require("@validatem/match-special");
|
|
|
|
const isPlainObjectValidator = require("@validatem/is-plain-object");
|
|
|
|
const isPlainObjectValidator = require("@validatem/is-plain-object");
|
|
|
@ -19,7 +20,7 @@ module.exports = function normalizeRules(rules, options) {
|
|
|
|
let actualRules = flattened.filter((rule) => rule != null);
|
|
|
|
let actualRules = flattened.filter((rule) => rule != null);
|
|
|
|
|
|
|
|
|
|
|
|
if (normalizeObjects) {
|
|
|
|
if (normalizeObjects) {
|
|
|
|
return actualRules.flatMap((rule) => {
|
|
|
|
return flatMap(actualRules, (rule) => {
|
|
|
|
if (isPlainObj(rule) && !matchSpecial(rule)) {
|
|
|
|
if (isPlainObj(rule) && !matchSpecial(rule)) {
|
|
|
|
return [
|
|
|
|
return [
|
|
|
|
isPlainObjectValidator,
|
|
|
|
isPlainObjectValidator,
|
|
|
|