UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

14 lines (11 loc) 276 B
import { isNil } from '../../predicate/isNil.mjs'; function size(target) { if (isNil(target)) { return 0; } if (target instanceof Map || target instanceof Set) { return target.size; } return Object.keys(target).length; } export { size };