optional-chain-proxy
Optional chain access implementation in TypeScript.
Uses Proxy API
Install
npm install optional-chain-proxy
Usage
; ; // { name: null };optionalUser.name.first; // undefined, does not throw an exception.
API
optional-chain-proxy
exports optional
function.
optional
function lets a target object or an array and return the object which does not throw an exception even if accessing to null or undefined values.
optional
optionalobject: T :: T