Package Exports
- trespass
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (trespass) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
trespass
Access and chain object properties and methods in a safe manner.
Installation
npm install --save trespass
Usage
import t from 'trespass';
t(null).foo.$; // access undefined properties
t(undefined).bar().$; // call undefined methods
t(undefined).bar().baz.$; // call undefined methods, and then access undefined properties
const t2 = t.createWrapper('$val'); // trespass with custom terminator
t2(foo).bar.$val;
Requirements
Node 6.4+. Native Browser support for ES6 Proxies.
Why
Because the official Optional Chaining ?.
proposal is still in stage-1 currently, see https://github.com/tc39/proposal-optional-chaining.
Other packages
- https://github.com/facebookincubator/idx
- https://github.com/ktsn/safe-object-proxy
- https://github.com/erictrinh/safe-proxy
- https://github.com/forceuser/access-deep
- https://github.com/tonylukasavage/safeproxy
Community
Let's start one together! After you ★ this project, follow me @rygu on Twitter.
License
BSD 3-Clause license. Copyright © 2017, Rick Wong. All rights reserved.