is-root 
Check if the process is running as root user. Eg. started with
sudo
.
Install
Install with npm
npm install --save is-root
Example
$ sudo node index.js
// index.js
var isRoot = require('is-root');
isRoot();
//=> true
License
MIT © Sindre Sorhus