Skip to content
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

chore: create new debug module #6028

Merged
merged 2 commits into from Jun 16, 2020
Merged

chore: create new debug module #6028

merged 2 commits into from Jun 16, 2020

Conversation

jackfranklin
Copy link
Collaborator

No description provided.

This debug module can be used in either Node or the browser. We'll use
the `debug` module in Node land, but fallback to a simple `console.log`
solution when in the browser in an attempt to keep our browser bundle
size down.
@jackfranklin jackfranklin changed the title Use our debug wrapper rather than Node's debug. chore: create new debug module Jun 16, 2020
src/Debug.ts Outdated
* ```
*/
export const debug = (prefix: string): ((...args: unknown[]) => void) => {
const isNodeEnv = typeof document === 'undefined';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Since the result should not change we can do it just once, so let's hoist this check out of the debug export.

Copy link
Member

@mathiasbynens mathiasbynens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % comment

@jackfranklin jackfranklin merged commit 547f4ea into main Jun 16, 2020
@jackfranklin jackfranklin deleted the debug-browser-version branch June 16, 2020 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants