Package Exports
- checkroot
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (checkroot) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
checkroot
Check if the current user is root or not
Install
$ npm install --save checkroot
Usage
const checkroot = require('checkroot');
// returns
// true, if the current user is root
// false, otherwise
console.log(checkroot());
API
First it tries to get the username from the USER
and LOGNAME
environment variables. In the rare case when none of these environment variables are set, it falls back to $ id -un
on Linux / MacOS and $ whoami
on Windows. The result is cached using mem
.
checkroot()
Returns true
, if the current user is root and false
, otherwise.
License
MIT © Sahil Dua