index.js 885 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. 'use strict';
  2. var test = require('tape');
  3. var isObject = require('../index');
  4. test('returns true for objects', function (assert) {
  5. assert.equal(isObject({}), true);
  6. assert.equal(isObject([]), true);
  7. assert.end();
  8. });
  9. test('returns false for null', function (assert) {
  10. assert.equal(isObject(null), false);
  11. assert.end();
  12. });
  13. test('returns false for undefined', function (assert) {
  14. assert.equal(isObject(undefined), false);
  15. assert.end();
  16. });
  17. test('returns false for booleans', function (assert) {
  18. assert.equal(isObject(true), false);
  19. assert.equal(isObject(false), false);
  20. assert.end();
  21. });
  22. test('returns false for primitives', function (assert) {
  23. assert.equal(isObject(42), false);
  24. assert.equal(isObject('foo'), false);
  25. assert.end();
  26. });
  27. test('returns false for functions', function (assert) {
  28. assert.equal(isObject(function () {}), false);
  29. assert.end();
  30. });