Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

isdefined

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isdefined - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

README.md

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;

2

package.json
{
"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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc