cleaner-node
Advanced tools
Comparing version 0.11.7 to 0.12.0
{ | ||
"name": "cleaner-node", | ||
"version": "0.11.7", | ||
"version": "0.12.0", | ||
"description": "Helpful utilities and scripts to make Node projects more legible and easier for the next developer to take over.", | ||
@@ -35,6 +35,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"camelcase": "^6.0.0", | ||
"email-addresses": "^3.1.0", | ||
"camelcase": "^6.2.0", | ||
"email-addresses": "^4.0.0", | ||
"gravatar": "^1.8.1", | ||
"html-to-text": "^5.1.1", | ||
"html-to-text": "^7.1.1", | ||
"is-html": "^2.0.0", | ||
@@ -44,5 +44,5 @@ "jsonwebtoken": "^8.5.1", | ||
"md5-file": "^5.0.0", | ||
"moment": "^2.29.0", | ||
"semver": "^7.3.2", | ||
"uuid": "^8.3.0", | ||
"moment": "^2.29.1", | ||
"semver": "^7.3.5", | ||
"uuid": "^8.3.2", | ||
"uuid-validate": "0.0.3" | ||
@@ -49,0 +49,0 @@ }, |
@@ -54,1 +54,2 @@ # cleaner-node | ||
| 0.11.1 | 2020/09/14 | Add `files.findPackage`. Improved `env` logic. | | ||
| 0.12.0 | 2021/05/06 | Add `objects.circular` & `objects.copy`. | |
@@ -301,2 +301,22 @@ const { isValid: isValidString, toCamelCase } = require('./strings'); | ||
// safe stringify for circular (MDN official answer) | ||
const getCircularReplacer = () => { | ||
const seen = new WeakSet(); | ||
return (key, value) => { | ||
if (typeof value === 'object' && value !== null) { | ||
if (seen.has(value)) { | ||
return; | ||
} | ||
seen.add(value); | ||
} | ||
return value; | ||
}; | ||
}; | ||
const circular = (item) => { | ||
return JSON.stringify(item, getCircularReplacer()); | ||
}; | ||
const copy = item => { | ||
return JSON.parse(circular(item)); | ||
}; | ||
module.exports = { | ||
@@ -325,3 +345,7 @@ findOne, | ||
remove | ||
remove, | ||
circular, | ||
stringify: circular, | ||
copy | ||
}; |
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
77889
1972
55
+ Addeddeepmerge@4.3.1(transitive)
+ Addeddom-serializer@1.4.1(transitive)
+ Addeddomhandler@4.3.1(transitive)
+ Addeddomutils@2.8.0(transitive)
+ Addedemail-addresses@4.0.0(transitive)
+ Addedhtml-to-text@7.1.3(transitive)
+ Addedhtmlparser2@6.1.0(transitive)
- Removeddom-serializer@0.2.2(transitive)
- Removeddomelementtype@1.3.1(transitive)
- Removeddomhandler@2.4.2(transitive)
- Removeddomutils@1.7.0(transitive)
- Removedemail-addresses@3.1.0(transitive)
- Removedentities@1.1.2(transitive)
- Removedhtml-to-text@5.1.1(transitive)
- Removedhtmlparser2@3.10.1(transitive)
- Removedinherits@2.0.4(transitive)
- Removedlodash@4.17.21(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
Updatedcamelcase@^6.2.0
Updatedemail-addresses@^4.0.0
Updatedhtml-to-text@^7.1.1
Updatedmoment@^2.29.1
Updatedsemver@^7.3.5
Updateduuid@^8.3.2