{"name":"babel-plugin-transform-optional-chaining","version":"7.0.0-alpha.18","description":"Transform optional chaining operators into a series of nil checks","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-optional-chaining"},"license":"MIT","main":"lib/index.js","dependencies":{"babel-plugin-syntax-optional-chaining":"7.0.0-alpha.18"},"keywords":["babel-plugin"],"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-alpha.18"},"_id":"babel-plugin-transform-optional-chaining@7.0.0-alpha.18","_npmVersion":"5.3.0","_nodeVersion":"8.1.4","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"integrity":"sha512-sbocZpR8Mm801YN5H53CDHX3zlTv/aPbhEJx6SN9Zv7RilAa4fnMoq9mCz4Wt1p8r2O6SifbhAS3/yRam9capg==","shasum":"7725d0d366b3041bda4a550fbc8e67bdcdc20767","tarball":"http://registry-npm.ywwl.com/babel-plugin-transform-optional-chaining/download/babel-plugin-transform-optional-chaining-7.0.0-alpha.18.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDQcrdNnT3/PjjlXKLS3Qoa0tUV1//vy6BFauD5pSr3zAIgA46nKPvaZpn4DsVEs4bzE0CzrJHO3oagcIA17Mioydc="}],"size":2113,"noattachment":false,"key":"/babel-plugin-transform-optional-chaining/-/babel-plugin-transform-optional-chaining-7.0.0-alpha.18.tgz"},"maintainers":[{"email":"me@thejameskyle.com","name":"thejameskyle"},{"email":"sebmck@gmail.com","name":"sebmck"},{"email":"daniel@tschinder.de","name":"danez"},{"email":"hi@henryzoo.com","name":"hzoo"},{"email":"loganfsmyth@gmail.com","name":"loganfsmyth"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-optional-chaining-7.0.0-alpha.18.tgz_1501798871499_0.4298462285660207"},"directories":{},"readme":"# babel-plugin-transform-optional-chaining\n\nThe Optional Chaining Operator allows you to handle properties of deeply nested\nobjects without worrying about undefined intermediate objects.\n\n## Example\n\n### Accessing deeply nested properties\n\n```js\nconst obj = {\n  foo: {\n    bar: {\n      baz: 42,\n    },\n  },\n};\n\nconst baz = obj?.foo?.bar?.baz; // 42\n\nconst safe = obj?.qux?.baz; // undefined\n\n// Optional chaining and normal chaining can be intermixed\nobj?.foo.bar?.baz; // Only access `foo` if `obj` exists, and `baz` if\n                   // `bar` exists\n```\n\n### Calling deeply nested functions\n\n```js\nconst obj = {\n  foo: {\n    bar: {\n      baz() {\n        return 42;\n      },\n    },\n  },\n};\n\nconst baz = obj?.foo?.bar?.baz(); // 42\n\nconst safe = obj?.qux?.baz(); // undefined\nconst safe2 = obj?.foo.bar.qux?.(); // undefined\n\nconst willThrow = obj?.foo.bar.qux(); // Error: not a function\n\n// Top function can be called directly, too.\nfunction test() {\n  return 42;\n}\ntest?.(); // 42\n\nexists?.(); // undefined\n```\n\n### Constructing deeply nested classes\n\n```js\nconst obj = {\n  foo: {\n    bar: {\n      baz: class {\n      },\n    },\n  },\n};\n\nconst baz = new obj?.foo?.bar?.baz(); // baz instance\n\nconst safe = new obj?.qux?.baz(); // undefined\nconst safe2 = new obj?.foo.bar.qux?.(); // undefined\n\nconst willThrow = new obj?.foo.bar.qux(); // Error: not a constructor\n\n// Top classes can be called directly, too.\nclass Test {\n}\nnew Test?.(); // test instance\n\nnew exists?.(); // undefined\n```\n\n## Installation\n\n```sh\nnpm install --save-dev babel-plugin-syntax-optional-chaining\n```\n\n## Usage\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\"syntax-optional-chaining\"]\n}\n```\n\n### Via CLI\n\n```sh\nbabel --plugins syntax-optional-chaining script.js\n```\n\n### Via Node API\n\n```javascript\nrequire(\"babel-core\").transform(\"code\", {\n  plugins: [\"syntax-optional-chaining\"]\n});\n```\n\n## References\n\n* [Proposal: Optional Chaining](https://github.com/tc39/proposal-optional-chaining)\n","publish_time":1501798871628,"_cnpm_publish_time":1501798871628,"dist-tags":{"latest":"7.0.0-beta.3","next":"7.0.0-beta.3"}}