source: imaps-frontend/node_modules/is-number-object/index.js@ 79a0317

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: 698 bytes
Line 
1'use strict';
2
3var callBound = require('call-bound');
4
5var $numToStr = callBound('Number.prototype.toString');
6
7/** @type {import('.')} */
8var tryNumberObject = function tryNumberObject(value) {
9 try {
10 $numToStr(value);
11 return true;
12 } catch (e) {
13 return false;
14 }
15};
16var $toString = callBound('Object.prototype.toString');
17var numClass = '[object Number]';
18var hasToStringTag = require('has-tostringtag/shams')();
19
20/** @type {import('.')} */
21module.exports = function isNumberObject(value) {
22 if (typeof value === 'number') {
23 return true;
24 }
25 if (!value || typeof value !== 'object') {
26 return false;
27 }
28 return hasToStringTag ? tryNumberObject(value) : $toString(value) === numClass;
29};
Note: See TracBrowser for help on using the repository browser.