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@…>, 2 weeks ago

F4 Finalna Verzija

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