question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Kleur crashes when there's a global variable keys

See original GitHub issue

Hi! My app uses global.keys constant. Unfortunately, it conflicts with Kleur internal magic.

function init(key) {
	return function (txt) {
		let isChain = !!this.keys; // <<<
		...
	};
}

As global.keys becomes something different:

this.keys.includes is not a function
    at /.../node_modules/kleur/index.js:95:26

I guess that’s how you detect chaining. Is it possible to use "use strict" pragma and check if this is undefined instead of relying on global object field (which is not safe for libraries)?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ivan-kleshnincommented, Feb 7, 2019

No problem. This way it works for me, yes.

0reactions
lukeedcommented, Feb 7, 2019

Released in v3.0.2 – thank you~!

Read more comments on GitHub >

github_iconTop Results From Across the Web

When I use global variables it crashes my kernel
First: ALWAYS Initialize variables especially global ones. ... call KERNEL_LOC ; RAX Has the pointer of the global variable jmp $.
Read more >
Are static global variables as bad as global variables? How to ...
Imagine your requirements change and suddenly there are 5 keys running around. ... A static global variable is the same global variable, ...
Read more >
interrupt function modifying global variables
In response to other posts where this topic has been mentioned, I was wondering if my project has some latent errors awaiting to...
Read more >
Global Variables and States: Why So Much Hate?
Global variables are a common pitfall many developers fall into. Let's take a look why, and how we can fix this problem.
Read more >
Programming FAQ — Python 3.11.1 documentation
Contents: Programming FAQ- General Questions- Is there a source code level debugger with ... What are the rules for local and global variables...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found