Skip to content

Commit

Permalink
firefox-devtools#2980 added lodash and underscore detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Cristian Petcu committed Jun 8, 2017
1 parent dbb50fe commit 96b5326
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions assets/images/Svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const svg = {
folder: require("./folder.svg"),
globe: require("./globe.svg"),
jquery: require("./jquery.svg"),
underscore: require("./underscore.svg"),
lodash: require("./lodash.svg"),
"magnifying-glass": require("./magnifying-glass.svg"),
"arrow-up": require("./arrow-up.svg"),
"arrow-down": require("./arrow-down.svg"),
Expand Down
4 changes: 4 additions & 0 deletions assets/images/lodash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions assets/images/underscore.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions src/utils/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ function isExtJs(frame) {
return /\/ext-all[\.\-]/.test(getFrameUrl(frame));
}

function isUnderscore(frame) {
return getFrameUrl(frame).match(/underscore/i);
}

function isLodash(frame) {
return getFrameUrl(frame).match(/lodash/i);
}

export function getLibraryFromUrl(frame: Frame) {
// @TODO each of these fns calls getFrameUrl, just call it once
// (assuming there's not more complex logic to identify a lib)
Expand Down Expand Up @@ -82,6 +90,14 @@ export function getLibraryFromUrl(frame: Frame) {
if (isExtJs(frame)) {
return "ExtJS";
}

if (isUnderscore(frame)) {
return "Underscore";
}

if (isLodash(frame)) {
return "Lodash";
}
}

const displayNameMap = {
Expand Down

0 comments on commit 96b5326

Please sign in to comment.