|
Last change
on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
276 bytes
|
| Line | |
|---|
| 1 | import { isNil } from '../../predicate/isNil.mjs';
|
|---|
| 2 |
|
|---|
| 3 | function size(target) {
|
|---|
| 4 | if (isNil(target)) {
|
|---|
| 5 | return 0;
|
|---|
| 6 | }
|
|---|
| 7 | if (target instanceof Map || target instanceof Set) {
|
|---|
| 8 | return target.size;
|
|---|
| 9 | }
|
|---|
| 10 | return Object.keys(target).length;
|
|---|
| 11 | }
|
|---|
| 12 |
|
|---|
| 13 | export { size };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.