{"name":"deprecated-obj","version":"1.0.0","description":"Compares deprecations against a configuration object, and returns a compliant object and violations","main":"index.js","scripts":{"test":"node test.js"},"keywords":["deprecate","deprecated","configuration"],"author":{"name":"Lars Kappert","email":"lars@webpro.nl"},"license":"MIT","dependencies":{"flat":"^4.1.0","lodash":"^4.17.11"},"repository":{"type":"git","url":"git+https://github.com/webpro/deprecated-obj.git"},"homepage":"https://github.com/webpro/deprecated-obj#readme","bugs":{"url":"https://github.com/webpro/deprecated-obj/issues"},"gitHead":"4dbcaa2512b8114c77a8461795d739b6f4811432","_id":"deprecated-obj@1.0.0","_npmVersion":"6.5.0","_nodeVersion":"10.14.2","_npmUser":{"name":"webpro","email":"lars@webpro.nl"},"dist":{"integrity":"sha512-CkoAaiIjJnT0YmOoFwBo2qKQ5XMXo6+QYcvskzT6v0o5+kAmdQvfKbqxcHxcR2zQpi7dRD4CpOzppp9ivvRbEg==","shasum":"01f60ae7a344a385cb16223eaf3b1a42b04c3a2f","tarball":"http://registry-npm.ywwl.com/deprecated-obj/download/deprecated-obj-1.0.0.tgz","fileCount":6,"unpackedSize":6023,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcLhzDCRA9TVsSAnZWagAAkUEP/3o8yLivKcd9gxRBpdYm\nk4SQ0vRFsdxNDd+9jEvsrh3dPt3l6ppLN3ArU/i048NsXvJIeXsKqGdVS6pI\nMy9rv/tF7ks+5Foyspo+N+0B7bKc1bdcZDiFIasBHOUl1//w9MSlHspWSBhq\nKg4DiatSXxx5d5rbWr4LawDcVBVCMyu6AaeOMyHINRnMz6t3vUeLBXIJb+3F\nxqlcTEII2jY3T9ytkyHwZr5q48Oe2ddNHpV4jye8ul2ubOOWpBH5zThbKJxT\nuk9ivOJFRTSDFeFrbekoWKR94CWmvPuckr98DyQ7wEMuyyAtozUdyrxX2sHW\nuhKSDz028V19kIehFhYBdZf6EnhFlNir+1sUoFa7Y17B7R/6+QqeFx3W9ik3\nGGqI53q87B9yNdcD2qTo2Xu2s5d5nutlq1t82vzL0SFZcIWC9MuNc5lrJHt0\nEyaUzciN5clIJfHamdIvszLDAJ6R21dKpu/tX11NjwGaiweRzRChOrgBh7GH\nyZzmN+kOy4dEzvxNyy1Yv2ZxVLjE6DD7Z2G1jk1OKd7Gi5+8lYovZny+Fa4B\nrMuWRjCPeGrHwaxe3emZurUTjAR1oDE+D4Wc/1PAPg7qHVIo0YDRiCojB0Zv\nZrTAIvK4TneAdKo2HtcdDy8sGmV6vQQgKgDD2QT7hJM8ZAV7hnHIJHyTZGXN\n3D7J\r\n=c7xt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBZmB8nVhDLbjnMlgm8O+n+nv6yXmGM3rrX41tvi1L9EAiEA2eAWQaxY12XexmzYvJl45zrbBQ7f5uX49DZgqbRFmJM="}],"size":2490,"noattachment":false,"key":"/deprecated-obj/-/deprecated-obj-1.0.0.tgz"},"maintainers":[{"name":"webpro","email":"lars@webpro.nl"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/deprecated-obj_1.0.0_1546525890386_0.3203115787608066"},"_hasShrinkwrap":false,"readme":"# deprecated-obj\n\nSimple utility to help making the transition from deprecated configuration objects to compliant ones.\n\n## Usage\n\n```js\nconst Deprecation = require('deprecation');\n\nconst myConfig = {\n  fine: true,\n  old: {\n    deprecated: true\n  },\n  'remove.me': 1\n};\n\nconst deprecations = {\n  old: {\n    deprecated: 'new.shiny'\n  },\n  'remove.me': null\n};\n\n// Or flat:\nconst deprecations = { 'old.deprecated': 'new.shiny', 'remove.me': null };\n\nconst deprecation = new Deprecation(deprecations, myConfig);\n```\n\n## API\n\n### `Deprecation::getCompliant()`\n\n```js\nconst myCompliant = deprecation.getCompliant();\n→ { fine: true, new: { shiny: true } }\n```\n\nReturns a new, compliant object. The `null` values in `deprecations` are excluded.\n\n### `Deprecation::getViolations()`\n\n```js\nconst violations = deprecation.getViolations();\n→ { 'old.deprecated': 'new.shiny', 'remove.me': null }\n```\n\nThe violations can be used to inform the user about the deprecations, for example:\n\n```js\nif (Object.keys(violations).length > 0) {\n  console.warn(`Deprecated configuration options found. Please migrate before the next major release.`);\n}\nfor (let deprecated in violations) {\n  console.warn(`The \"${deprecated}\" option is deprecated. Please use \"${violations[deprecated]}\" instead.`);\n}\n```\n\n## Example\n\nSee [github.com/release-it/.../deprecated.js](https://github.com/webpro/release-it/blob/master/lib/deprecated.js) for a real-world example.\n","publish_time":1546525890613,"_cnpm_publish_time":1546525890613,"dist-tags":{"latest":"2.0.0"}}