Narrows an unknown value to an AnyJson if it is type-compatible*, or returns undefined otherwise.
* This is not a 100% safe operation -- it will not deeply validate plain object or array structures
to ensure that they contain only AnyJson values. When type-narrowing potential objects or arrays with this
function, it's the responsibility of the caller to understand the risks of making such a shallow type assertion
over the value data.
Narrows an
unknown
value to anAnyJson
if it is type-compatible*, or returnsundefined
otherwise.* This is not a 100% safe operation -- it will not deeply validate plain object or array structures to ensure that they contain only
AnyJson
values. When type-narrowing potential objects or arrays with this function, it's the responsibility of the caller to understand the risks of making such a shallow type assertion over thevalue
data.