Back to integrations
Add your integration
Categories
  • ⭐️ Popular
  • 🧩 Essentials
  • 🛠 Code
  • ⚡️ Data & state
  • ✅ Test
  • 💅 Style
  • 🎨 Design
  • ⚙️ Appearance
  • 🗄 Organize
How to install addons Create an addon
null
Null generator library
npm install null
Last updated almost 5 years ago
892
Downloads per week
Readme View on GitHub

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 is 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
if( NULL === nulltest.to(x) ) // do something
Join the community
6,595 developers and counting
WhyWhy StorybookComponent-driven UI
DocsGuidesTutorialsChangelogTelemetryStatus
CommunityAddonsGet involvedBlog
ShowcaseExploreProjectsComponent glossary
Open source software
Storybook

Maintained by
Chromatic
Special thanks to Netlify and CircleCI