From 09d9c8e40630e57bc18bbd9c544d185f2098ad31 Mon Sep 17 00:00:00 2001 From: Dennis Hendriksen Date: Thu, 7 Jan 2021 08:56:57 +0100 Subject: [PATCH] hasAny and anyHasAny missing value handling --- package-lock.json | 2 +- package.json | 2 +- src/index.ts | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6263747..1af345d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@molgenis/vip-report-api", - "version": "0.5.0", + "version": "0.5.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index d87f02e..59fcb05 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@molgenis/vip-report-api", - "version": "0.5.0", + "version": "0.5.1", "description": "Report API for Variant Call Format (VCF) Report Templates", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/index.ts b/src/index.ts index 1e93022..0be0a87 100644 --- a/src/index.ts +++ b/src/index.ts @@ -386,6 +386,10 @@ function matchesIn(query: Query, resource: Resource): boolean { function matchesAnyHasAny(query: Query, resource: Resource): boolean { const value: any = select(query.selector, resource); + if (value === undefined) { + return false; + } + if (!Array.isArray(value)) { throw new Error(`value '${value}' is of type '${typeof value}' instead of 'array'`); } @@ -405,6 +409,10 @@ function matchesAnyHasAny(query: Query, resource: Resource): boolean { function matchesHasAny(query: Query, resource: Resource): boolean { const value: any = select(query.selector, resource); + if (value === undefined) { + return false; + } + if (!Array.isArray(value)) { throw new Error(`value '${value}' is of type '${typeof value}' instead of 'array'`); }