§ Quick Take

import { strict as assert } from "assert";
import { isEmpty } from "ast-is-empty";

    a: "",

    a: [""],
    b: {
      c: {
        d: "",

      a: [""],
      b: { c: { d: "" } },
    ["", "", ""],

§ Rationale

Sometimes we need to check, does given AST contain only empty structures:

  • empty strings (those that trim to zero length)
  • arrays containing zero or more keys containing empty structures
  • plain objects with containing zero or more keys containing empty structures

This program helps with that.



In other words, it's a function which takes one input argument which can be of any type.

It returns boolean or null (in case of non-AST structure, like a function).

§ Changelog

See it in the monorepo opens in a new tab, on GitHub.

§ Contributing

To report bugs or request features or assistance, raise an issue on GitHub opens in a new tab.

Any code contributions welcome! All Pull Requests will be dealt promptly.

§ Licence

MIT opens in a new tab

Copyright © 2010–2021 Roy Revelt and other contributors

Related packages:

📦 ast-compare 2.0.14
Compare anything: AST, objects, arrays, strings and nested thereof
📦 ast-get-object 2.0.14
Getter/setter for nested parsed HTML AST's, querying objects by key/value pairs
📦 ast-monkey-util 1.3.14
Utility library of AST helper functions
📦 ast-loose-compare 2.0.14
Compare anything: AST, objects, arrays and strings
📦 ast-get-values-by-key 3.0.14
Extract values and paths from AST by keys OR set them by keys
📦 ast-monkey 7.13.14
Traverse and edit AST
📦 ast-monkey-traverse-with-lookahead 2.0.14
Utility library to traverse AST, reports upcoming values