Comparing version 0.0.2 to 0.0.3
41
index.js
@@ -1,1 +0,40 @@ | ||
module.exports = function(v) { return typeof v !== 'undefined' }; | ||
var defined; | ||
/** | ||
* Return whether variable is defined | ||
* @param v | ||
* @returns {boolean} | ||
*/ | ||
defined.is_defined = function (v) { | ||
return typeof v !== 'undefined'; | ||
} | ||
/** | ||
* If variable defined, return whether equals 1 | ||
* Else return undefined | ||
* @param v | ||
* @returns {boolean} | ||
*/ | ||
defined.binary_to_boolean = function(v) { | ||
return defined.is_defined(v) ? v == 1 : undefined; | ||
}; | ||
/** | ||
* If variable defined, return binary value of boolean | ||
* Else return undefined | ||
* @param v | ||
* @returns {*} | ||
*/ | ||
defined.boolean_to_binary = function(v) { | ||
if(defined.is_defined(v)){ | ||
if(v == 'true' || v == true) { | ||
return 1; | ||
} else { | ||
return 0; | ||
} | ||
} else { | ||
return undefined; | ||
} | ||
}; | ||
module.exports = defined; |
{ | ||
"name": "isdefined", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Checks a given object property is defined", | ||
@@ -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
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
2432
3
35
1
38
0