%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/node_modules/is-number-object/test/
Upload File :
Create Path :
Current File : /var/www/html/node_modules/is-number-object/test/index.js

'use strict';

var test = require('tape');
var isNumber = require('../');
var hasToStringTag = require('has-tostringtag/shams')();

test('not Numbers', function (t) {
	t.notOk(isNumber(), 'undefined is not Number');
	t.notOk(isNumber(null), 'null is not Number');
	t.notOk(isNumber(false), 'false is not Number');
	t.notOk(isNumber(true), 'true is not Number');
	t.notOk(isNumber('foo'), 'string is not Number');
	t.notOk(isNumber([]), 'array is not Number');
	t.notOk(isNumber({}), 'object is not Number');
	t.notOk(isNumber(function () {}), 'function is not Number');
	t.notOk(isNumber(/a/g), 'regex literal is not Number');
	t.notOk(isNumber(new RegExp('a', 'g')), 'regex object is not Number');
	t.notOk(isNumber(new Date()), 'new Date() is not Number');
	t.end();
});

test('@@toStringTag', { skip: !hasToStringTag }, function (t) {
	var fakeNumber = {
		toString: function () { return '7'; },
		valueOf: function () { return 42; }
	};
	fakeNumber[Symbol.toStringTag] = 'Number';
	t.notOk(isNumber(fakeNumber), 'fake Number with @@toStringTag "Number" is not Number');
	t.end();
});

test('Numbers', function (t) {
	t.ok(isNumber(42), 'number is Number');
	t.ok(isNumber(Object(42)), 'number object is Number');
	t.ok(isNumber(NaN), 'NaN is Number');
	t.ok(isNumber(Infinity), 'Infinity is Number');
	t.end();
});

Zerion Mini Shell 1.0