{"_id":"deprecated-obj","_rev":"826828","name":"deprecated-obj","description":"Compares deprecations against a configuration object, and returns a compliant object and violations","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"webpro","email":"lars@webpro.nl"}],"time":{"modified":"2021-09-13T09:11:00.000Z","created":"2019-01-03T14:31:30.613Z","2.0.0":"2020-08-18T11:14:09.916Z","1.0.1":"2019-05-28T20:00:38.841Z","1.0.0":"2019-01-03T14:31:30.613Z"},"users":{},"author":{"name":"Lars Kappert","email":"lars@webpro.nl"},"repository":{"type":"git","url":"git+https://github.com/webpro/deprecated-obj.git"},"versions":{"2.0.0":{"name":"deprecated-obj","version":"2.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":"^5.0.2","lodash":"^4.17.20"},"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"},"engines":{"node":">=10"},"gitHead":"923a8ce810613fe186174a677bf7c6c63f3e70ca","_id":"deprecated-obj@2.0.0","_nodeVersion":"12.18.0","_npmVersion":"6.14.8","dist":{"shasum":"e6ba93a3989f6ed18d685e7d99fb8d469b4beffc","size":2467,"noattachment":false,"key":"/deprecated-obj/-/deprecated-obj-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/deprecated-obj/download/deprecated-obj-2.0.0.tgz"},"maintainers":[{"name":"webpro","email":"lars@webpro.nl"}],"_npmUser":{"name":"webpro","email":"lars@webpro.nl"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/deprecated-obj_2.0.0_1597749249795_0.5283189147948275"},"_hasShrinkwrap":false,"publish_time":1597749249916,"_cnpm_publish_time":1597749249916},"1.0.1":{"name":"deprecated-obj","version":"1.0.1","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":"623acd066fbf307a49f0f6b3968c608d814f9051","_id":"deprecated-obj@1.0.1","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"shasum":"d7051278d2c141dc672ac3410d06642e990003b7","size":2541,"noattachment":false,"key":"/deprecated-obj/-/deprecated-obj-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/deprecated-obj/download/deprecated-obj-1.0.1.tgz"},"maintainers":[{"name":"webpro","email":"lars@webpro.nl"}],"_npmUser":{"name":"webpro","email":"lars@webpro.nl"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/deprecated-obj_1.0.1_1559073638649_0.6166383677394118"},"_hasShrinkwrap":false,"publish_time":1559073638841,"_cnpm_publish_time":1559073638841},"1.0.0":{"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":{"shasum":"01f60ae7a344a385cb16223eaf3b1a42b04c3a2f","size":2490,"noattachment":false,"key":"/deprecated-obj/-/deprecated-obj-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/deprecated-obj/download/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,"publish_time":1546525890613,"_cnpm_publish_time":1546525890613}},"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","_attachments":{},"homepage":"https://github.com/webpro/deprecated-obj#readme","bugs":{"url":"https://github.com/webpro/deprecated-obj/issues"},"license":"MIT"}