{"name":"babel-plugin-transform-optional-chaining","version":"7.0.0-beta.3","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-beta.3"},"keywords":["babel-plugin"],"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-beta.3"},"_id":"babel-plugin-transform-optional-chaining@7.0.0-beta.3","_npmVersion":"5.5.1","_nodeVersion":"8.1.4","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"integrity":"sha512-ZTPWc2ZoXNRpKLyvC6jktG3Nhf0HxUpAv4yo0UCNrWeFraL33axgHPIjCduc3YylcukoXima1wMWepL/cgz87g==","shasum":"ffc7e1027e5720857e9b4f2e3b2115589b734218","tarball":"http://registry-npm.ywwl.com/babel-plugin-transform-optional-chaining/download/babel-plugin-transform-optional-chaining-7.0.0-beta.3.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDf8SCUzv5IvIHXoRkLt8WCtSTVLfWm9uIGrCR9l9l/kgIgKK8KNTp1V+qgTVvhpssRi7Tt2YIoU/e9S0hpYiIYgLs="}],"size":2054,"noattachment":false,"key":"/babel-plugin-transform-optional-chaining/-/babel-plugin-transform-optional-chaining-7.0.0-beta.3.tgz"},"maintainers":[{"email":"bng412@gmail.com","name":"existentialism"},{"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-beta.3.tgz_1508073118003_0.6133850836195052"},"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":1508073118940,"_cnpm_publish_time":1508073118940,"dist-tags":{"latest":"7.0.0-beta.3","next":"7.0.0-beta.3"}}