{"name":"babel-plugin-transform-optional-chaining","version":"7.0.0-beta.2","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.2"},"keywords":["babel-plugin"],"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-beta.2"},"_id":"babel-plugin-transform-optional-chaining@7.0.0-beta.2","_npmVersion":"5.4.1","_nodeVersion":"8.1.4","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"integrity":"sha512-F0Rpsv17zGRRdc9ecp08F8WmxvQlgiwZng0I9jTUKYVgY9egJYeckIXoLBo4oDW7iSRdzbT8G6RYaflMgxmtWg==","shasum":"2a21b2cca6df0de5a1794cf4e203726391df766a","tarball":"http://registry-npm.ywwl.com/babel-plugin-transform-optional-chaining/download/babel-plugin-transform-optional-chaining-7.0.0-beta.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDZ2MqNev0QcdZGmqz6Uy7j7oY2hkdp1To+3OSXPeHPpAiEAhHQ7kmX/6rqK1bhao99YVEqOHqY9AkkyTDrQ21vVPVo="}],"size":2057,"noattachment":false,"key":"/babel-plugin-transform-optional-chaining/-/babel-plugin-transform-optional-chaining-7.0.0-beta.2.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.2.tgz_1506438930235_0.8869512465316802"},"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":1506438931077,"_cnpm_publish_time":1506438931077,"dist-tags":{"latest":"7.0.0-beta.3","next":"7.0.0-beta.3"}}