From 85dd59127dac005ebaf22faaaec4e3e3ab251846 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Mon, 29 May 2023 15:13:46 +0300 Subject: [PATCH 01/10] feat: add basic filter function for entities --- src/utils/filter.js | 21 +++++++++++++++++++ tests/utils/filter.tests.js | 42 +++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 src/utils/filter.js create mode 100644 tests/utils/filter.tests.js diff --git a/src/utils/filter.js b/src/utils/filter.js new file mode 100644 index 00000000..ab4b5e3e --- /dev/null +++ b/src/utils/filter.js @@ -0,0 +1,21 @@ +import lodash from "lodash"; + +/** + * Filter list of entity paths or entities by paths and regular expressions. + * @param {Object[]} entitiesOrPaths - Array of objects defining entity path + * @param {Array<{ path: string }|{ regex: string }|{ regex: RegExp }>} filterObjects - Array of path or regular expression objects + * @return {Object[]} - filtered entity path objects or entities + */ +export function filterEntityList({ entitiesOrPaths, filterObjects = [] }) { + const pathList = filterObjects.filter((o) => o.path); + const regexList = filterObjects.filter((o) => o.regex); + + const filtered = regexList + .flatMap((r) => { + const regex = new RegExp(r.regex); + return entitiesOrPaths.filter((o) => regex.test(o.path)); + }) + .concat(lodash.intersectionBy(entitiesOrPaths, pathList, "path")); + + return lodash.uniqBy(filtered, "path"); +} diff --git a/tests/utils/filter.tests.js b/tests/utils/filter.tests.js new file mode 100644 index 00000000..83b5c236 --- /dev/null +++ b/tests/utils/filter.tests.js @@ -0,0 +1,42 @@ +import { expect } from "chai"; + +import { filterEntityList } from "../../src/utils/filter"; + +describe("entity filter", () => { + const entities = [ + { name: "A", path: "/root/entity/a" }, + { name: "B", path: "/root/entity/b" }, + { name: "C", path: "/root/entity/c" }, + { name: "D", path: "/root/entity/d" }, + ]; + + it("should filter an entity list with paths", () => { + const filterObjects = [{ path: "/root/entity/b" }, { path: "/root/entity/c" }]; + const filtered = filterEntityList({ filterObjects, entitiesOrPaths: entities }); + const expected = [ + { name: "B", path: "/root/entity/b" }, + { name: "C", path: "/root/entity/c" }, + ]; + expect(filtered).to.have.deep.members(expected); + }); + + it("should filter an entity list with regular expressions", () => { + const filterObjects = [{ regex: /\/root\/entity\/[bc]/ }]; + const filtered = filterEntityList({ filterObjects, entitiesOrPaths: entities }); + const expected = [ + { name: "B", path: "/root/entity/b" }, + { name: "C", path: "/root/entity/c" }, + ]; + expect(filtered).to.have.deep.members(expected); + }); + + it("should filter an entity list with both paths and regular expressions", () => { + const filterObjects = [{ path: "/root/entity/b" }, { regex: /\/root\/entity\/[c]/ }]; + const filtered = filterEntityList({ filterObjects, entitiesOrPaths: entities }); + const expected = [ + { name: "B", path: "/root/entity/b" }, + { name: "C", path: "/root/entity/c" }, + ]; + expect(filtered).to.have.deep.members(expected); + }); +}); From 4da934b51d242987f879c0c689c9c63bc4aff64a Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Mon, 29 May 2023 17:24:20 +0300 Subject: [PATCH 02/10] chore: add fn to index --- src/utils/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils/index.js b/src/utils/index.js index 427be7ec..7790957f 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -4,6 +4,7 @@ import { cloneClass, extendClass, extendClassStaticProps, extendThis } from "./c import { deepClone } from "./clone"; import { refreshCodeMirror } from "./codemirror"; import { formatFileSize, getProgrammingLanguageFromFileExtension } from "./file"; +import { filterEntityList } from "./filter"; import { addUnit, removeUnit, replaceUnit, setNextLinks, setUnitsHead } from "./graph"; import { calculateHashFromObject, @@ -81,4 +82,5 @@ export { esseType, includeType, generateName, + filterEntityList, }; From 1d4df18c804d458294b6a53d934a57db12fdee28 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Mon, 29 May 2023 20:29:58 +0300 Subject: [PATCH 03/10] chore: add isContained array utility fn --- src/utils/array.js | 25 +++++++++++++++++++++++++ src/utils/index.js | 3 ++- tests/utils/array.tests.js | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 tests/utils/array.tests.js diff --git a/src/utils/array.js b/src/utils/array.js index 815c0b4a..b2f5c11a 100644 --- a/src/utils/array.js +++ b/src/utils/array.js @@ -25,3 +25,28 @@ export function convertToCompactCSVArrayOfObjects(objects) { return result; } + +/** + * Check whether one array (probe) is contained within another (reference) by property. + * @param {Object[]} probe - Array of objects (smaller set) + * @param {Object[]} reference - Array of objects assumed to contain the probe array + * @param {string} property - Name of object property to compare by + * @return {boolean} + */ +export function isContainedByProperty(probe, reference, property) { + // sort required for linear algorithm + const probe_ = lodash.sortBy(probe, property); + const reference_ = lodash.sortBy(reference, property); + + let j = 0; + return probe_.reduce((isContained, currentObj) => { + const val = lodash.get(currentObj, property); + while (j < reference_.length && !lodash.isEqual(val, lodash.get(reference_[j], property))) { + // eslint-disable-next-line no-plusplus + j++; + } + // If we haven't found the current object in reference_ or + // if the previous reduce iterations already returned false, return false + return isContained && !(j === reference_.length); + }, true); +} diff --git a/src/utils/index.js b/src/utils/index.js index 7790957f..7cbddc31 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,5 +1,5 @@ import { compareEntitiesInOrderedSetForSorting } from "../entity/set/ordered/utils"; -import { convertToCompactCSVArrayOfObjects, safeMakeArray } from "./array"; +import { convertToCompactCSVArrayOfObjects, isContainedByProperty, safeMakeArray } from "./array"; import { cloneClass, extendClass, extendClassStaticProps, extendThis } from "./class"; import { deepClone } from "./clone"; import { refreshCodeMirror } from "./codemirror"; @@ -83,4 +83,5 @@ export { includeType, generateName, filterEntityList, + isContainedByProperty, }; diff --git a/tests/utils/array.tests.js b/tests/utils/array.tests.js new file mode 100644 index 00000000..2500c006 --- /dev/null +++ b/tests/utils/array.tests.js @@ -0,0 +1,34 @@ +import { expect } from "chai"; + +import { isContainedByProperty } from "../../src/utils/array"; + +describe("array", () => { + it("can test whether one array is contained within another by property", () => { + const probe = [ + { name: "A", path: "/path/to/a" }, + { name: "B", path: "/path/to/b" }, + ]; + const reference = [ + { name: "A", path: "/path/to/a", tag: "a1" }, + { name: "B", path: "/path/to/b", tag: "b1" }, + { name: "C", path: "/path/to/c", tag: "c1" }, + ]; + const isContained = isContainedByProperty(probe, reference, "path"); + // eslint-disable-next-line no-unused-expressions + expect(isContained).to.be.true; + }); + it("can test whether one array is not contained within another by property", () => { + const probe = [ + { name: "A", path: "/path/to/a" }, + { name: "B", path: "/path/to/b" }, + ]; + const reference = [ + { name: "A", path: "/path/to/a", tag: "a1" }, + { name: "C", path: "/path/to/c", tag: "c1" }, + { name: "D", path: "/path/to/d", tag: "d1" }, + ]; + const isContained = isContainedByProperty(probe, reference, "path"); + // eslint-disable-next-line no-unused-expressions + expect(isContained).to.be.false; + }); +}); From 56175bc46e4687bfc71e58148b633856625b39d3 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Mon, 29 May 2023 20:31:37 +0300 Subject: [PATCH 04/10] chore: extend filter fn to support multiPaths --- src/utils/filter.js | 27 +++++++++++++++++++-------- tests/utils/filter.tests.js | 16 ++++++++++++++++ 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/utils/filter.js b/src/utils/filter.js index ab4b5e3e..9e551512 100644 --- a/src/utils/filter.js +++ b/src/utils/filter.js @@ -1,21 +1,32 @@ import lodash from "lodash"; +import { isContainedByProperty } from "./array"; + /** * Filter list of entity paths or entities by paths and regular expressions. * @param {Object[]} entitiesOrPaths - Array of objects defining entity path * @param {Array<{ path: string }|{ regex: string }|{ regex: RegExp }>} filterObjects - Array of path or regular expression objects + * @param {string} multiPathSeparator - string by which paths should be split * @return {Object[]} - filtered entity path objects or entities */ -export function filterEntityList({ entitiesOrPaths, filterObjects = [] }) { +export function filterEntityList({ entitiesOrPaths, filterObjects = [], multiPathSeparator = "" }) { const pathList = filterObjects.filter((o) => o.path); const regexList = filterObjects.filter((o) => o.regex); - const filtered = regexList - .flatMap((r) => { - const regex = new RegExp(r.regex); - return entitiesOrPaths.filter((o) => regex.test(o.path)); - }) - .concat(lodash.intersectionBy(entitiesOrPaths, pathList, "path")); + const filteredByRegex = regexList.flatMap((r) => { + const regex = new RegExp(r.regex); + return entitiesOrPaths.filter((o) => regex.test(o.path)); + }); + + let filteredByPath; + if (multiPathSeparator) { + filteredByPath = entitiesOrPaths.filter((e) => { + const expandedPaths = e.path.split(multiPathSeparator).map((p) => ({ path: p })); + return isContainedByProperty(expandedPaths, pathList, "path"); + }); + } else { + filteredByPath = lodash.intersectionBy(entitiesOrPaths, pathList, "path"); + } - return lodash.uniqBy(filtered, "path"); + return lodash.uniqBy(filteredByRegex.concat(filteredByPath), "path"); } diff --git a/tests/utils/filter.tests.js b/tests/utils/filter.tests.js index 83b5c236..1e38ff07 100644 --- a/tests/utils/filter.tests.js +++ b/tests/utils/filter.tests.js @@ -39,4 +39,20 @@ describe("entity filter", () => { ]; expect(filtered).to.have.deep.members(expected); }); + + it("should filter an entity list containing concatenated paths", () => { + const filterObjects = [{ path: "/root/entity/b" }, { path: "/root/entity/c" }]; + const multiPathEntities = [ + { name: "AB", path: "/root/entity/a::/root/entity/b" }, + { name: "BC", path: "/root/entity/b::/root/entity/c" }, + ]; + const multiPathSeparator = "::"; + const filtered = filterEntityList({ + filterObjects, + entitiesOrPaths: multiPathEntities, + multiPathSeparator, + }); + const expected = [{ name: "BC", path: "/root/entity/b::/root/entity/c" }]; + expect(filtered).to.have.deep.members(expected); + }); }); From f2e7ca4a070e8edae78d353a66524b87da9daad2 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 30 May 2023 12:46:49 +0300 Subject: [PATCH 05/10] revert: isContained array utility fn --- src/utils/array.js | 25 ------------------------- tests/utils/array.tests.js | 34 ---------------------------------- 2 files changed, 59 deletions(-) delete mode 100644 tests/utils/array.tests.js diff --git a/src/utils/array.js b/src/utils/array.js index b2f5c11a..815c0b4a 100644 --- a/src/utils/array.js +++ b/src/utils/array.js @@ -25,28 +25,3 @@ export function convertToCompactCSVArrayOfObjects(objects) { return result; } - -/** - * Check whether one array (probe) is contained within another (reference) by property. - * @param {Object[]} probe - Array of objects (smaller set) - * @param {Object[]} reference - Array of objects assumed to contain the probe array - * @param {string} property - Name of object property to compare by - * @return {boolean} - */ -export function isContainedByProperty(probe, reference, property) { - // sort required for linear algorithm - const probe_ = lodash.sortBy(probe, property); - const reference_ = lodash.sortBy(reference, property); - - let j = 0; - return probe_.reduce((isContained, currentObj) => { - const val = lodash.get(currentObj, property); - while (j < reference_.length && !lodash.isEqual(val, lodash.get(reference_[j], property))) { - // eslint-disable-next-line no-plusplus - j++; - } - // If we haven't found the current object in reference_ or - // if the previous reduce iterations already returned false, return false - return isContained && !(j === reference_.length); - }, true); -} diff --git a/tests/utils/array.tests.js b/tests/utils/array.tests.js deleted file mode 100644 index 2500c006..00000000 --- a/tests/utils/array.tests.js +++ /dev/null @@ -1,34 +0,0 @@ -import { expect } from "chai"; - -import { isContainedByProperty } from "../../src/utils/array"; - -describe("array", () => { - it("can test whether one array is contained within another by property", () => { - const probe = [ - { name: "A", path: "/path/to/a" }, - { name: "B", path: "/path/to/b" }, - ]; - const reference = [ - { name: "A", path: "/path/to/a", tag: "a1" }, - { name: "B", path: "/path/to/b", tag: "b1" }, - { name: "C", path: "/path/to/c", tag: "c1" }, - ]; - const isContained = isContainedByProperty(probe, reference, "path"); - // eslint-disable-next-line no-unused-expressions - expect(isContained).to.be.true; - }); - it("can test whether one array is not contained within another by property", () => { - const probe = [ - { name: "A", path: "/path/to/a" }, - { name: "B", path: "/path/to/b" }, - ]; - const reference = [ - { name: "A", path: "/path/to/a", tag: "a1" }, - { name: "C", path: "/path/to/c", tag: "c1" }, - { name: "D", path: "/path/to/d", tag: "d1" }, - ]; - const isContained = isContainedByProperty(probe, reference, "path"); - // eslint-disable-next-line no-unused-expressions - expect(isContained).to.be.false; - }); -}); From ae2b5427cc6f121696375c198c13c868bfc87bf0 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 30 May 2023 12:47:38 +0300 Subject: [PATCH 06/10] chore: adjust filter fn to support regex multipath --- src/utils/filter.js | 52 ++++++++++++++++++++++++++----------- tests/utils/filter.tests.js | 16 ++++++++++++ 2 files changed, 53 insertions(+), 15 deletions(-) diff --git a/src/utils/filter.js b/src/utils/filter.js index 9e551512..a6fdcf7e 100644 --- a/src/utils/filter.js +++ b/src/utils/filter.js @@ -1,6 +1,35 @@ import lodash from "lodash"; -import { isContainedByProperty } from "./array"; +/** + * Check if one path matches regular expression or exact string. + * @param {{path: string}} pathObject - Entity or object with path property + * @param {Array<{path: string}|{regex: RegExp}>} filterObjects - Filter conditions + * @return {boolean} + */ +function isPathSupported(pathObject, filterObjects) { + return ( + lodash.find(filterObjects, (filterObj) => { + if (filterObj.path) { + return filterObj.path === pathObject.path; + } + if (filterObj.regex) { + return filterObj.regex.test(pathObject.path); + } + }) !== undefined + ); +} + +/** + * Check if _all_ paths in concatenated path match filtering conditions. + * @param {{path: string}} pathObject - Path object with concatenated path (multipath) + * @param {string} multiPathSeparator - String sequence used for concatenation of paths + * @param {Array<{path: string}|{regex: RegExp}>} filterObjects - Filter conditions + * @return {boolean} + */ +function isMultiPathSupported(pathObject, multiPathSeparator, filterObjects) { + const expandedPaths = pathObject.path.split(multiPathSeparator).map((p) => ({ path: p })); + return lodash.every(expandedPaths, (obj) => isPathSupported(obj, filterObjects)); +} /** * Filter list of entity paths or entities by paths and regular expressions. @@ -10,23 +39,16 @@ import { isContainedByProperty } from "./array"; * @return {Object[]} - filtered entity path objects or entities */ export function filterEntityList({ entitiesOrPaths, filterObjects = [], multiPathSeparator = "" }) { - const pathList = filterObjects.filter((o) => o.path); - const regexList = filterObjects.filter((o) => o.regex); - - const filteredByRegex = regexList.flatMap((r) => { - const regex = new RegExp(r.regex); - return entitiesOrPaths.filter((o) => regex.test(o.path)); - }); + const filterObjects_ = filterObjects.map((o) => (o.regex ? { regex: new RegExp(o.regex) } : o)); - let filteredByPath; + let filtered; if (multiPathSeparator) { - filteredByPath = entitiesOrPaths.filter((e) => { - const expandedPaths = e.path.split(multiPathSeparator).map((p) => ({ path: p })); - return isContainedByProperty(expandedPaths, pathList, "path"); - }); + filtered = entitiesOrPaths.filter((e) => + isMultiPathSupported(e, multiPathSeparator, filterObjects_), + ); } else { - filteredByPath = lodash.intersectionBy(entitiesOrPaths, pathList, "path"); + filtered = entitiesOrPaths.filter((e) => isPathSupported(e, filterObjects_)); } - return lodash.uniqBy(filteredByRegex.concat(filteredByPath), "path"); + return lodash.uniqBy(filtered, "path"); } diff --git a/tests/utils/filter.tests.js b/tests/utils/filter.tests.js index 1e38ff07..18d6eab3 100644 --- a/tests/utils/filter.tests.js +++ b/tests/utils/filter.tests.js @@ -55,4 +55,20 @@ describe("entity filter", () => { const expected = [{ name: "BC", path: "/root/entity/b::/root/entity/c" }]; expect(filtered).to.have.deep.members(expected); }); + + it("should filter an entity list containing concatenated paths using regex", () => { + const filterObjects = [{ path: "/root/entity/b" }, { regex: /\/root\/entity\/[c]/ }]; + const multiPathEntities = [ + { name: "AB", path: "/root/entity/a::/root/entity/b" }, + { name: "BC", path: "/root/entity/b::/root/entity/c" }, + ]; + const multiPathSeparator = "::"; + const filtered = filterEntityList({ + filterObjects, + entitiesOrPaths: multiPathEntities, + multiPathSeparator, + }); + const expected = [{ name: "BC", path: "/root/entity/b::/root/entity/c" }]; + expect(filtered).to.have.deep.members(expected); + }); }); From e6f0c1560ffed0ff9b51c9729a55090a5ffb3b32 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 30 May 2023 13:06:14 +0300 Subject: [PATCH 07/10] chore: add file utility fn --- src/utils/file.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/utils/file.js b/src/utils/file.js index d560ed2c..d1ed4967 100644 --- a/src/utils/file.js +++ b/src/utils/file.js @@ -1,3 +1,6 @@ +import fs from "fs"; +import path from "path"; + const FILE_EXTENSION_TO_PROGRAMMING_LANGUAGE_MAP = { in: "fortran", sh: "shell", @@ -28,3 +31,18 @@ export function formatFileSize(size, decimals = 2) { const units = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; return parseFloat((size / 1024 ** index).toFixed(decimals)) + " " + units[index]; } + +/** Get list of paths for files in a directory and filter by file extensions if provided. + * @param {string} dirPath - Path to current directory, i.e. $PWD + * @param {string[]} fileExtensions - File extensions to filter, e.g. `.yml` + * @param {boolean} resolvePath - whether to resolve the paths of files + * @returns {string[]} - Array of file paths + */ +export function getFilesInDirectory(dirPath, fileExtensions = [], resolvePath = true) { + let fileNames = fs.readdirSync(dirPath); + if (fileExtensions.length) { + fileNames = fileNames.filter((dirItem) => fileExtensions.includes(path.extname(dirItem))); + } + if (resolvePath) return fileNames.map((fileName) => path.resolve(dirPath, fileName)); + return fileNames; +} From d5c093cb44f2424e0a4024dee4e98593a49c50b6 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 30 May 2023 13:08:26 +0300 Subject: [PATCH 08/10] chore: clean up utility index --- src/utils/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index 7cbddc31..1f6f051a 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,9 +1,13 @@ import { compareEntitiesInOrderedSetForSorting } from "../entity/set/ordered/utils"; -import { convertToCompactCSVArrayOfObjects, isContainedByProperty, safeMakeArray } from "./array"; +import { convertToCompactCSVArrayOfObjects, safeMakeArray } from "./array"; import { cloneClass, extendClass, extendClassStaticProps, extendThis } from "./class"; import { deepClone } from "./clone"; import { refreshCodeMirror } from "./codemirror"; -import { formatFileSize, getProgrammingLanguageFromFileExtension } from "./file"; +import { + formatFileSize, + getFilesInDirectory, + getProgrammingLanguageFromFileExtension, +} from "./file"; import { filterEntityList } from "./filter"; import { addUnit, removeUnit, replaceUnit, setNextLinks, setUnitsHead } from "./graph"; import { @@ -83,5 +87,5 @@ export { includeType, generateName, filterEntityList, - isContainedByProperty, + getFilesInDirectory, }; From b0b3a6ef9c6e842b1821d07dfd635528217a5fd6 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 30 May 2023 15:01:10 +0300 Subject: [PATCH 09/10] chore: add utility fn for dirs --- src/utils/file.js | 12 ++++++++++++ src/utils/index.js | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/utils/file.js b/src/utils/file.js index d1ed4967..7b3af268 100644 --- a/src/utils/file.js +++ b/src/utils/file.js @@ -46,3 +46,15 @@ export function getFilesInDirectory(dirPath, fileExtensions = [], resolvePath = if (resolvePath) return fileNames.map((fileName) => path.resolve(dirPath, fileName)); return fileNames; } + +/** + * Get list of directories contained in current directory. + * @param {string} currentPath - current directory + * @return {*} + */ +export function getDirectories(currentPath) { + return fs + .readdirSync(currentPath, { withFileTypes: true }) + .filter((dirent) => dirent.isDirectory()) + .map((dirent) => dirent.name); +} diff --git a/src/utils/index.js b/src/utils/index.js index 1f6f051a..c65981fd 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -5,6 +5,7 @@ import { deepClone } from "./clone"; import { refreshCodeMirror } from "./codemirror"; import { formatFileSize, + getDirectories, getFilesInDirectory, getProgrammingLanguageFromFileExtension, } from "./file"; @@ -88,4 +89,5 @@ export { generateName, filterEntityList, getFilesInDirectory, + getDirectories, }; From 5ba232e2767c748701b973c915d54c64c029902f Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Thu, 1 Jun 2023 13:34:57 +0300 Subject: [PATCH 10/10] chore: use pure JS where possible --- src/utils/filter.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/utils/filter.js b/src/utils/filter.js index a6fdcf7e..254b42a7 100644 --- a/src/utils/filter.js +++ b/src/utils/filter.js @@ -7,16 +7,15 @@ import lodash from "lodash"; * @return {boolean} */ function isPathSupported(pathObject, filterObjects) { - return ( - lodash.find(filterObjects, (filterObj) => { - if (filterObj.path) { - return filterObj.path === pathObject.path; - } - if (filterObj.regex) { - return filterObj.regex.test(pathObject.path); - } - }) !== undefined - ); + return filterObjects.some((filterObj) => { + if (filterObj.path) { + return filterObj.path === pathObject.path; + } + if (filterObj.regex) { + return filterObj.regex.test(pathObject.path); + } + return false; + }); } /** @@ -28,7 +27,7 @@ function isPathSupported(pathObject, filterObjects) { */ function isMultiPathSupported(pathObject, multiPathSeparator, filterObjects) { const expandedPaths = pathObject.path.split(multiPathSeparator).map((p) => ({ path: p })); - return lodash.every(expandedPaths, (obj) => isPathSupported(obj, filterObjects)); + return expandedPaths.every((expandedPath) => isPathSupported(expandedPath, filterObjects)); } /**