You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

is-buffer.js 664B

12345678910111213141516171819202122
  1. if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
  2. var B = require('../').Buffer
  3. var isBuffer = require('is-buffer')
  4. var test = require('tape')
  5. test('is-buffer tests', function (t) {
  6. t.ok(isBuffer(new B(4)), 'new Buffer(4)')
  7. t.notOk(isBuffer(undefined), 'undefined')
  8. t.notOk(isBuffer(null), 'null')
  9. t.notOk(isBuffer(''), 'empty string')
  10. t.notOk(isBuffer(true), 'true')
  11. t.notOk(isBuffer(false), 'false')
  12. t.notOk(isBuffer(0), '0')
  13. t.notOk(isBuffer(1), '1')
  14. t.notOk(isBuffer(1.0), '1.0')
  15. t.notOk(isBuffer('string'), 'string')
  16. t.notOk(isBuffer({}), '{}')
  17. t.notOk(isBuffer(function foo () {}), 'function foo () {}')
  18. t.end()
  19. })