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();