Socket
Socket
Sign inDemoInstall

devtools-reps

Package Overview
Dependencies
18
Maintainers
11
Versions
39
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.17.0 to 0.18.0

2

package.json
{
"name": "devtools-reps",
"version": "0.17.0",
"version": "0.18.0",
"description": "Devtools Reps",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -39,3 +39,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

const functionNode = nodes.last();
expect(functionNode.text()).toBe("testName()");
expect(functionNode.text()).toBe("fn:testName()");
});

@@ -42,0 +42,0 @@

@@ -14,3 +14,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

wrapRender,
} = require("./rep-utils");
} = require("./rep-utils");
const { MODE } = require("./constants");

@@ -58,3 +58,3 @@ const Svg = require("../shared/images/Svg");

return (
span({
span({
"data-link-actor-id": grip.actor,

@@ -65,3 +65,3 @@ className: "objectBox objectBox-function",

dir: "ltr",
},
},
getTitle(grip, props),

@@ -87,9 +87,9 @@ getFunctionName(grip, props),

let title = mode === MODE.TINY
? ""
: "function ";
? ""
: "function ";
if (grip.isGenerator) {
title = mode === MODE.TINY
? "* "
: "function* ";
? "* "
: "function* ";
}

@@ -102,3 +102,3 @@

return span({
className: "objectTitle",
className: "objectTitle",
}, title);

@@ -115,25 +115,45 @@ }

function getFunctionName(grip, props) {
let name = grip.userDisplayName
|| grip.displayName
|| grip.name
|| props.functionName
|| "";
function getFunctionName(grip, props = {}) {
let { functionName } = props;
let name;
const scenarios = [
objectProperty,
arrayProperty,
functionProperty,
annonymousProperty
];
if (functionName) {
let end = functionName.length - 1;
functionName =
functionName.startsWith('"') && functionName.endsWith('"')
? functionName.substring(1, end)
: functionName;
}
scenarios.some(reg => {
const match = reg.exec(name);
if (match) {
name = match[1];
return true;
}
return false;
});
if (
grip.displayName != undefined &&
functionName != undefined &&
grip.displayName != functionName
) {
name = functionName + ":" + grip.displayName;
} else {
name =
grip.userDisplayName ||
grip.displayName ||
grip.name ||
props.functionName ||
"";
const scenarios = [
objectProperty,
arrayProperty,
functionProperty,
annonymousProperty
];
scenarios.some(reg => {
const match = reg.exec(name);
if (match) {
name = match[1];
return true;
}
return false;
});
}
return cropString(name, 100);

@@ -140,0 +160,0 @@ }

@@ -344,14 +344,9 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

function getGripType(object, noGrip) {
let type = typeof object;
if (type == "object" && object instanceof String) {
type = "string";
} else if (object && type == "object" && object.type && noGrip !== true) {
type = object.type;
if (noGrip || Object(object) !== object) {
return typeof object;
}
if (isGrip(object)) {
type = object.class;
if (object.type === "object") {
return object.class;
}
return type;
return object.type;
}

@@ -358,0 +353,0 @@

@@ -66,3 +66,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

const shouldCrop = (!member || !member.open) && cropLimit;
const shouldCrop = (!member || !member.open) && cropLimit && text.length > cropLimit;
if (!containsURL(text)) {

@@ -69,0 +69,0 @@ if (shouldCrop) {

@@ -187,2 +187,19 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

stubs.set("ObjectProperty", {
"type": "object",
"class": "Function",
"actor": "server1.conn7.obj45",
"extensible": true,
"frozen": false,
"sealed": false,
"isAync": false,
"isGenerator": false,
"name": "$",
"displayName": "jQuery",
"location": {
"url": "debugger eval code",
"line": 1
}
});
module.exports = stubs;

@@ -8,2 +8,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

type: "symbol",
actor: "server1.conn1.child1/symbol1",
name: "foo"

@@ -13,5 +14,6 @@ });

stubs.set("SymbolWithoutIdentifier", {
type: "symbol"
type: "symbol",
actor: "server1.conn1.child1/symbol2",
});
module.exports = stubs;

@@ -30,3 +30,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

return span({className}, `Symbol(${name || ""})`);
return span({
className,
"data-link-actor-id": object.actor,
}, `Symbol(${name || ""})`);
}

@@ -33,0 +36,0 @@

@@ -340,1 +340,22 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

});
describe("Function - Two properties with same displayName", () => {
const object = stubs.get("ObjectProperty");
it("renders object properties as expected", () => {
expect(renderRep(object, {mode: undefined, functionName: "$"}).text())
.toBe("function $:jQuery()");
expect(renderRep(object, {parameterNames: [], functionName: "$"}).text())
.toBe("function $:jQuery()");
expect(renderRep(object, {parameterNames: ["a"], functionName: "$"}).text())
.toBe("function $:jQuery(a)");
expect(renderRep(object, {
parameterNames: ["a", "b", "c"],
functionName: "$"
}).text()).toBe("function $:jQuery(a, b, c)");
expect(renderRep(object, {
mode: MODE.TINY,
parameterNames: ["a", "b", "c"],
functionName: "$"
}).text()).toBe("$:jQuery(a, b, c)");
});
});

@@ -205,2 +205,20 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

it("renders a non-cropped URL", () => {
const url = "http://example.com/foobarbaz";
const openLink = jest.fn();
const element = renderRep(url, {
openLink,
useQuotes: false,
cropLimit: 50
});
expect(element.text()).toEqual(url);
const link = element.find("a");
expect(link.prop("href")).toBe(url);
expect(link.prop("title")).toBe(url);
link.simulate("click");
expect(openLink).toBeCalledWith(url);
});
it("renders URL on an open string", () => {

@@ -207,0 +225,0 @@ const url = "http://example.com";

@@ -9,2 +9,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

const stubs = require("../stubs/symbol");
const { expectActorAttribute } = require("./test-helpers");

@@ -20,2 +21,3 @@ describe("test Symbol", () => {

expect(renderedComponent.text()).toEqual("Symbol(foo)");
expectActorAttribute(renderedComponent, stub.actor);
});

@@ -33,3 +35,4 @@ });

expect(renderedComponent.text()).toEqual("Symbol()");
expectActorAttribute(renderedComponent, stub.actor);
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc