Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-helper-utilities

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-helper-utilities - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

coverage/coverage.json

6

History.md
2.1.0 / 2015-10-16
==================
* docs: update documentation for clean method
* code: add support for clean method
2.0.1 / 2015-10-01

@@ -3,0 +9,0 @@ ==================

@@ -11,2 +11,29 @@ 'use strict';

function clean(obj) {
if(obj === null || typeof obj !== 'object') {
return obj;
}
if(obj instanceof Array) {
return obj.filter(function(item) {
return !!clean(item);
});
}
if(obj instanceof Date) {
return obj;
}
var r = {};
Object.keys(obj).forEach(function(key) {
var item = clean(obj[key]);
if(!!item) {
r[key] = item;
}
});
return r;
}
function clone(obj) {

@@ -193,2 +220,3 @@ var copy;

clone: clone,
clean: clean,
merge: merge,

@@ -195,0 +223,0 @@ cluster: setupCluster,

2

package.json
{
"name": "node-helper-utilities",
"version": "2.0.1",
"version": "2.1.0",
"description": "Generic helper utilities",

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

@@ -21,2 +21,19 @@ node-helper-utilities

### Clean: Filter out all non-true values
```js
var util = require('./');
var obj = {
a: false,
b: true
};
var b = util.clean(obj);
console.log(b);
// {
// b: true
// }
```
### Clone: Clone an object

@@ -128,3 +145,3 @@

});
util

@@ -135,4 +152,4 @@ .compare('password', hashed)

})
.catch(function(err) {
console.log(err);
.catch(function(err) {
console.log(err);
});

@@ -159,3 +176,3 @@ ````

Often when you deal with async processes and have to pass data as JSON around, there is always potential for errors.
Often when you deal with async processes and have to pass data as JSON around, there is always potential for errors.
This function is to parse json safely, and return a promise.

@@ -213,3 +230,3 @@

All tests are within `tests`.
All tests are within `tests`.

@@ -220,5 +237,8 @@ Run tests using `make test` or `make test-cov` for test coverage.

- `0.10`
- `0.11`
- `0.10`
- `0.11`
- `0.12`
- `iojs` (latest)
- `1.x`
- `2.x`
- `3.x`
- `4.x`
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