Skip to main content

stubString()

stubString(): string

Returns an empty string.

DEPRECATED

Use an inline arrow function () => '' instead.


Returns: stringโ€‹

An empty string.


Sinceโ€‹

2.0.0


Also known asโ€‹

stubString (Lodash, es-toolkit) ยท โŒ (Remeda, Radashi, Ramda, Effect, Modern Dash, Antfu)


Exampleโ€‹

// โŒ Deprecated approach
stubString(); // => ''

// โœ… Recommended approach
(() => '')(); // => ''

How it works?โ€‹

Returns an empty string. Deprecated: Use () => '' directly.

Native Equivalentโ€‹

// โŒ stubString
// โœ… () => ''

Use Casesโ€‹

Return empty string ๐Ÿ“Œโ€‹

Return empty string as default.

const getDefault = () => '';

Fallback valueโ€‹

Use empty string as fallback.

const name = user.name ?? '';