isValidContainer
Check whether a value is a valid container, an object or array including Proxy instances, before iterating or assigning nested keys.
Usage
isValidContainer checks whether a value is a valid container type (object or array).
Unlike isObject, isValidContainer accepts both objects and arrays as valid containers, and supports Vue 3 Proxy objects and Proxy arrays.
import { isValidContainer } from '@movk/core'
isValidContainer({}) // true
isValidContainer([]) // true
isValidContainer(new Proxy({}, {})) // true
isValidContainer(null) // false
isValidContainer('string') // false
isValidContainer(123) // false
API
isValidContainer(value)
Check whether a value is a valid container type (object or array).
Parameters
value
any required
The value to check.
Returns
Returns
boolean
Whether the value is a valid container (object or array).
Changelog
No recent changes