-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError occurred in matchAll #2
Comments
Looks you are using an old node version, where matchAll hasn't been released. You can use a polyfill for it or update node to 12 or higher. I believe it should be present in node 12. See more more details about the polyfill at MatchAll E.g. you can use some of the match-all packages from the npm and add matchAll method to the string proto. if(!String.prototype.matchAll) {
(function() {
String.prototype.matchAll = function(reg) {
return matchAll(this, reg);
};
})();
} |
I understand. I'm using Node.js v10. By the way, I will try another way. cf. my updated fix for src/mpd.js and test case. _matchAllChanged(message = '') {
const data = [];
if (typeof message !== 'string' || message === '') {
return data;
}
for (const line of message.split('\n')) {
if (line.indexOf('changed:') === 0) {
data.push(line.substring(8).trim());
}
}
return data;
} On the other hand, this product currently has only one "matchAll". Normaly, reducing RegExp is expected to improve performance. I know it's an hyperbole to say about this one fix. Thank you and regards. |
Fixed in 0.3.3 |
Originally posted by @RomanBurunkov in #1 (comment)
[isnot] For more details, I wrote test case for this problem.
please refer my branch 'test-isnot'. isnot#1
In my environment, TypeError came from each time at 'mpd-on-update'.
[isnot] If messages from MPD server constains multiple 'changed:', maybe need '/g flag'.
But I haven't actually confirmed this situation yet.
[isnot] I will confirm more on this point
Thank you.
The text was updated successfully, but these errors were encountered: