Explicitly use flatMap shim

master
Sven Slootweg 4 years ago
parent f494bf527a
commit 71dceeca03

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

@ -11,6 +11,7 @@
"@validatem/is-plain-object": "^0.1.0",
"@validatem/match-special": "^0.1.0",
"array.prototype.flat": "^1.2.3",
"array.prototype.flatmap": "^1.2.3",
"assure-array": "^1.0.0",
"default-value": "^1.0.0",
"is-plain-obj": "^2.1.0"

@ -164,6 +164,15 @@ array.prototype.flat@^1.2.3:
define-properties "^1.1.3"
es-abstract "^1.17.0-next.1"
array.prototype.flatmap@^1.2.3:
version "1.2.3"
resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.2.3.tgz#1c13f84a178566042dd63de4414440db9222e443"
integrity sha512-OOEk+lkePcg+ODXIpvuU9PAryCikCJyo7GlDG1upleEpQRx6mzL9puEBkozQ5iAx20KV0l3DbyQwqciJtqe5Pg==
dependencies:
define-properties "^1.1.3"
es-abstract "^1.17.0-next.1"
function-bind "^1.1.1"
as-expression@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/as-expression/-/as-expression-1.0.0.tgz#7bc620ca4cb2fe0ee90d86729bd6add33b8fd831"

Loading…
Cancel
Save