@soos-io/api-client
Advanced tools
Comparing version 0.1.6-pre.1 to 0.1.6-pre.2
declare const isNil: (value: unknown) => value is null | undefined; | ||
declare const ensureValue: <T>(value: T | null | undefined, propertyName: string) => T; | ||
declare const ensureEnumValue: <T, TEnumObject extends Record<string, T> = Record<string, T>>(enumObject: TEnumObject, inputValue: string | null | undefined, ignoreCase?: boolean, excludeDefault?: boolean) => T | undefined; | ||
declare const ensureEnumValue: <T, TEnumObject extends Record<string, T> = Record<string, T>>(enumObject: TEnumObject, inputValue: string | null | undefined, ignoreCase: boolean | undefined, excludeDefault: [string, string | number] | undefined) => T | undefined; | ||
declare const sleep: (ms: number) => Promise<unknown>; | ||
@@ -5,0 +5,0 @@ declare const isUrlAvailable: (url: string) => Promise<boolean>; |
@@ -15,3 +15,3 @@ "use strict"; | ||
exports.ensureValue = ensureValue; | ||
const ensureEnumValue = (enumObject, inputValue, ignoreCase = true, excludeDefault = true) => { | ||
const ensureEnumValue = (enumObject, inputValue, ignoreCase = true, excludeDefault) => { | ||
if (isNil(inputValue)) { | ||
@@ -27,3 +27,3 @@ return undefined; | ||
}); | ||
if (isNil(option) || excludeDefault) { | ||
if (isNil(option) || (excludeDefault && option === excludeDefault)) { | ||
throw new Error(`Invalid enum value '${inputValue}'. Valid options are: ${options | ||
@@ -30,0 +30,0 @@ .map(([, value]) => value) |
{ | ||
"name": "@soos-io/api-client", | ||
"version": "0.1.6-pre.1", | ||
"version": "0.1.6-pre.2", | ||
"description": "This is the SOOS API Client for registered clients leveraging the various integrations to the SOOS platform.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
34907