Skip to Content
  • Website
Codsen
  • Home
  • Open Source
  • Articles
  • About

prevOpen Source→ast-is-emptynext

ast-is-empty4.2.0

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

Downloads per monthChangelogMIT Licenselibera manifesto
  • the top
  • Installation
  • Quick Take
  • Examples
  • PURPOSE
  • API — ISEMPTY()
  • API — VERSION
  • Changelog

Installation

Quick Take

Examples

  • Recognise a tree made only from empty strings and containers
  • Return null when the tree contains an unsupported value type
  • Treat whitespace-only strings as content

Purpose

Sometimes you 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.

API — isEmpty()

The main function isEmpty() is imported like this:

It’s a function which takes one input arguments, of any type:

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

API — version

You can import version:

Changelog

Open Changelog
↑ back to top
prev next

Copyright

All rights reserved © Roy Revelt 2026
All our open source packages are under MIT licenceopens in a new tab

Activities

🐛 See a bug? Raise an issueopens in a new tab
💘 Check out the Indiewebopens in a new tab and Libera manifestoopens in a new tab