New
Styling Addon: configure styles and themes in StorybookAutomate with Chromatic
Storybook Day 2023
Star77,670
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 4 years ago
839
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 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
Join the community
6,060 developers and counting
WhyWhy StorybookComponent-driven UI
Open source software
Storybook

Maintained by
Chromatic
Special thanks to Netlify and CircleCI