From 84a01449716d9ed56d493e93361445269a31d14d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Vy=C4=8D=C3=ADtal?= Date: Tue, 21 Jan 2020 22:18:57 +0100 Subject: [PATCH] style(layered-storage): unify the way existence is checked in core --- src/layered-storage/core.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/layered-storage/core.ts b/src/layered-storage/core.ts index 2d951622..b6dd4020 100644 --- a/src/layered-storage/core.ts +++ b/src/layered-storage/core.ts @@ -184,13 +184,13 @@ export class LayeredStorageCore< // Return cached value if it exists. const cached = segmentCache.get(key); - if (cached) { + if (typeof cached !== "undefined") { return cached; } // Search the layers from highest to lowest priority. for (const layerData of this._layerDatas) { - if (layerData == null) { + if (typeof layerData === "undefined") { // Empty layer. continue; } @@ -249,7 +249,7 @@ export class LayeredStorageCore< ): { layerData: LayerData; segmentData: SegmentData } { // Get or create the requested layer. let layerData = this._data.get(layer); - if (layerData == null) { + if (typeof layerData === "undefined") { layerData = new Map(); this._data.set(layer, layerData); @@ -260,7 +260,7 @@ export class LayeredStorageCore< // Get or create the requested segment on the layer. let segmentData = layerData.get(segment); - if (segmentData == null) { + if (typeof segmentData === "undefined") { segmentData = new Map(); layerData.set(segment, segmentData);