{"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":{"integrity":"sha512-CkdywZC2rJ8RGh+y3MM1fw1EJ4oO/oNExGbRFv0AQoMS+faTd3nO7slYjkj/6t8OnIMUE+wxh6G97YHhK1ytrw==","shasum":"e6ba93a3989f6ed18d685e7d99fb8d469b4beffc","tarball":"http://registry-npm.ywwl.com/deprecated-obj/download/deprecated-obj-2.0.0.tgz","fileCount":5,"unpackedSize":6170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfO7gCCRA9TVsSAnZWagAA2GoP/2xi3Go+e6hc7rdA0N18\nrVfG8TlwMdlh4Pult+sDukp01rYIuvvgb0yUhZLPr9Jm8t8zifFMKWgoQ7Wk\n/xL1Fh8gC13Jy/4TaSFzb/k4LBaVhg8pEAlqOMnlM6c+jhrMcehJa269U0rN\n6Nj2/PU3rpMTyhvL5pfWPqNdj8z6JBK2zBRrhX/KpXlD66ji3eyyraH+SoNT\nbj+GSZUfZIHiM73YLzXHPZMJWJm8XddyBHHQeKOnBFvwRO0jTrODvdkBK6M9\nofTSnjjVbDs+gtnCczOI6OoNQvySB1yqEj8TReOSUO2pc47Dftkv0najaUsO\nfJ/MHBcwEcwhAH/Qm9+x869UvX9nw6aoWs/ZHDDkzFYVvQzEbU8BzB5qtM4V\nV/BYbLlmRcd6jGY5zn9r5iWx6H5sa9hpwt8CLc5b9K+Ibo4E0iwmmePfP8J1\nborEcz3LHgGGozdERcs3CrEiAFrLkBZVxyqNEaOUzua12tOa6JHXo/RA+SYy\nUJK+fs9qk2PUP1YhXubsWfxleORhlHqFqgEDQvmMYYXSM1i7pjPFxHo/Mzsc\nWzXTEMVlWInN02qWEDhyQI4JBgcRufJgv19wjixCqnlLnOyVqV6LTEbWGlHi\n/Sd6LJXThBhPIjr4zIcIwbFcY6qaHrYBs/xtoz0aTVafcdTTBar5twthOZSX\n8pM9\r\n=CHdf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBZmFzBUpbsZHvnEvjiYNX06x8r/PJp5PLriXpO0mdAMAiEAsvW1rwGEQcrGoQcsHr4GeJiKfP03fvnucwjyeh81pZ4="}],"size":2467,"noattachment":false,"key":"/deprecated-obj/-/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,"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":1597749249916,"_cnpm_publish_time":1597749249916,"dist-tags":{"latest":"2.0.0"}}