Aller au contenu principal

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 ?? '';