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:
691 bytes
|
Rev | Line | |
---|
[d565449] | 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 | // eslint-disable-next-line consistent-return
|
---|
| 10 | module.exports = function whichBoxedPrimitive(value) {
|
---|
| 11 | // eslint-disable-next-line eqeqeq
|
---|
| 12 | if (value == null || (typeof value !== 'object' && typeof value !== 'function')) {
|
---|
| 13 | return null;
|
---|
| 14 | }
|
---|
| 15 | if (isString(value)) {
|
---|
| 16 | return 'String';
|
---|
| 17 | }
|
---|
| 18 | if (isNumber(value)) {
|
---|
| 19 | return 'Number';
|
---|
| 20 | }
|
---|
| 21 | if (isBoolean(value)) {
|
---|
| 22 | return 'Boolean';
|
---|
| 23 | }
|
---|
| 24 | if (isSymbol(value)) {
|
---|
| 25 | return 'Symbol';
|
---|
| 26 | }
|
---|
| 27 | if (isBigInt(value)) {
|
---|
| 28 | return 'BigInt';
|
---|
| 29 | }
|
---|
| 30 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.