Socket
Socket
Sign inDemoInstall

hoek

Package Overview
Dependencies
Maintainers
3
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hoek - npm Package Compare versions

Comparing version 0.10.0 to 1.0.0

AUTHORS

19

lib/index.js

@@ -586,1 +586,20 @@ // Load modules

};
exports.readStream = function (stream, callback) {
var result = '';
stream.on('readable', function () {
var read = stream.read();
if (read) {
result += read.toString();
}
});
stream.once('end', function () {
callback(result);
});
};

9

package.json
{
"name": "hoek",
"description": "General purpose node utilities",
"version": "0.10.0",
"author": "Eran Hammer <eran@hueniverse.com> (http://hueniverse.com)",
"contributors":[
"Van Nguyen <the.gol.effect@gmail.com>"
],
"version": "1.0.0",
"repository": "git://github.com/spumko/hoek",

@@ -20,4 +16,3 @@ "main": "index",

"devDependencies": {
"lab": "0.1.x",
"complexity-report": "0.x.x"
"lab": "0.2.x"
},

@@ -24,0 +19,0 @@ "scripts": {

@@ -41,2 +41,4 @@ <a href="https://github.com/spumko"><img src="https://raw.github.com/spumko/spumko/master/images/from.png" align="right" /></a>

* [loadDirModules](#loadDirModulespath-excludefiles-target "loaddirmodules")
* [Streams](#streams "Streams")
* [readStream](#readstream "readStream")

@@ -47,3 +49,3 @@

The *Hoek* general purpose node utilities library is used to aid in a variety of manners. It comes with useful methods for Arrays (clone, merge, applyToDefaults), Objects (removeKeys, copy), Asserting and more.
The *Hoek* general purpose node utilities library is used to aid in a variety of manners. It comes with useful methods for Arrays (clone, merge, applyToDefaults), Objects (removeKeys, copy), Asserting and more.

@@ -69,3 +71,3 @@ For example, to use Hoek to set configuration with default options:

This method is used to clone an object or an array. A *deep copy* is made (duplicates everything, including values that are objects).
This method is used to clone an object or an array. A *deep copy* is made (duplicates everything, including values that are objects).

@@ -177,3 +179,3 @@ ```javascript

### matchKeys(obj, keys)
### matchKeys(obj, keys)

@@ -198,3 +200,3 @@ Find which keys are present

var array = [1, 2, 3];
var target = [4, 5];
var target = [4, 5];

@@ -232,3 +234,3 @@ var flattenedArray = Hoek.flatten(array, target) // results in [4, 5, 1, 2, 3];

### inheritAsync(self, obj, keys)
### inheritAsync(self, obj, keys)

@@ -259,3 +261,3 @@ Inherits a selected set of methods from an object, wrapping functions in asynchronous syntax and catching errors

target.a(function(err, result){console.log(result)} // returns 'a!'
target.a(function(err, result){console.log(result)} // returns 'a!'

@@ -288,3 +290,3 @@ target.c(function(err, result){console.log(result)} // returns undefined

example :
example :

@@ -438,3 +440,3 @@

### loadDirModules(path, excludeFiles, target)
### loadDirModules(path, excludeFiles, target)

@@ -444,3 +446,15 @@ Loads modules from a given path; option to exclude files (array).

# Streams
### readStream
Read an entire stream buffer into a string
```javascript
readStream(inputStream, function (outputString) {
...
});
```
// Load modules
var Lab = require('lab');
var Stream = require('stream');
var Hoek = require('../lib');

@@ -1083,3 +1084,31 @@

});
describe('#readStream', function () {
it('reads a stream and provides output to callback', function (done) {
var readable = new Stream.Readable();
readable._read = function () {
this.push('hello');
this.push(' ');
readable._read = function () {
this.push('world');
this.push(null);
return false;
};
return true;
};
Hoek.readStream(readable, function (result) {
expect(result).to.equal('hello world');
done();
});
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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