|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
509 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var isMap = require('is-map');
|
|---|
| 4 | var isSet = require('is-set');
|
|---|
| 5 | var isWeakMap = require('is-weakmap');
|
|---|
| 6 | var isWeakSet = require('is-weakset');
|
|---|
| 7 |
|
|---|
| 8 | /** @type {import('.')} */
|
|---|
| 9 | module.exports = function whichCollection(/** @type {unknown} */ value) {
|
|---|
| 10 | if (value && typeof value === 'object') {
|
|---|
| 11 | if (isMap(value)) {
|
|---|
| 12 | return 'Map';
|
|---|
| 13 | }
|
|---|
| 14 | if (isSet(value)) {
|
|---|
| 15 | return 'Set';
|
|---|
| 16 | }
|
|---|
| 17 | if (isWeakMap(value)) {
|
|---|
| 18 | return 'WeakMap';
|
|---|
| 19 | }
|
|---|
| 20 | if (isWeakSet(value)) {
|
|---|
| 21 | return 'WeakSet';
|
|---|
| 22 | }
|
|---|
| 23 | }
|
|---|
| 24 | return false;
|
|---|
| 25 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.