https://github.com/aneldev/dyna-universal
Tiny library with universal tools
https://github.com/aneldev/dyna-universal
client-server isomorphic javascript nodejs universal
Last synced: about 2 months ago
JSON representation
Tiny library with universal tools
- Host: GitHub
- URL: https://github.com/aneldev/dyna-universal
- Owner: aneldev
- License: mit
- Created: 2017-08-20T10:53:04.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-11-17T18:15:50.000Z (over 7 years ago)
- Last Synced: 2025-10-23T05:26:23.241Z (8 months ago)
- Topics: client-server, isomorphic, javascript, nodejs, universal
- Language: JavaScript
- Size: 337 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# About
Small library for universal issues (browser-nodeJs war).
# Usage
## Use it with import
```
import {universal, dynaUniversal, isBrowser, isNode} from 'dyna-universal';
universal; // is the node.js's global or browser's window
dynaUniversal // the DynaUniversal instance, is offers some tools
isNode; // boolean if we are in node
isBrowser; // boolean is we are is browser
// console them
console.log('Are we are under node? Answer: ', dynaUniversal.isNode); // writes, true or false
console.log('Are we are under browser? Answer: ', dynaUniversal.isBrowser); // writes, true or false
console.log('Are we are under node? Answer: ', isNode); // writes, true or false
console.log('Are we are under browser? Answer: ', isBrowser); // writes, true or false
```
## Use it with globals
```
import 'dyna-universal';
console.log('Are we are under node? Answer: ', dynaUniversal.isNode); // writes, true or false
console.log('Are we are under browser? Answer: ', dynaUniversal.isBrowser); // writes, true or false
```
# Exported properties
## isNode: boolean
Returns if it runs under node.js
## isBrowser: boolean
Returns if it runs under browser.
# Exported variables
## universal: Window | Global
Is the node.js's `global` or browser's `window`.
## dynaUniversal: DynaUniversal
Instance of DynaUniversal providing some universal environment tools
# version
We follow semver.
# v0 beta
# v1 1st official
Has many breaking changes with v0.