0.0.7 • Published 5 months ago
@daxplrer/isnode v0.0.7
detect node engines and js enviroments directly from your scripts. Tested on modern browser, nodejs, and deno
Install
npm install @daxplrer/isnode
# or
npm install --save @daxplrer/isnode
how about deno?
Updates
- bugs fixed
Examples
detect if the node engine was v8
import isnode from '@daxplrer/isnode'
// you can use require too
// const isnode = require('@daxplrer/isnode')
function isusingv8() {
// check using the engine() function
if (isnode.engine()==='v8') return true
else return false;
}
// send the output to the console
console.log(isusingv8())
detect if the js enviroment is in jxcore
import isnode from '@daxplrer/isnode'
if (isnode.env()==='jx'){
console.log('you are in jxcore')
} else {
throw new Error('you are in '+isnode.env())
}
Source code
Note
for deno
welp, use this
import {isnode as detectNode} from 'npm:@daxplrer/isnode@0.0.5'