(container)
| 87781 | var ERR_NOT_OBJECT = "count(): argument not an object"; |
| 87782 | var ERR_NOT_CONTAINER = "count(): argument not a container"; |
| 87783 | function count(container) { |
| 87784 | if (!isObject(container)) throw new Error(ERR_NOT_OBJECT); |
| 87785 | if (typeof container.count === "function") return container.count(); |
| 87786 | if (Number.isFinite(container.size)) return container.size; |
| 87787 | if (Number.isFinite(container.length)) return container.length; |
| 87788 | if (isPlainObject(container)) return Object.keys(container).length; |
| 87789 | throw new Error(ERR_NOT_CONTAINER); |
| 87790 | } |
| 87791 | function isPlainObject(value) { |
| 87792 | return value !== null && (0, _typeofDefault.default)(value) === "object" && value.constructor === Object; |
| 87793 | } |
no test coverage detected