main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
509 bytes
|
Rev | Line | |
---|
[d565449] | 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.