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

bagofholding

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bagofholding - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

.gitignore

5

CHANGELOG.md

@@ -1,2 +0,5 @@

### 0.0.3 (SNAPSHOT)
### 0.0.4 (SNAPSHOT)
* Mock console error and log now simulates %s, %d, %j
### 0.0.3
* Modify cli readConfigFileSync, config file in current directory should take precedence over the one in home directory

@@ -3,0 +6,0 @@

24

lib/mock.js

@@ -106,2 +106,3 @@ var obj = require('./obj');

* Mock console module.
* error and log functions accept any number of arguments
**/

@@ -113,9 +114,24 @@ function console(checks) {

function error(message) {
checks.console_error_messages.push(message);
// a simple format to simulate parts of util.format
// util.format is not used because it's not available in node v0.4.x
function _format(text, args) {
var i = 1,
formatted = String(text).replace(/%[sdj]/g, function (match) {
switch(match) {
case '%s': return String(args[i++]);
case '%d': return Number(args[i++]);
case '%j': return JSON.stringify(args[i++]);
default: return match;
}
});
return formatted;
}
function log(message) {
checks.console_log_messages.push(message);
function error(message, arg1, arg2, arg3) {
checks.console_error_messages.push(_format(message, error['arguments']));
}
function log(message, arg1, arg2, arg3) {
checks.console_log_messages.push(_format(message, log['arguments']));
}

@@ -122,0 +138,0 @@ return {

@@ -5,3 +5,3 @@ {

"keywords": [],
"version": "0.0.3",
"version": "0.0.4",
"homepage": "http://github.com/cliffano/bagofholding",

@@ -8,0 +8,0 @@ "author": "Cliffano Subagio <blah@cliffano.com> (http://blog.cliffano.com)",

@@ -101,4 +101,6 @@ var bag = require('../lib/bagofholding'),

console.error('some error');
checks.console_error_messages.length.should.equal(1);
console.error('foo %s', 'bar');
checks.console_error_messages.length.should.equal(2);
checks.console_error_messages[0].should.equal('some error');
checks.console_error_messages[1].should.equal('foo bar');
});

@@ -109,4 +111,6 @@

console.log('some log');
checks.console_log_messages.length.should.equal(1);
console.log('foo %s', 'bar');
checks.console_log_messages.length.should.equal(2);
checks.console_log_messages[0].should.equal('some log');
checks.console_log_messages[1].should.equal('foo bar');
});

@@ -113,0 +117,0 @@ });

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