Socket
Socket
Sign inDemoInstall

cleaner-node

Package Overview
Dependencies
Maintainers
1
Versions
175
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cleaner-node - npm Package Compare versions

Comparing version 0.15.0 to 0.15.1

2

package.json
{
"name": "cleaner-node",
"version": "0.15.0",
"version": "0.15.1",
"description": "Helpful utilities and scripts to make Node projects more legible and easier for the next developer to take over.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -57,2 +57,3 @@ # cleaner-node

| 0.14.0 | 2021/08/08 | Add `strings.trimToNull`. |
| 0.15.0 | 2021/08/08 | Add `numbers.random`. |
| 0.15.0 | 2021/08/23 | Add `numbers.random`. |
| 0.15.1 | 2021/08/29 | Add `constants.regex`. |

@@ -45,2 +45,6 @@ const wells = require('know-your-http-well');

}
},
regex: {
ALPHANUMERIC_DELIMITED: '^[a-zA-Z\\d-_]+$',
ENUM_NAMES: '^[a-zA-Z\\d_]+$'
}

@@ -47,0 +51,0 @@ };

@@ -100,22 +100,22 @@ const { isValid: isValidString, toCamelCase } = require('./strings');

const toDto = value => {
if (typeof value === 'undefined') { return value; }
if (value instanceof Array) { return value; }
const copy = JSON.parse(JSON.stringify(value));
const keys = Object.keys(copy).filter(isValidString);
// eslint-disable-next-line no-eq-null
const targets = keys.filter(k => (copy[k] == null));
if (keys.includes('id') && keys.includes('uid') && !targets.includes('id') && !targets.includes('uid')) {
targets.push('id');
}
targets.forEach(key => {
Reflect.deleteProperty(copy, key);
});
return copy;
};
const toDtos = values => {
return [].concat(values)
.filter(v => (typeof v !== 'undefined'))
.map(v => (toDto(v)));
};
// const toDto = value => {
// if (typeof value === 'undefined') { return value; }
// if (value instanceof Array) { return value; }
// const copy = JSON.parse(JSON.stringify(value));
// const keys = Object.keys(copy).filter(isValidString);
// // eslint-disable-next-line no-eq-null
// const targets = keys.filter(k => (copy[k] == null));
// if (keys.includes('id') && keys.includes('uid') && !targets.includes('id') && !targets.includes('uid')) {
// targets.push('id');
// }
// targets.forEach(key => {
// Reflect.deleteProperty(copy, key);
// });
// return copy;
// };
// const toDtos = values => {
// return [].concat(values)
// .filter(v => (typeof v !== 'undefined'))
// .map(v => (toDto(v)));
// };

@@ -350,4 +350,4 @@ // --- getValue ... from singular property

setValue,
toDto,
toDtos,
// toDto,
// toDtos,
toPrintable,

@@ -354,0 +354,0 @@ print,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc