stubObject()
stubObject():
object
Returns an empty object.
DEPRECATED
Use an inline arrow function () => ({}) instead.
Returns: objectโ
An empty object.
Sinceโ
2.0.0
Also known asโ
stubObject (Lodash, es-toolkit) ยท โ (Remeda, Radashi, Ramda, Effect, Modern Dash, Antfu)
Exampleโ
// โ Deprecated approach
stubObject(); // => {}
// โ
Recommended approach
(() => ({}))(); // => {}
How it works?โ
Returns an empty object.
Deprecated: Use () => ({}) directly.
Native Equivalentโ
// โ stubObject
// โ
() => ({})
Use Casesโ
Return empty object ๐โ
Return empty object as default.
const getDefaults = () => ({});
Initialize stateโ
Create empty initial state.
const createState = () => ({});
const state = createState();