Skip to content

assertcheck v1.0.0


assertcheck / assert / hasOnlyKeys

Function: hasOnlyKeys()

ts
function hasOnlyKeys(
   obj, 
   allowed, 
   opts?): void;

Defined in: src/assert.ts:1589

Asserts that obj contains only keys from the allowed list.

Parameters

ParameterType
objobject
allowedstring[]
opts?Opts

Returns

void

Example

ts
`assert.hasOnlyKeys(patch, ["name","email"], "patch contains immutable fields")`

Released under the Apache 2.0 License. Built by Vagabond Studio — senior-only for growing companies.