{"id":16860471,"url":"https://github.com/webpro/deprecated-obj","last_synced_at":"2025-12-31T14:41:03.231Z","repository":{"id":60774782,"uuid":"163981870","full_name":"webpro/deprecated-obj","owner":"webpro","description":"Compares deprecations against a configuration object, and returns a compliant object and violations","archived":false,"fork":false,"pushed_at":"2020-08-18T11:14:02.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-02T20:37:51.738Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webpro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-03T14:15:43.000Z","updated_at":"2023-09-08T17:48:50.000Z","dependencies_parsed_at":"2022-10-04T16:31:27.145Z","dependency_job_id":null,"html_url":"https://github.com/webpro/deprecated-obj","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/webpro/deprecated-obj","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Fdeprecated-obj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Fdeprecated-obj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Fdeprecated-obj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Fdeprecated-obj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webpro","download_url":"https://codeload.github.com/webpro/deprecated-obj/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Fdeprecated-obj/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265816141,"owners_count":23833087,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T14:24:26.054Z","updated_at":"2025-12-31T14:41:03.189Z","avatar_url":"https://github.com/webpro.png","language":"JavaScript","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 \u003e 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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpro%2Fdeprecated-obj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebpro%2Fdeprecated-obj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpro%2Fdeprecated-obj/lists"}