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

hoek

Package Overview
Dependencies
Maintainers
2
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.8.1 to 0.8.2

10

lib/index.js

@@ -364,7 +364,11 @@ // Load modules

exports.assert = function (condition, message) {
exports.assert = function (condition /*, msg1, msg2, msg3 */) {
if (!condition) {
throw new Error(message || 'Unknown error');
if (condition) {
return;
}
var msgs = Array.prototype.slice.call(arguments, 1);
msgs = msgs.map(function (msg) { return typeof msg === 'string' ? msg : JSON.stringify(msg); });
throw new Error(msgs.join(' ') || 'Unknown error');
};

@@ -371,0 +375,0 @@

{
"name": "hoek",
"description": "General purpose node utilities",
"version": "0.8.1",
"version": "0.8.2",
"author": "Eran Hammer <eran@hueniverse.com> (http://hueniverse.com)",

@@ -6,0 +6,0 @@ "contributors":[

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

The *Hoek* general purpose node utilities library is used to aid in a variety of manners. It comes with useful methods for Ararys (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.

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

newTarget = Hoek.merge(target, source2); // results in {a: null, b: 2, c: 5}
newTarget = Hoek.merge(target, source2, false); // results in {a: null, b:2, c: 5}
newTarget = Hoek.merge(target, source2, false); // results in {a: 1, b: 2, c: 5}

@@ -112,0 +112,0 @@ newTarget = Hoek.merge(targetArray, sourceArray) // results in [1, 2, 3, 4, 5]

@@ -713,2 +713,35 @@ // Load modules

});
it('should throw an Error when using assert in a test with no message', function (done) {
var fn = function () {
Hoek.assert(false);
};
expect(fn).to.throw('Unknown error');
done();
});
it('should throw an Error when using assert in a test with multipart message', function (done) {
var fn = function () {
Hoek.assert(false, 'This', 'is', 'my message');
};
expect(fn).to.throw('This is my message');
done();
});
it('should throw an Error when using assert in a test with object message', function (done) {
var fn = function () {
Hoek.assert(false, 'This', 'is', { spinal: 'tap' });
};
expect(fn).to.throw('This is {"spinal":"tap"}');
done();
});
});

@@ -715,0 +748,0 @@

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