instance.js 418 B

1234567891011121314151617
  1. 'use strict';
  2. var test = require('tape');
  3. var traverse = require('../');
  4. var EventEmitter = require('events').EventEmitter;
  5. test('check instanceof on node elems', function (t) {
  6. var counts = { emitter: 0 };
  7. traverse([new EventEmitter(), 3, 4, { ev: new EventEmitter() }])
  8. .forEach(function (node) {
  9. if (node instanceof EventEmitter) { counts.emitter += 1; }
  10. });
  11. t.equal(counts.emitter, 2);
  12. t.end();
  13. });