Returns the empty value of its argument’s type — [], '', {}, a zero-length typed array, and more. Part of Ramda Function since v0.3.0 (stable — not deprecated, experimental, or non-standard).
Note: Dispatches to .empty / Fantasy Land Monoid when present. Does not mutate the input. Unsupported types return undefined.
Syntax
Call R.empty. Start with this line.
Ramda
R.empty(x)
Call
What it does
R.empty(x)
Primary signature.
R.empty(...)
Call the function helper.
Prefer import { empty } from "ramda" when you want a named import.
Numbers. No empty for a number → undefined (no throw).
Compatibility
Browser & Runtime Support
R.empty is a Ramda Function helper since v0.3.0. It runs anywhere Ramda runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install ramda.
✓ Stable · Ramda 0.3.0+
R.empty()
Available in long-standing Ramda builds. Array, String, Object, and TypedArray empties work in evergreen browsers and current Node LTS when Ramda is installed.
100%With Ramda 0.3.0+
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
R.emptyRamda 0.3.0+
Bottom line: Safe for production once Ramda is loaded. Use a CDN build such as ramda.min.js in the browser, or install ramda from npm for Node. Check your Ramda version if you need Map/Set empty values.
Frequently Asked Questions
R.empty(x) returns a new empty value of the same type as x. Arrays become [], strings become '', objects become {}, and typed arrays become a zero-length typed array. The original value is not mutated.
R.empty([1, 2, 3]); //=> []. R.empty('unicorns'); //=> ''. R.empty({x: 1, y: 2}); //=> {}. R.empty(Uint8Array.from('123')); //=> Uint8Array []. The docs also show R.empty(Just(42)) as Nothing() when a Fantasy Land Maybe type is loaded. Added in v0.3.0.
R.empty(x) builds a blank container of x's type. R.isEmpty(x) returns true or false: is this value already that blank? Pair them: R.isEmpty(R.empty([1, 2, 3])) is true.
No. R.empty([1, 2, 3]) returns a new []. The source array still holds 1, 2, 3. The same is true for objects, strings, and typed arrays.
Unsupported types return undefined. R.empty(42) is undefined. Map and Set empty values arrived in later Ramda releases; the CDN labs on this site use 0.30.1, so R.empty(new Set([1, 2])) is also undefined there.
No. R.empty is a stable Ramda function helper from v0.3.0. It is not deprecated, experimental, or non-standard.