hyper-tabs-enhanced icon indicating copy to clipboard operation
hyper-tabs-enhanced copied to clipboard

TypeError: title.match is not a function

Open alicanb opened this issue 6 years ago • 6 comments

Hi there, I'm on WSL running canary build, below is the error I get:

TypeError: title.match is not a function
    at getIcon (C:\Users\alicanb\.hyper_plugins\node_modules\hyper-tabs-enhanced\index.js:306:27)
    at Object.render (C:\Users\alicanb\.hyper_plugins\node_modules\hyper-tabs-enhanced\index.js:314:26)

alicanb avatar Sep 13 '18 21:09 alicanb

Hey mate,

Looks like the title argument passed to getIcon(title) is not always a string, if its not a string calling the match function on the argument is going to fail.

My solution was to call toString on the argument and then chaining match on the end, like so ->

// Current process icon
const getIcon = (title) => {
    const process = title.toString().match(/(?:[\s]+|^)(gulp|php|node|npm|yarn|vim|nvim|python|mysql)(?:[\s]+|$)/i);
    return process ? process[0].trim().toLowerCase() : 'shell';
};

That solved the problem. There is probably a better way to do this... I will let the maintainers make that call though.

ChrisNoel avatar Nov 11 '18 19:11 ChrisNoel

Unfortunately I'm still seeing this error! Hyper 2.1.2 stable, here is the hypertabs config section:

    hyperTabs: {
      border: true,
      tabIconsColored: true,
      activityColor: 'red',
      closeAlign: 'right'
    },

creativedrewy avatar Feb 12 '19 23:02 creativedrewy

See the same errror on Hyper 2.1.2 as @creativedrewy

[Notification] Plugin error: Plugins decorating Tab has been disabled because of a plugin crash. Check Developer Tools for details.

bundle.js:1 TypeError: title.match is not a function at getIcon (/Users/cyanam/.hyper_plugins/node_modules/hyper-tabs-enhanced/index.js:306:27) at Object.render (/Users/cyanam/.hyper_plugins/node_modules/hyper-tabs-enhanced/index.js:314:26) at h (file:///Applications/Hyper.app/Contents/Resources/app.asar/renderer/bundle.js:1:154527) at beginWork (file:///Applications/Hyper.app/Contents/Resources/app.asar/renderer/bundle.js:1:156264) at d (file:///Applications/Hyper.app/Contents/Resources/app.asar/renderer/bundle.js:1:168739) at f (file:///Applications/Hyper.app/Contents/Resources/app.asar/renderer/bundle.js:1:169079) at g (file:///Applications/Hyper.app/Contents/Resources/app.asar/renderer/bundle.js:1:169330) at m (file:///Applications/Hyper.app/Contents/Resources/app.asar/renderer/bundle.js:1:172850) at w (file:///Applications/Hyper.app/Contents/Resources/app.asar/renderer/bundle.js:1:172644) at z (file:///Applications/Hyper.app/Contents/Resources/app.asar/renderer/bundle.js:1:171749)

DineshCyanam avatar Mar 04 '19 03:03 DineshCyanam

Same error here... Screen Shot 2019-04-18 at 2 04 30 AM

mitchellsolomon avatar Apr 18 '19 06:04 mitchellsolomon

Removing "hyper-tab-icons" plugin had worked for me

jankrloz avatar May 01 '19 01:05 jankrloz

There are cases where this.props.text as provided by exports.decorateTab is an entire React element instead of a plain string.

Screen Shot 2019-12-18 at 13 56 12

This only seems to happen for me when I have more than one tab open.

ryanjwessel avatar Dec 18 '19 19:12 ryanjwessel