{"_id":"@sherby/sherby-nested-property","_rev":"1-d828d6fee656060e7dc7dc5352dab125","name":"@sherby/sherby-nested-property","dist-tags":{"latest":"2.0.0-rc.1"},"versions":{"2.0.0-rc.1":{"name":"@sherby/sherby-nested-property","flat":true,"version":"2.0.0-rc.1","author":{"name":"Benjamin Rancourt","email":"benjamin.rancourt@usherbrooke.ca"},"description":"A Polymer 3 mixin to add functions to obtain a nested property of an object","scripts":{"format":"npm-run-all format:*","format:js":"eslint . --ext js --fix","format:json":"eslint . --ext json --fix","format:markdown":"eslint . --ext md --fix","format:polymer":"polymer lint --fix","lint":"npm-run-all lint:*","lint:js":"eslint . --ext js","lint:json":"eslint . --ext json","lint:markdown":"eslint . --ext md","lint:polymer":"polymer lint","test":"polymer test"},"repository":{"type":"git","url":"git+https://github.com/SherbyElements/sherby-nested-property.git"},"keywords":["get","nested","polymer","properties","property","sherby","webcomponents"],"license":"MIT","bugs":{"url":"https://github.com/SherbyElements/sherby-nested-property/issues"},"homepage":"https://github.com/SherbyElements/sherby-nested-property","devDependencies":{"@polymer/polymer":"^3.0.2","@polymer/iron-demo-helpers":"^3.0.0-pre.19","@webcomponents/webcomponentsjs":"^2.0.0","wct-browser-legacy":"^1.0.0","eslint-config-udes":"^0.2.1","npm-run-all":"^4.1.3"},"gitHead":"a6f6d56347dbfe59e7bb5f128ad57ef7999ecb4a","_id":"@sherby/sherby-nested-property@2.0.0-rc.1","_npmVersion":"6.0.1","_nodeVersion":"9.5.0","_npmUser":{"name":"ranb2002","email":"benjamin.rancourt@usherbrooke.ca"},"dist":{"integrity":"sha512-7lVO+3/+ViVo1k9MzXvSeRKiQpb+wuwOkZXFXg7vzmuzzYH4qdTx/YYWd/n6JQnZfKjbsrNREl5RBQ26iVqMQw==","shasum":"9ae429b3fedf17254d922f7f1547a5ce56b99ee0","tarball":"https://registry.npmjs.org/@sherby/sherby-nested-property/-/sherby-nested-property-2.0.0-rc.1.tgz","fileCount":5,"unpackedSize":6416,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa+I7hCRA9TVsSAnZWagAAXlYP/jbz1zltQ4sb15JJ0LbQ\n6FI4+wTIuHpu8qE5ADgQUg3HgYhk3RVxUXVAIq+iRD0M8q9bAHpuX4op0bsH\nWJ1mJ4HOWJEDtpET8AUcWphuCD3zoPbtt19cwD++cxu3b1gxXymg+NlhQUd0\nzEYdNJ00JD2Jeqqo6ibhleSqrKbrCDqZ8jfmim9jL2/Q+4JtTdgWJgdn3Nqz\nOCTcOB2dW6K9XcwZXWLgILVF+6ZhjPoMAGUL0PZtQEV54NjRpMEuGLdEp0dH\nXtCaYwaBE4iOqoQb1VFJOXMWHUHui6f85shD4jBft+PcW1mTnapAhA5Sl1If\n4kECZ0Q1UJTrXZr/3lZO8lYnGDQJWYxy+4mz+8T5II3tQh8vy8Fjybob7cti\nH1A5aK1LI8PYk3hjJObpw5uXoB8k9g/7wgo7pxzqThrs2FDnT4y8HyA1zN/k\naIzRVJIiYRggkOnrRYLWw4+0oW9qvf0XSdT0TqUnTuColIaEqRlSqZP2WLcK\nCWiqnU6QG9eKudRZ5JQbJIs5AdslbfTt7d7ZTUbrvhQMH6ZWOe8XJPN+hCCp\nOQuwnFaLXFXAGeTmweia5h6J6Rg4E/SnfT1F0Gdoav05o4xpcgMbB6F8/cDv\nOjG389dx2e09sHoV0nnUenJcWmBaI5WACF8iw9/u4XAfDWXDdNKiV9sU6tk0\n8D/7\r\n=qozY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEbTMAFNFPaxZW3Dt0QTLmIFtwBauo4f7t8xOPwq+7sOAiEA+LMvdVJ75uki5NN3W/7NmIR3FS4C9b6fPhQN9scGl0s="}]},"maintainers":[{"name":"ranb2002","email":"benjamin.rancourt@usherbrooke.ca"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sherby-nested-property_2.0.0-rc.1_1526238943925_0.3499536726030601"},"_hasShrinkwrap":false}},"time":{"created":"2018-05-13T19:15:43.644Z","2.0.0-rc.1":"2018-05-13T19:15:43.989Z","modified":"2022-04-06T23:13:08.513Z"},"maintainers":[{"name":"ranb2002","email":"benjamin.rancourt@usherbrooke.ca"}],"description":"A Polymer 3 mixin to add functions to obtain a nested property of an object","homepage":"https://github.com/SherbyElements/sherby-nested-property","keywords":["get","nested","polymer","properties","property","sherby","webcomponents"],"repository":{"type":"git","url":"git+https://github.com/SherbyElements/sherby-nested-property.git"},"author":{"name":"Benjamin Rancourt","email":"benjamin.rancourt@usherbrooke.ca"},"bugs":{"url":"https://github.com/SherbyElements/sherby-nested-property/issues"},"license":"MIT","readme":"[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/SherbyElements/sherby-nested-property)\n[![Build status](https://travis-ci.org/SherbyElements/sherby-nested-property.svg?branch=master)](https://travis-ci.org/SherbyElements/sherby-nested-property)\n\n## sherby-nested-property\nA **Polymer 3** mixin to add functions to obtain a nested property of an object.\n\nInstead of using multiples `&&` to ensure that an object have a nested value, you could use the \n`NestedPropertyMixin` to obtain the value if defined.\n\n```javascript\nconst data = {\n  webcomponents: {\n    'polymer-3': {\n      npm: true,\n      modules: true,\n    },\n    'polymer-2': {\n      bower: true,\n    },\n  },\n};\n\nlet npm;\nif (data && data.webcomponents && data.webcomponents['polymer-3'] && data.webcomponents['polymer-3'].npm) {\n  npm = data.webcomponents['polymer-3'].npm;\n}\n\n// eslint-disable-next-line no-console\nconsole.log(npm);\n```\n\n```javascript\nconst data = {\n  webcomponents: {\n    'polymer-3': {\n      npm: true,\n      modules: true,\n    },\n    'polymer-2': {\n      bower: true,\n    },\n  },\n};\n\nconst npm = this.getNestedPropertyOf(data, 'webcomponents.polymer-3.npm');\n\n// eslint-disable-next-line no-console\nconsole.log(npm);\n```\n\n## Installation\nAs Polymer 3 use npm, you must use it to install this component:\n\n```bash\nnpm install @sherby/sherby--nested-property\n```\n\nFor the **Polymer 2** version, use the `SherbyElements/sherby-nested-property#^v1.0.0` inside your bower.json file.\n\n```bash\nbower install SherbyElements/sherby-nested-property --save\n```\n\n## Use\nInmport the mixin \n```javascript\nimport { PolymerElement } from '@polymer/polymer/polymer-element.js';\nimport { SherbyNestedPropertyMixin } from '@sherby/sherby-nested-property/sherby-nested-property-mixin.js';\n\n/* eslint-disable no-unused-vars */\n\n/**\n * @customElement\n * @polymer\n * @extends {PolymerElement}\n * @appliesMixin SherbyNestedPropertyMixin\n */\nclass Polymer3Element extends SherbyNestedPropertyMixin(PolymerElement) {\n  // Use the getNestedProperty or the getNestedPropertyOf functions\n  computeData(data) {\n    const npm = this.getNestedPropertyOf(data, 'webcomponents.polymer-3.npm');\n\n    // eslint-disable-next-line no-console\n    console.log(npm);\n  }\n}\n```\n","readmeFilename":"README.md"}