Socket
Socket
Sign inDemoInstall

null

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

null

Null generator library


Version published
Weekly downloads
1.2K
decreased by-1.44%
Maintainers
1
Weekly downloads
 
Created
Source

null

Null all of the things! This package was originally created as a joke, but hey now it actually does something non-trivial.

If you ever use null for logic tests, you can try using a Symbol instead via the NullRef library provided by this package.

This package provides for a NULL constant that is a Symbol from the Global Symbol Registry, as well as convenience methods for testing, casting, and comparing values.

Usage

Require and reference what you need:

const nullref   = require('null'); // note that the variable name should not be null, here we use nullref
const nulltest  = nullref.lib; // load the full library of convenience features

const isNull    = nullref.isNull // or just load the main ones you want (checks for null or NULL)
const isNullRef = nullref.isNullRef // checks for NULL only

const NULL = nullref(); // NULL symbol instance (singleton);

Consume and use as needed.

let x = null;

//returns true if x is null or NULL
if( nulltest.is(x) ) //do something
if( isNull(x) ) // same as above

//cast a variable to NULL if it is null or NULL, otherwise it returns itself
if( NULL === nulltest.to(x) ) // do something

Keywords

FAQs

Package last updated on 20 May 2019

Did you know?

Socket

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.

Install

Related posts

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