File: test.js

package info (click to toggle)
node-is-obj 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 128 kB
  • sloc: javascript: 52; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 736 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const test = require('tape');
const isObject = require('.');

test('main', t => {
	/* eslint-disable no-new-object */
	t.true(isObject({}));
	t.true(isObject(new Object()));
	t.true(isObject(new Date()));
	t.true(isObject(new RegExp()));
	t.true(isObject(Object.create(null)));
	t.true(isObject({foo: true}));
	t.true(isObject([]));
	t.true(isObject(['foo', 'bar']));
	t.true(isObject(() => {}));
	t.true(isObject(/./));
	t.true(isObject(new Object(0)));
	t.true(isObject(new Object('foo')));
	t.true(isObject(new Object(false)));
	t.false(isObject(null));
	t.false(isObject(undefined));
	t.false(isObject(NaN));
	t.false(isObject(''));
	t.false(isObject(0));
	t.false(isObject(false));
	/* eslint-enable no-new-object */
	t.end();
});