Ramda.js R.isEmpty() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Logic

Definition

Ramda’s R.isEmpty() answers a logic question: is this value the empty leftover of its own type? You pass one value. You get back true or false. Native JavaScript would write arr.length === 0 for lists and str === '' for strings. isEmpty names that idea once for lists, strings, objects, and typed arrays. Drop it into R.filter, R.reject, and R.ifElse.

The official sample is the whole idea. [], '', and {} are empty. [1, 2, 3] is not. null is not empty either — that is R.isNil. A plain object like { length: 0 } is not an empty array. Previous Logic helper is R.ifElse. Next is R.isNotEmpty.

Syntax

Call R.isEmpty. Start with this line.

Ramda
R.isEmpty(x)
CallWhat it does
R.isEmpty(x)Primary signature.
R.isEmpty(...)Call the logic helper.

Prefer import { isEmpty } from "ramda" when you want a named import.

Library declarations
Ramda
R.isEmpty(x)

Parameters

ParameterDescription
xRequired. Any. The value to test. Lists, strings, objects, typed arrays, and other values are allowed.

Return Value

Return ValueDescription
Booleantrue if x is its type's empty leftover. false otherwise, including for null and undefined.

Ramda Examples

📚 Getting Started

The official Ramda empty-list, empty-string, empty-object sample, then the same idea compared with isNil.

Example 1 — Official Empty List, String, and Object

A filled list is not empty. An empty list, string, or object is. null is not empty.

Ramda
R.isEmpty([1, 2, 3]);
//=> false

R.isEmpty([]);
//=> true

R.isEmpty('');
//=> true

R.isEmpty(null);
//=> false

R.isEmpty({});
//=> true
Try It Yourself

How It Works

That is the docs sample from ramdajs.com. Empty leftovers of the same type count. null has no type leftover to match, so it is false.

Example 2 — vs isNil

Empty string is empty, not nil. null is nil, not empty. 0 and false are neither empty nor nil in these labs.

Ramda
R.isEmpty('');
//=> true

R.isNil('');
//=> false

R.isEmpty(null);
//=> false

R.isNil(null);
//=> true

R.isEmpty(0);
//=> false

R.isEmpty(false);
//=> false
Try It Yourself

How It Works

isNil is only null and undefined. isEmpty is a type-empty leftover. In [email protected], 0 and false are not empty. See R.isNil.

📈 Practical Patterns

The official length-trap object, rejecting empty leftovers from a list, then an empty typed array.

Example 3 — { length: 0 } Is Not []

A plain object with a length key is not an empty array. Only a real empty list is empty.

Ramda
R.isEmpty({ length: 0 });
//=> false

R.isEmpty([]);
//=> true

R.isEmpty({ a: 1 });
//=> false
Try It Yourself

How It Works

The docs include this trap on purpose. { length: 0 } still has a key, so it is not {} and it is not [].

Example 4 — Reject Empty Leftovers

Drop empty lists and strings from a mixed list. Keep filled leftovers.

Ramda
const rows = ['ok', '', [], [1], {}];

R.reject(R.isEmpty, rows);
//=> ['ok', [1]]

R.filter(R.isEmpty, rows);
//=> ['', [], {}]
Try It Yourself

How It Works

R.isEmpty is already a predicate. reject keeps items that fail the test. filter keeps items that pass.

Example 5 — Empty Typed Array

The official typed-array sample. An empty Uint8Array is empty. A byte leftover is not.

Ramda
R.isEmpty(Uint8Array.from(''));
//=> true

R.isEmpty(Uint8Array.from([1]));
//=> false

R.complement(R.isEmpty)([1, 2]);
//=> true
Try It Yourself

How It Works

That matches the docs Uint8Array.from('') sample. R.complement(R.isEmpty) is the handmade form of isNotEmpty.

Browser Support

R.isEmpty() is ordinary JavaScript once Ramda is loaded. Logos use the shared browser-image-sprite.png sprite from this project.

✓ Ramda 0.1.0+ · Any JS runtime

Ramda.js R.isEmpty()

Load Ramda 0.1.0 or later via CDN or npm, then call R.isEmpty with one value. No extra browser API is required.

100% With Ramda 0.1.0+
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
R.isEmpty() Universal

Bottom line: Safe in any project that includes Ramda 0.1.0 or later. Use a CDN build such as ramda.min.js in the browser or install ramda from npm for Node. These labs use [email protected].

Frequently Asked Questions

R.isEmpty(x) returns true if x is its type's empty value, otherwise false. Added in v0.1.0. Type: a → Boolean. Arity 1, curried.
R.isEmpty([1, 2, 3]) is false. R.isEmpty([]) is true. R.isEmpty('') is true. R.isEmpty(null) is false. R.isEmpty({}) is true. R.isEmpty({ length: 0 }) is false. R.isEmpty(Uint8Array.from('')) is true.
No. Ramda treats null and undefined as not empty. R.isEmpty(null) is false. Use R.isNil for null or undefined.
isEmpty asks whether a value equals its type's empty leftover. isNil asks whether a value is null or undefined. An empty string is empty but not nil. null is nil but not empty.
No. That is a plain object with a length key, not an empty array. R.isEmpty({ length: 0 }) is false. R.isEmpty([]) is true.
No. R.isEmpty is a stable Ramda logic helper from v0.1.0. It is not deprecated, experimental, or non-standard.

Continue to R.isNotEmpty()

Learn how to test filled leftovers with Ramda R.isNotEmpty().

R.isNotEmpty() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful