{"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":{"integrity":"sha512-igs766xNtF7Fv/R//gT644e6dr+bT6kJrg+qyJA9affCyvf70UUNKIUIMUSROBg1sPUrBnENPsDdDHcBLI5wFQ==","shasum":"d7051278d2c141dc672ac3410d06642e990003b7","tarball":"http://registry-npm.ywwl.com/deprecated-obj/download/deprecated-obj-1.0.1.tgz","fileCount":6,"unpackedSize":6211,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc7ZNnCRA9TVsSAnZWagAAbcgP/Ruso2SLWm5YR5ivkMS4\nInbeVM7gkN6RjBIZbIGSbzMRWuTpBKGhPqMFfiSUXS45KMXrePvktOU8e04T\nyMoYhWqneWh4DQg3RgU9W2sohCVOt4hJCHB/1qH2jPIjxscNznOe+WZKpMay\nO+iSa3QLSEluMPcZCXjLWl7Qq6hvFLUUbCLDQJMWfs+ZnIKBNGOH5VcqTCvf\nE9XlgIJBNUO7yym1q7OtcEfV2IAyndUm7kn/Q+yxfebDO0pMunp9FdpmZwe7\nnRAA9CEWLSPqgCFLE5Jgu+iPevZj7VKNRZBrzUqYSVrqtNl2dLQ+pOYYfJ1/\nu+auE6GMi8or1eNyxzve9jbSSEbz/QOsIxniKlTx+tzLTZEF7PNMnI/KFPGk\nLTv+TN3+Fzj/wxWATXhXxReM1I5g+JFGNzSGjGhbmGzw4chi5kMKtl8ITLck\nADdNwW+PITOhqpPIRiIMA7nodIf0fzUFM2U28oMeCOnSnK/z379buFzINdpT\nHKLGxP6j9UacIc+Ci1jq74nSZH26sL0e2Sy7SWN+zJm/aoO7zsZyOQ4j2Ovt\nOBzcxOzSWfU+5xIlwBY3nNaIn266MyrKaeoejn2akL/kVe77qGzDOZSY8buK\nzyK9ORw/Ih4Mss/NFOFWtQ3Cf9ft9+AiBZrtZezvawA9mSVi4/Tt00iXjtnr\nlC0q\r\n=RlB7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCFabhVkJt16+aHfQB0OqCzt7GS9aKVEFFh3tgWG5LqgAIgGwv/kcFKjrj+amBLPKeJLBDW+OnLsefJJpANdLFR6Os="}],"size":2541,"noattachment":false,"key":"/deprecated-obj/-/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,"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":1559073638841,"_cnpm_publish_time":1559073638841,"dist-tags":{"latest":"2.0.0"}}