Package detail

ast-is-empty

codsen1.8kMIT4.0.18

Find out, is nested array/object/string/AST tree is empty

array, ast, blank, contains

readme

ast-is-empty

Find out, is nested array/object/string/AST tree is empty

page on codsen.com page on npm page on github Downloads per month changelog MIT Licence

Install

This package is pure ESM. If you're not ready yet, install an older version of this program, 2.1.0 (npm i ast-is-empty@2.1.0).

npm i ast-is-empty

Quick Take

import { strict as assert } from "assert";

import { isEmpty } from "ast-is-empty";

assert.equal(
  isEmpty({
    a: "",
  }),
  true,
);

assert.equal(
  isEmpty({
    a: [""],
    b: {
      c: {
        d: "",
      },
    },
  }),
  true,
);

assert.equal(
  isEmpty([
    {
      a: [""],
      b: { c: { d: "" } },
    },
    "",
    ["", "", ""],
  ]),
  true,
);

Documentation

Please visit codsen.com for a full description of the API.

Contributing

To report bugs or request features or assistance, raise an issue on GitHub.

Licence

MIT License.

Copyright © 2010-2025 Roy Revelt and other contributors.

ok codsen star

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

4.0.10 (2023-05-13)

Bug Fixes

4.0.0 (2022-12-01)

BREAKING CHANGES

  • Minimum supported Node version is v14.18; we're dropping v12 support

3.1.0 (2022-08-12)

Features

3.0.0 (2021-09-09)

Features

BREAKING CHANGES

  • programs now are in ES Modules and won't work with Common JS require()

2.1.0 (2021-05-24)

Features

  • config file based major bump blacklisting (e15f9bb)

2.0.15 (2021-04-11)

Reverts

  • Revert "chore: setup refresh" (23cf206)

2.0.1 (2021-01-28)

Fixed

  • add testStats to npmignore (f3c84e9)

2.0.0 (2021-01-23)

Features

  • rewrite in TS, use named exports (5773b6a)

BREAKING CHANGES

  • previously: import isEmpty from ... - now import { isEmpty } from ...

1.11.0 (2020-11-28)

Accidental version bump during migration to SourceHut. Sorry about that.

1.10.0 (2020-02-01)

Features

  • remove the last and only dependency (e06e6ae)

1.9.0 (2019-01-20)

  • Various documentation and setup tweaks after we migrated to monorepo
  • Setup refresh: updated dependencies and all config files using automated tools

1.3.0 (2018-10-13)

  • Updated all dependencies and restored coverage tracking both via terminal when testing and through coveralls.io

1.2.0 (2018-06-13)

GitHub sold us out. In the meantime, we:

  • Migrated to BitBucket (to host repo + perform CI) and Codacy (for code quality audit)
  • Dropped BitHound (RIP) and Travis

1.1.0 (2018-05-02)

  • Set up Prettier
  • Removed package.lock and .editorconfig
  • Wired Rollup to remove comments from non-dev builds. This means we can now leave the console.logs in the source code — Rollup will remove from production code.

1.0.0 (2018-03-11)

  • First public release.