throwIfContainsExtra
Stentor API Reference / stentor-utils/src / throwIfContainsExtra
Function: throwIfContainsExtra()
throwIfContainsExtra(
obj,restrictAttrs,undefinedPermitted?,onError?):void
Defined in: packages/stentor-utils/src/object/index.ts:171
A validation function that can check an object contains properties that should not exist in the object.
Parametersβ
objβ
object
The object to check.
restrictAttrsβ
string[]
The attributes to restrict to the object to. Will not check if empty.
undefinedPermitted?β
boolean
Set to true if the object is allowed to be undefined. Default is false in which case an error will be thrown.
onError?β
ValidationErrorHandler = defaultValidationErrorHandler
An optional error handler that allows for custom messages or actions. The keys passed in will be the keys that were not allowed in the object but were.
Returnsβ
void