static.js 481 B

123456789101112131415161718
  1. if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
  2. var B = require('../').Buffer
  3. var test = require('tape')
  4. test('Buffer.isEncoding', function (t) {
  5. t.equal(B.isEncoding('HEX'), true)
  6. t.equal(B.isEncoding('hex'), true)
  7. t.equal(B.isEncoding('bad'), false)
  8. t.end()
  9. })
  10. test('Buffer.isBuffer', function (t) {
  11. t.equal(B.isBuffer(new B('hey', 'utf8')), true)
  12. t.equal(B.isBuffer(new B([1, 2, 3], 'utf8')), true)
  13. t.equal(B.isBuffer('hey'), false)
  14. t.end()
  15. })