source: imaps-frontend/node_modules/which-collection/index.js@ d565449

main
Last change on this file since d565449 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
Line 
1'use strict';
2
3var isMap = require('is-map');
4var isSet = require('is-set');
5var isWeakMap = require('is-weakmap');
6var isWeakSet = require('is-weakset');
7
8/** @type {import('.')} */
9module.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.