native-is-elevated
Advanced tools
Comparing version 0.1.3 to 0.2.0
18
index.js
'use strict'; | ||
var isElevated = null; | ||
var lib = null; | ||
var tried = false; | ||
var returned = false; | ||
var retValue = false; | ||
module.exports = function() { | ||
if (returned) { | ||
return retValue; | ||
} | ||
if (!tried) { | ||
// Prevent multiple failed require attempts | ||
tried = true; | ||
try { | ||
isElevated = require('./build/Release/is-elevated'); | ||
lib = require('./build/Release/is-elevated'); | ||
} catch (err) { | ||
@@ -15,9 +22,10 @@ console.error(err); | ||
if (!isElevated) { | ||
if (!lib) { | ||
return false; | ||
} | ||
var retValue = false; | ||
try { | ||
retValue = isElevated.isElevated(); | ||
// Cache the result for subsequent calls | ||
retValue = lib.isElevated(); | ||
returned = true; | ||
} catch (err) { | ||
@@ -24,0 +32,0 @@ console.error(err); |
{ | ||
"name": "native-is-elevated", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "Native module for checking if the process is being run with elevated privileges", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4606
40