deprecated-obj
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,2 +0,2 @@ | ||
const { isPlainObject, forOwn, set, size } = require('lodash'); | ||
const { forOwn, has, isPlainObject, set, size } = require('lodash'); | ||
const flat = require('flat'); | ||
@@ -36,3 +36,3 @@ | ||
}); | ||
} else { | ||
} else if(!has(compliant, keys)) { | ||
set(compliant, keys, {}); | ||
@@ -39,0 +39,0 @@ } |
{ | ||
"name": "deprecated-obj", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Compares deprecations against a configuration object, and returns a compliant object and violations", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,3 +7,3 @@ # deprecated-obj | ||
``` | ||
```js | ||
const Deprecation = require('deprecation'); | ||
@@ -26,9 +26,5 @@ | ||
// or | ||
// Or flat: | ||
const deprecations = { 'old.deprecated': 'new.shiny', 'remove.me': null }; | ||
const deprecations = { | ||
"old.deprecated": "new.shiny", | ||
"remove.me": null | ||
} | ||
const deprecation = new Deprecation(deprecations, myConfig); | ||
@@ -41,5 +37,5 @@ ``` | ||
``` | ||
```js | ||
const myCompliant = deprecation.getCompliant(); | ||
→ { "fine": true, "new": { "shiny": true } } | ||
→ { fine: true, new: { shiny: true } } | ||
``` | ||
@@ -51,5 +47,5 @@ | ||
``` | ||
```js | ||
const violations = deprecation.getViolations(); | ||
→ { "old.deprecated": "new.shiny", "remove.me": null } | ||
→ { 'old.deprecated': 'new.shiny', 'remove.me': null } | ||
``` | ||
@@ -59,3 +55,3 @@ | ||
``` | ||
```js | ||
if (Object.keys(violations).length > 0) { | ||
@@ -68,1 +64,5 @@ console.warn(`Deprecated configuration options found. Please migrate before the next major release.`); | ||
``` | ||
## Example | ||
See [github.com/release-it/.../deprecated.js](https://github.com/webpro/release-it/blob/master/lib/deprecated.js) for a real-world example. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6211