GithubHelp home page GithubHelp logo

is-empty's Introduction

Is Empty

Build Status Test Covarage Latest Version

Check if a value is empty or not.

Installation

$ npm install @risan/is-empty

CDN

The library is available over a CDN:

<script src="https://unpkg.com/@risan/is-empty@latest/dist/is-empty.umd.js"></script>

<!-- Or the minified version -->
<script src="https://unpkg.com/@risan/is-empty@latest/dist/is-empty.umd.min.js"></script>

Usage

const isEmpty = require("@risan/is-empty");

// The following statements will return TRUE:
isEmpty(null);
isEmpty(undefined);
isEmpty(NaN);

// An empty string is considered empty, return TRUE.
isEmpty("");
isEmpty(" ");
isEmpty("\n\t");

// An object with no properties is considered empty, return TRUE.
isEmpty({});
isEmpty(new Object());
isEmpty(Object.create(null));

// Array, Map, or Set with no items is considered empty, return TRUE.
isEmpty([]);
isEmpty(new Map());
isEmpty(new Set());

// The following statements will return FALSE:
isEmpty(true);
isEmpty(false);
isEmpty(0);
isEmpty(-123.5);
isEmpty(Infinity);
isEmpty([1, 2, 3]);
isEmpty({ foo: "bar" });
isEmpty(new Set([1, 2]));

const myMap = new Map();
myMap.set("foo", "bar");
isEmpty(myMap);

// Function will always return FALSE:
const myFunction = () => "foo";
isPlainObj(myFunction);
isEmpty(parseInt);

// Instance of class will always return FALSE:
class Person {}
isPlainObj(new Person());
isEmpty(new Date());

If you load the library directly on the browser, it's available under the isEmpty name.

window.isEmpty(null); // TRUE
window.isEmpty("   "); // TRUE
window.isEmpty(false); // FALSE
window.isEmpty(new Date()); // FALSE

License

MIT Β© Risan Bagja Pradana

is-empty's People

Contributors

greenkeeper[bot] avatar risan avatar

Watchers

 avatar  avatar

is-empty's Issues

An in-range update of rollup is breaking the build 🚨

The devDependency rollup was updated from 1.4.1 to 1.4.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

rollup is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v1.4.2

2019-03-07

Bug Fixes

  • Respect variable identity of exports when hashing (#2741)
  • Resolve a situations where a variable was imported twice with the same name (#2737)

Pull Requests

Commits

The new version differs by 6 commits.

  • adaa23e 1.4.2
  • 2d03a67 Update changelog
  • 858fea4 Resolve a situation where different default exports referencing the same (#2737)
  • 6903425 Update changelog
  • af41561 Fix an issue where the same hash was generated when different variables (#2741)
  • d27c0f6 Docs: Fix return type (#2738)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.