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

node-monkey

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-monkey - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

14

CHANGELOG.md

@@ -1,3 +0,13 @@

Version 0.3.0
Version 0.2.5
-------------
Fixed bug where results of commands weren't being decycled before being sent to the client
Allow second argument to nomo.cmd(...) on client to be optional - if no args are used or required, just pass the callback as the second argument instead
Version 0.2.4
-------------
- Fixed a bug with cycle.js causing it to filter out functions any potentially other data types
- Now sends full object representation including functions, which are normally stripped out by converting to JSON
Version 0.2.3
-------------
- Added missing 'profiler.getData' and 'profiler.clearData' commands to client side

@@ -28,2 +38,2 @@ - Changed the way commands work for added security and to make the command interface available the application developer for any desired use

- Added buffering on Firefox if Firebug isn't open on initial page load so messages can be displayed once it is
- Dumps instructions to the console when started. Added `silent` option to disable this behavior.
- Dumps instructions to the console when started. Added `silent` option to disable this behavior.

@@ -49,2 +49,5 @@ # NodeMonkey API

```js
// NOTE: The second argument where you list args to pass to the command is now optional.
// If there are no args you can either pass the callback as the second argument or
// pass 'null' to skip over it and continue passing the callback as the 3rd argument.
nomo.cmd('myApp.doSomething', [arg1, arg2, arg3], function(response, error) {

@@ -51,0 +54,0 @@ console.log(response, error);

14

index.js

@@ -83,3 +83,3 @@ require('./src/cycle.js');

// At some point in the future this could replace it with a version of the function capable of making
// using a command to actually call the function over the websocket.
// a command to actually call the function over the websocket.
rdata[prop] = rdata[prop].toString();

@@ -118,3 +118,7 @@ } else if(_.isObject(rdata[prop])) {

} else {
this.iosrv.sockets.emit('console', consoleData);
try {
this.iosrv.sockets.emit('console', consoleData);
} catch(err) {
this.clog('Failed sending message: ' + err);
}
}

@@ -220,3 +224,7 @@

socket.emit('cmdResponse', { cmdId: cmd.cmdId, result: result, error: error });
try{
socket.emit('cmdResponse', { cmdId: cmd.cmdId, result: that.prepSendData(result), error: error });
} catch(err) {
that.clog('Failed sending message: ' + err);
}

@@ -223,0 +231,0 @@ //var callObj = ['that'].concat(cmd.command.split('.').slice(0, -1)).join('.');

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

"version": "0.2.4",
"version": "0.2.5",
"description": "A Node.js module for inspecting, profiling and debugging Node.js applications through a web browser",

@@ -8,0 +8,0 @@ "keywords": ["inspect", "debug", "debugging", "console", "log", "profile", "profiler"],

@@ -15,2 +15,24 @@ (function() {

// NOTE: Modifies the passed object
function prepSentData(data) {
// Replace function placeholder's with actual functions
(function freplace(rdata) {
for(var prop in rdata) {
if(typeof(rdata[prop]) == 'string' && rdata[prop].substr(0, 9) == 'function ') {
// At some point in the future this could either call .toString() on the function or replace it with a version
// of the function capable of making using a command to actually call the function over the websocket.
try {
eval('rdata[prop] = ' + rdata[prop]);
} catch(err) {
rdata[prop] = function() {};
}
} else if(_.isObject(rdata[prop])) {
freplace(rdata[prop]);
}
}
})(data);
return JSON.retrocycle(data);
}
function logMsg(data) {

@@ -21,21 +43,4 @@ if(isFirefox && !window.console.exception) {

// Replace function placeholder's with actual functions
(function freplace(rdata) {
for(var prop in rdata) {
if(typeof(rdata[prop]) == 'string' && rdata[prop].substr(0, 9) == 'function ') {
// At some point in the future this could either call .toString() on the function or replace it with a version
// of the function capable of making using a command to actually call the function over the websocket.
try {
eval('rdata[prop] = ' + rdata[prop]);
} catch(err) {
rdata[prop] = function() {};
}
} else if(_.isObject(rdata[prop])) {
freplace(rdata[prop]);
}
}
})(data.data);
data.data = prepSentData(data.data);
data.data = JSON.retrocycle(data.data);
if(data.type && data.data) {

@@ -117,2 +122,7 @@ var cdata = data.callerData;

cmd: function(cmd, args, callback) {
if(_.isFunction(args) && !callback) {
callback = args;
args = null;
}
var cmdId = ++nomo._cmdCall;

@@ -127,2 +137,3 @@ connection.emit('cmd', {command: cmd, args: args, cmdId: cmdId});

_response: function(resp) {
resp.result = prepSentData(resp.result);
var cb = nomo._callbacks[resp.cmdId];

@@ -151,2 +162,2 @@ if(cb) {

})();
})();

@@ -53,4 +53,3 @@ /*

switch (typeof value) {
case 'object':
if (typeof value == 'object') {

@@ -104,5 +103,5 @@ // typeof null === 'object', so get out if this value is not really an object.

return nu;
default:
return value;
}
return value;
}(object, '$'));

@@ -180,2 +179,2 @@ };

};
}
}
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