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.

get rid of process.browser checks

See original GitHub issue

It makes the tests a lot harder to understand. Not exactly sure how we would do it and how it will affect implementations, need time and help from the community to get this right. A suggestion would be to

  1. check the commit history, why were the process.browser checks added in the first place?
  2. if we remove them, what would the consequences be?
  3. rewrite/update implementations that rely on this based in 1. and 2.

See the following comments:

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

3reactions
vweeverscommented, Jul 15, 2018

To summarize what’s been achieved:

get rid of process.browser checks https://github.com/Level/abstract-leveldown/issues/121#issue-255063994

Done in #277 and #297.

The default _serialize* functions should be identity functions. Then serialization is truly an implementation’s choice. https://github.com/Level/abstract-leveldown/issues/121#issuecomment-328331961

Done in #277.

abstract-leveldown should have no idea of what environment it’s running in and assume nothing about serialization and similar implementation specific details. https://github.com/Level/abstract-leveldown/issues/121#issuecomment-328336205

If there are any assumptions left we’ll likely run into them when updating memdown and level-js.

If we […] implement [serialization of range options] ánd we drop support of null and undefined, then it means encodings like bytewise can’t use null or undefined as lower/upper bounds. https://github.com/Level/abstract-leveldown/issues/121#issuecomment-333527967

Range options are now serialized, and nullish values are rejected, since #277. To support bytewise and others, range options are no longer touched, and a test that assumed null meant “not defined” has been removed. In encoding-down, we should be able to remove _setupIteratorOptions.

this String(obj) is also problematic – https://github.com/Level/abstract-leveldown/issues/121#issuecomment-352260364

Solved in #277.

We also have various instances of [isTypedArray(value)] https://github.com/Level/abstract-leveldown/issues/121#issuecomment-343722989

I’ll open a new issue for the backlog.

Implementations like level.js don’t always support binary keys. […] We should move all tests that use binary keys to isolated test file(s). Those files can then be skipped by implementations if need be. https://github.com/Level/abstract-leveldown/issues/121#issuecomment-391748876

Solved in #297 (and earlier PRs) with a bufferKeys option.

2reactions
ralphtheninjacommented, Sep 10, 2017

So there’s another option (3): we achieve isomorphism through level. In a browser it’ll use level.js with encoding-down. If you use level.js by itself, you can choose to forego encoding-down.

I prefer this approach and I think @juliangruber does as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove process/browser.js #403 - preactjs/preact-compat
I was able to remove it locally by changing: var DEV = typeof process==='undefined' ... Process checking adds .56 KB (gzip) to bundle...
Read more >
How do I detect whether I am on server on client in next.js?
You can use process.browser to distinguish between server environment (NodeJS) and client environment (browser). process.browser is true on ...
Read more >
How to Clear the Cache and Cookies in Your Web Browser
Select History. ... Select Clear Browsing Data from the left-hand side. Set the Time Range set to All Time. Check-mark Cookies and other...
Read more >
How to Clear Cache for All Major Browsers - Kinsta
Find out how to clear the browser cache in most major browsers with these quick steps and ... Check Out Our Video Guide...
Read more >
Clear your web browser's cache, cookies, and history - IU KB
At the top of the "Clear browsing data" window, click Advanced. · Select the following: Browsing history; Download history; Cookies and other ...
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