UNPKG

ts-prime

Version:

A utility library for JavaScript and Typescript.

33 lines (32 loc) 1.17 kB
import { type } from './type'; it('"Array" if given an array literal', function () { expect(type([1, 2, 3])).toEqual('Array'); }); it('"Object" if given an object literal', function () { expect(type({ batman: 'na na na na na na na' })).toEqual('Object'); }); it('"RegExp" if given a RegExp literal', function () { expect(type(/[A-z]/)).toEqual('RegExp'); }); it('"Number" if given a numeric value', function () { expect(type(4)).toEqual('Number'); }); it('"Object" if given a date value', function () { expect(type(new Date())).toEqual('Date'); }); it('"Number" if given the NaN value', function () { expect(type(NaN)).toEqual('Number'); }); it('"String" if given a String literal', function () { expect(type('Gooooodd Mornning a!!')).toEqual('String'); }); it('"String" if given a String object', function () { // tslint:disable-next-line:no-construct expect(type(new String('I am a String object'))).toEqual('String'); }); it('"Null" if given the null value', function () { expect(type(null)).toEqual('Null'); }); it('"Undefined" if given the undefined value', function () { expect(type(undefined)).toEqual('Undefined'); });