@xapp/dynamo-service
Advanced tools
Comparing version 0.0.88 to 0.0.89
@@ -5,3 +5,3 @@ export declare function objHasAttrs(obj: object): boolean; | ||
export declare function throwIfDoesContain(obj: string[], bannedAttrs: string[], onError?: ValidationErrorHandler): void; | ||
export declare function throwIfDoesNotContain<T>(obj: T, requiredAttrs: string[], undefinedPermitted?: boolean, onError?: ValidationErrorHandler): void; | ||
export declare function throwIfDoesNotContain<T>(obj: T, requiredAttrs: (keyof T)[], undefinedPermitted?: boolean, onError?: ValidationErrorHandler): void; | ||
export declare function throwIfContainsExtra<T extends object>(obj: T, restrictAttrs: (keyof T)[], undefinedPermitted?: boolean, onError?: ValidationErrorHandler): void; | ||
@@ -8,0 +8,0 @@ export declare function subset<T>(obj: T, attrs: string[]): Partial<T>; |
@@ -35,11 +35,12 @@ "use strict"; | ||
} | ||
const subs = subset(obj, requiredAttrs); | ||
const keys = Object.keys(subs); | ||
if (keys.length !== requiredAttrs.length) { | ||
const difference = requiredAttrs.filter((key) => { | ||
return keys.indexOf(key) < 0; | ||
}); | ||
const error = new Error("Object must contain keys: '" + difference.join(", ")); | ||
onError(difference, error); | ||
const missingKeys = []; | ||
for (const requiredAttr of requiredAttrs) { | ||
const value = obj[requiredAttr]; | ||
if (value == null) { | ||
missingKeys.push(requiredAttr); | ||
} | ||
} | ||
if (missingKeys.length > 0) { | ||
onError(missingKeys, new Error("Object must contain keys: '" + missingKeys.join(", "))); | ||
} | ||
} | ||
@@ -46,0 +47,0 @@ exports.throwIfDoesNotContain = throwIfDoesNotContain; |
{ | ||
"name": "@xapp/dynamo-service", | ||
"version": "0.0.88", | ||
"version": "0.0.89", | ||
"description": "A dynamo help class which will help maintain data integrity.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
145258
28
3894
1