Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Utility that provides different types of empty objects. All objects returned by this library are immutable (made so using Object.freeze) unless the NODE_ENV
environment variable is set to 'production'
.
The library is written for CommonJS environments such as Node and works beautifully in the browser using something like Browserify.
To install, make sure you have Node installed, then, in your project directory, run:
$ npm install empty
var empty = require('empty');
empty.object
var emptyObject = empty.object;
// or
var emptyObject = require('empty/object');
console.log(emptyObject);
// {}
empty.array
var emptyArray = empty.array;
// or
var emptyArray = require('empty/array');
console.log(emptyArray);
// []
empty.func
var emptyFunction = empty.func;
// or
var emptyFunction = require('empty/function');
console.log(emptyFunction);
// function () {}
empty.functionThatReturns
var functionThatReturns = empty.functionThatReturns;
// or
var functionThatReturns = require('empty/functionThatReturns');
console.log(functionThatReturns('foo')());
// 'foo'
empty.functionThatReturnsTrue
var functionThatReturnsTrue = empty.functionThatReturnsTrue;
// or
var functionThatReturnsTrue = require('empty/functionThatReturnsTrue');
console.log(functionThatReturnsTrue());
// true
empty.functionThatReturnsFalse
var functionThatReturnsFalse = empty.functionThatReturnsFalse;
// or
var functionThatReturnsFalse = require('empty/functionThatReturnsFalse');
console.log(functionThatReturnsFalse());
// false
empty.functionThatReturnsNull
var functionThatReturnsNull = empty.functionThatReturnsNull;
// or
var functionThatReturnsNull = require('empty/functionThatReturnsNull');
console.log(functionThatReturnsNull());
// null
empty.functionThatReturnsThis
var functionThatReturnsThis = empty.functionThatReturnsThis;
// or
var functionThatReturnsThis = require('empty/functionThatReturnsThis');
console.log(functionThatReturnsThis.call({a: 1}));
// {a: 1}
empty.functionThatReturnsArgument
var functionThatReturnsArgument = empty.functionThatReturnsArgument;
// or
var functionThatReturnsArgument = require('empty/functionThatReturnsArgument');
console.log(functionThatReturnsArgument('foo'));
// 'foo'
Many thanks to Arturo for the name on NPM. The original package repository can be found at here.
FAQs
Utility that provides different types of empty objects.
The npm package empty receives a total of 21,172 weekly downloads. As such, empty popularity was classified as popular.
We found that empty 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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.