Ramda’s R.isNotEmpty() answers the flipped logic question: is this value not the empty leftover of its own type? You pass one value. You get back true or false. It is the named form of R.complement(R.isEmpty). Drop it into R.filter when you want filled leftovers to stay.
The official sample is the whole idea. [1, 2, 3] is not empty, so the leftover is true. [], '', and {} are empty, so the leftover is false. null is true — missing leftover is not empty leftover. Previous Logic helper is R.isEmpty. Next is R.not.
Syntax
Call R.isNotEmpty. Start with this line.
Ramda
R.isNotEmpty(x)
Call
What it does
R.isNotEmpty(x)
Primary signature.
R.isNotEmpty(...)
Call the logic helper.
Prefer import { isNotEmpty } from "ramda" when you want a named import.
Library declarations
Ramda
R.isNotEmpty(x)
Parameters
Parameter
Description
x
Required. Any. The value to test. Lists, strings, objects, typed arrays, and other values are allowed.
Return Value
Return Value
Description
Boolean
false if x is its type's empty leftover. true otherwise, including for null and undefined.
Ramda Examples
📚 Getting Started
The official Ramda filled-list sample, then the same leftovers compared with isEmpty.
Example 1 — Official Filled List, Empty Leftovers, and null
A filled list is not empty. Empty list, string, or object is empty. null is not empty, so isNotEmpty is true.
R.isNotEmpty is already a predicate. filter keeps items that pass. reject keeps items that fail. Same leftover as R.reject(R.isEmpty, rows) for this list.
Example 5 — Empty Typed Array vs Complement
The official typed-array sample. An empty Uint8Array is empty, so isNotEmpty is false. Complement matches the named helper.
That matches the docs Uint8Array.from('') sample. R.complement(R.isEmpty) is the handmade form of isNotEmpty.
Compatibility
Browser Support
R.isNotEmpty() is ordinary JavaScript once Ramda is loaded. Logos use the shared browser-image-sprite.png sprite from this project.
✓ Ramda 0.29.2+ · Any JS runtime
Ramda.js R.isNotEmpty()
Load Ramda 0.29.2 or later via CDN or npm, then call R.isNotEmpty with one value. These labs use [email protected]. No extra browser API is required.
100%With Ramda 0.29.2+
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
R.isNotEmpty()Universal
Bottom line: Safe in any project that includes a Ramda build with isNotEmpty (official stamp v0.29.2; [email protected] in these labs). Use a CDN build such as ramda.min.js in the browser or install ramda from npm for Node.
Frequently Asked Questions
R.isNotEmpty(x) returns false if x is its type's empty value, otherwise true. It is the complement of R.isEmpty. Official docs stamp Added in v0.29.2. Type: a → Boolean. Arity 1, curried.
R.isNotEmpty([1, 2, 3]) is true. R.isNotEmpty([]) is false. R.isNotEmpty('') is false. R.isNotEmpty(null) is true. R.isNotEmpty({}) is false. R.isNotEmpty({ length: 0 }) is true. R.isNotEmpty(Uint8Array.from('')) is false.
Because R.isEmpty(null) is false. isNotEmpty is !isEmpty, so missing leftover is not empty leftover, and the named helper returns true. Use R.isNil when you mean null or undefined.
They are complements. Every leftover that isEmpty calls true, isNotEmpty calls false, and the other way around. Same types, flipped boolean.
Yes. That object has a length key, so it is not an empty array. R.isNotEmpty({ length: 0 }) is true. R.isNotEmpty([]) is false.
No. R.isNotEmpty is a stable Ramda logic helper. Official docs stamp v0.29.2. It is not deprecated, experimental, or non-standard. These labs load [email protected], which includes the helper.