change flatten to Array#flat (Node 10.x EOL)

pull/1/head
f0x 2 years ago
parent 774608041a
commit 5e689b74fe

@ -3,7 +3,6 @@
const asExpression = require("as-expression"); const asExpression = require("as-expression");
const defaultValue = require("default-value"); const defaultValue = require("default-value");
const assureArray = require("assure-array"); const assureArray = require("assure-array");
const flatten = require("flatten");
const arrayUnion = require("array-union"); const arrayUnion = require("array-union");
const ValidationError = require("@validatem/error"); const ValidationError = require("@validatem/error");
@ -17,7 +16,7 @@ function containsRules(rules) {
return false; return false;
} else { } else {
// TODO: Switch to `Array#flat` once Node 10.x goes EOL (April 2021) // TODO: Switch to `Array#flat` once Node 10.x goes EOL (April 2021)
let flattenedRules = flatten(assureArray(rules)); let flattenedRules = assureArray(rules).flat();
if (!flattenedRules.some((rule) => rule != null)) { if (!flattenedRules.some((rule) => rule != null)) {
return false; return false;

@ -19,8 +19,7 @@
"array-union": "^2.1.0", "array-union": "^2.1.0",
"as-expression": "^1.0.0", "as-expression": "^1.0.0",
"assure-array": "^1.0.0", "assure-array": "^1.0.0",
"default-value": "^1.0.0", "default-value": "^1.0.0"
"flatten": "^1.0.3"
}, },
"devDependencies": { "devDependencies": {
"@validatem/core": "^0.3.1", "@validatem/core": "^0.3.1",

Loading…
Cancel
Save