• Stars
    star
    195
  • Rank 199,374 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Check where your code is running. In the browser or in node.js environment.

Browser or Node.js

Build Status npm version License: MIT

Check whether the code is running in the browser or node.js runtime.

Install

$ npm install --save browser-or-node

Usage

ES6 style import

import { isBrowser, isNode, isWebWorker, isJsDom, isDeno } from "browser-or-node";

if (isBrowser) {
  // do browser only stuff
}

if (isNode) {
  // do node.js only stuff
}

if (isWebWorker) {
  // do web worker only stuff
}

if (isJsDom) {
  // do jsdom only stuff
}

if (isDeno) {
  // do deno only stuff
}

ES5 style import

var jsEnv = require("browser-or-node");

if (jsEnv.isBrowser) {
  // do browser only stuff
}

if (jsEnv.isNode) {
  // do node.js only stuff
}

if (jsEnv.isWebWorker) {
  // do web worker only stuff
}

if (jsEnv.isJsDom) {
  // do jsdom only stuff
}

if (jsEnv.isDeno) {
  // do deno only stuff
}

License

MIT Β© Dineshkumar Pandiyan

More Repositories

1

dev-landing-page

Minimal landing page for developers
HTML
1,220
star
2

react-redux-boilerplate

A minimal React-Redux boilerplate with all the best practices
JavaScript
780
star
3

react-socks

πŸŽ‰ React library to render components only on specific viewports πŸ”₯
JavaScript
426
star
4

npm-module-boilerplate

Boilerplate for npm modules with ES6 features and all the best practices
JavaScript
387
star
5

blogster

A collection of beautiful, accessible and performant Astro blog templates.
Astro
310
star
6

typy

Minimal JavaScript type checking library
JavaScript
227
star
7

react-render-in-browser

React library to render browser specific content
JavaScript
159
star
8

cache-busting-example

JavaScript
101
star
9

tweet-fancy

πŸš€ Tweet with bold, italics and strikethough text
CSS
42
star
10

design-system-boilerplate

A design system boilerplate monorepo with opinionated principles, theming and token setup to build your own design system.
TypeScript
40
star
11

gatsby-boilerplate

CSS
31
star
12

progressive-rendering-react

Example setup to progressively render a React app from the server
JavaScript
30
star
13

progressive-rendering

Demo β€” Stream portions of a webpage as chunks from the server
HTML
27
star
14

testing-hooks

Code examples to test custom React hooks with Enzyme
JavaScript
24
star
15

react-npm-package-boilerplate

Boilerplate code for building a React NPM library
JavaScript
24
star
16

code-cheatsheet

Quick reference code snippets curated from various sources
TypeScript
19
star
17

axios-retry-interceptor

Configurable Axios Interceptor to retry failed http calls.
JavaScript
18
star
18

keystone-static-blog

Starter template to statically generate blog websites with Next.js and Keystone
TypeScript
14
star
19

apollo-graphql-playbook

Notes and guides on using apollo client's APIs
12
star
20

portfolio

JavaScript
9
star
21

react-monorepo

Monorepo starter template to build React applications
TypeScript
9
star
22

babel-plugin-render-logger

βš™οΈ Babel plugin that automatically adds a console statement to React components and makes debugging easier
JavaScript
7
star
23

all-my-writeups

Curation of all my writeups πŸŽ‰
6
star
24

fahid-jokes

https://fahidjokes.netlify.com πŸ˜‚
JavaScript
5
star
25

git-handbook

Handbook on how to use git commands and strategies that make life easier
4
star
26

keystone-in-next

Moved to https://github.com/keystonejs/keystone/tree/main/examples/nextjs-keystone
TypeScript
3
star
27

happy-birthday-bhat

Bhat turns 25 - http://happybirthdaybhat.dkbox.in ⚑️
CSS
3
star
28

dineshpandiyan.com

Astro
3
star
29

keystone-docker

TypeScript
3
star
30

next-batch

A promise batching utility mostly used in GraphQL resolvers to avoid N + 1 data fetching
TypeScript
2
star
31

awesome-saas-stack

A curation of SaaS tools to build modern web applications.
2
star
32

node-express-boilerplate

JavaScript
2
star
33

cloudflare-pothos-boilerplate

Boilerplate to get started with Pothos in Cloudflare workers
TypeScript
2
star
34

keystone-template

Starter template to kickstart a Keystone project
TypeScript
1
star
35

next-multi-zone

1
star
36

v1.dineshpandiyan.com

v1 of dineshpandiyan.com
CSS
1
star
37

index

πŸ‘‹ Repos grouped together for quicker navigation.
1
star
38

outstatic-example

CSS
1
star
39

del-key

Delete keys from deeply nested objects in JavaScript
JavaScript
1
star
40

scrabble-game

Command line based scrabble game with in-built dictionary and alphabet scores
Java
1
star
41

react-ssr-parcel

This repo is an example setup to server render a React app
JavaScript
1
star
42

hook-diary

πŸš€ Open collection of custom react hooks
JavaScript
1
star
43

parcel-react-starter

Starter template to build React applications. Tailwind + TypeScript.
TypeScript
1
star
44

global-package-version

Library to check any npm module's version from browser console
JavaScript
1
star
45

v2.dineshpandiyan.com

v2 of dineshpandiyan.com
JavaScript
1
star
46

dontannoyme

Chrome Extension to block FB posts based on provided keywords
JavaScript
1
star
47

eventmanagement-front-end

JavaScript
1
star
48

v3.dineshpandiyan.com

v3 of dineshpandiyan.com
HTML
1
star
49

v4.dineshpandiyan.com

v4 of dineshpandiyan.com
HTML
1
star
50

parcel-extract-vendor-bundle

Example repo to extract vendors into a separate bundle using parcel shared bundles concept
TypeScript
1
star
51

yoga-pothos

Template to build a GraphQL API using graphql-yoga and pothos
TypeScript
1
star
52

git-rebase-vs-merge

Example repo to demonstrate how rebase vs merge works
JavaScript
1
star
53

react-devtools-demo

Demo project for React Devtools talk at React Sydney Sep 2019
JavaScript
1
star
54

parcel-react-package

React package template with parcel build setup
JavaScript
1
star
55

next13-edge-cache-bug

TypeScript
1
star
56

spectacle-template-nextjs

A spectable template that doesn't work very well
TypeScript
1
star
57

parcel-react-bare-minimum

Bare minimum parcel react web app boilerplate I use as a template to open issues in Parcel repo. TypeScript + Emotion
HTML
1
star