From 78932b4f8c595b7454af370b04fb9b781e31b986 Mon Sep 17 00:00:00 2001 From: Jesse Wright <63333554+jeswr@users.noreply.github.com> Date: Fri, 6 Sep 2024 23:42:18 +1000 Subject: [PATCH] chore: fix lint errors --- src/N3Store.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/N3Store.js b/src/N3Store.js index 6db515ef..a8e829c6 100644 --- a/src/N3Store.js +++ b/src/N3Store.js @@ -18,19 +18,15 @@ function merge(target, source, depth = 4) { } function intersect(s1, s2, depth = 4) { - let target = null; + let target = false; for (const key in s1) { if (key in s2) { - let intersection = null; - if (depth > 0) { - intersection = intersect(s1[key], s2[key], depth - 1); - if (intersection === null) - continue; + const intersection = depth === 0 ? null : intersect(s1[key], s2[key], depth - 1); + if (intersection !== false) { + target = target || Object.create(null); + target[key] = intersection; } - - target = target || Object.create(null); - target[key] = intersection; } } @@ -922,7 +918,8 @@ export default class N3Store { store._graphs = merge(Object.create(null), this._graphs); store._size = this._size; return store; - } else if ((other instanceof N3Store) && this._entityIndex === other._entityIndex) { + } + else if ((other instanceof N3Store) && this._entityIndex === other._entityIndex) { const store = new N3Store({ entityIndex: this._entityIndex }); store._graphs = intersect(other._graphs, this._graphs); store._size = null;