main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
718 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var isString = require('is-string');
|
---|
4 | var isNumber = require('is-number-object');
|
---|
5 | var isBoolean = require('is-boolean-object');
|
---|
6 | var isSymbol = require('is-symbol');
|
---|
7 | var isBigInt = require('is-bigint');
|
---|
8 |
|
---|
9 | /** @type {import('.')} */
|
---|
10 | // eslint-disable-next-line consistent-return
|
---|
11 | module.exports = function whichBoxedPrimitive(value) {
|
---|
12 | // eslint-disable-next-line eqeqeq
|
---|
13 | if (value == null || (typeof value !== 'object' && typeof value !== 'function')) {
|
---|
14 | return null;
|
---|
15 | }
|
---|
16 | if (isString(value)) {
|
---|
17 | return 'String';
|
---|
18 | }
|
---|
19 | if (isNumber(value)) {
|
---|
20 | return 'Number';
|
---|
21 | }
|
---|
22 | if (isBoolean(value)) {
|
---|
23 | return 'Boolean';
|
---|
24 | }
|
---|
25 | if (isSymbol(value)) {
|
---|
26 | return 'Symbol';
|
---|
27 | }
|
---|
28 | if (isBigInt(value)) {
|
---|
29 | return 'BigInt';
|
---|
30 | }
|
---|
31 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.