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

bugger-v8-client

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bugger-v8-client - npm Package Compare versions

Comparing version 4.1.0 to 4.2.0

example/big-buffer.js

3

lib/commands/evaluate.js

@@ -109,2 +109,5 @@ 'use strict';

DebugClient.prototype._convertToResult = convertToResult;
DebugClient.prototype._convertToThrown = convertToThrown;
DebugClient.prototype._evaluateRef =

@@ -111,0 +114,0 @@ function evaluateRef(fnOrExpression, frameId, noBreak) {

13

lib/commands/lookup.js

@@ -5,2 +5,3 @@ 'use strict';

var _ = require('lodash');
var debug = require('debug')('bugger-v8-client:commands:lookup');

@@ -50,2 +51,6 @@ var unmarshal = require('../types').unmarshal;

function unmarshalValue(parsed, refs, body) {
var refd = _.find(refs, { handle: body && body.ref });
if (refd) {
_.extend(body, refd);
}
var mapped = unmarshal(

@@ -58,2 +63,3 @@ { body: body, refs: refs }, null, parsed.scopePath);

if (!Array.isArray(rawObj.properties)) {
debug('rawObj has no properties', rawObj);
return [];

@@ -138,3 +144,3 @@ }

DebugClient.prototype.lookupProperties =
function lookupProperties(objectId, ownProperties) {
function lookupProperties(objectId, ownProperties, accessorPropertiesOnly) {
var parsed = parseObjectId(objectId);

@@ -146,2 +152,3 @@ if (typeof ownProperties !== 'boolean') {

case 'scope':
// TODO: support ownProperties
if (ownProperties) {

@@ -153,4 +160,4 @@ return Bluebird.resolve([]);

case 'scope-handle':
// TODO: support ownProperties
if (!ownProperties) {
// TODO: support accessorPropertiesOnly
if (accessorPropertiesOnly) {
return Bluebird.resolve([]);

@@ -157,0 +164,0 @@ }

'use strict';
var _ = require('lodash');
var classNameToSubType = {

@@ -9,2 +11,42 @@ Array: 'array',

function getClassName(raw) {
if (typeof raw.text === 'string') {
return raw.text.replace(/^#<(.+)>$/, '$1');
}
return raw.className;
}
function getArrayLikeLength(className, raw, reviver) {
if (className !== 'Array' && className !== 'Buffer') {
return;
}
if (!Array.isArray(raw.properties)) {
return;
}
var len = _.find(raw.properties, { name: 'length' });
if (!len) {
return;
}
len = reviver(len);
if (typeof len.value === 'number') {
return len.value;
} else if (len && len.value && len.value.type === 'number') {
return len.value.value;
}
}
function getDescription(className, raw) {
if (className !== 'Array' && className !== 'Buffer') {
return className;
}
if (!Array.isArray(raw.properties)) {
return className;
}
var len = _.find(raw.properties, { name: 'length' });
if (len && len.value && len.value.type === 'number') {
return className + '[' + len.value.value + ']';
}
return className;
}
function RemoteObject(subtype, objectId, className, description) {

@@ -22,7 +64,15 @@ this.type = 'object';

}
var className = getClassName(raw);
var len = getArrayLikeLength(className, raw, reviver);
var subtype = classNameToSubType[className];
var description = className;
if (typeof len === 'number') {
description += '[' + len + ']';
subtype = 'array';
}
return new RemoteObject(
classNameToSubType[raw.className],
subtype,
'scope-handle:' + scopePath + ':' + raw.handle,
raw.className,
raw.className
className,
description
);

@@ -29,0 +79,0 @@ };

{
"name": "bugger-v8-client",
"version": "4.1.0",
"version": "4.2.0",
"description": "Client for v8 debug protocol",

@@ -5,0 +5,0 @@ "main": "lib/bugger-v8-client.js",

@@ -16,2 +16,16 @@ 'use strict';

});
buggerTest(t, 'big-buffer.js', [], true, async (t, b) => {
b.resume();
await b.nextEvent('break');
const props = await b.lookupProperties('scope:0:0', false);
const buffer = find(props, { name: 'buffer' }).value;
t.equal(buffer.className, 'Buffer',
'The className matches the... well, class name');
t.equal(buffer.description, 'Buffer[150]',
'The description of a buffer is array-like');
});
});
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