Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
empty-value
Advanced tools
Check if a given value is empty in JS extending his "truthy" and "falsy" nature
:package: Check if a given value is empty in JS extending his "truthy" and "falsy" nature
Using npm
npm install --save empty-value
var empty = require('empty-value');
empty(true) //false
empty(12345) //false
empty(-12345) //false
empty('Lorem Ipsum is simply dummy text') //false
empty([1, 2, 3]) //false
empty({ foo: 'bar' }) //false
empty('{ "id" : 1 }') //false
empty(function () { }) //false
empty(NaN) //true
empty(0) //true
empty(0.0) //true
empty(null) //true
empty(false) //true
empty(undefined) //true
empty('0') //true
empty(''); //true
empty(' '); //true
empty([]) //true
empty({ }) //true
var proto = { foo: 'bar' };
var obj = Object.create(proto);
empty(obj) //true Note: foo is not a directly property of obj
If empty can't guess the correct answer (IE: value is a function) before return FALSE you could use your own hook. See example bellow:
var myEmptyHook = function (value) {//i don't like functions
return typeof value === 'function' ? true : false;
}
var func = function () {
return 'bar';
}
empty(func, myEmptyHook); //true
MIT
FAQs
Check if a given value is empty in JS extending his "truthy" and "falsy" nature
The npm package empty-value receives a total of 260 weekly downloads. As such, empty-value popularity was classified as not popular.
We found that empty-value demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.