2024-01-16 21:26:16 +08:00
|
|
|
'use strict';
|
|
|
|
|
2023-12-18 13:12:25 +08:00
|
|
|
var test = require('tape');
|
|
|
|
var traverse = require('../');
|
|
|
|
var EventEmitter = require('events').EventEmitter;
|
|
|
|
|
|
|
|
test('check instanceof on node elems', function (t) {
|
2024-01-16 21:26:16 +08:00
|
|
|
var counts = { emitter: 0 };
|
|
|
|
|
|
|
|
traverse([new EventEmitter(), 3, 4, { ev: new EventEmitter() }])
|
|
|
|
.forEach(function (node) {
|
|
|
|
if (node instanceof EventEmitter) { counts.emitter += 1; }
|
|
|
|
});
|
|
|
|
t.equal(counts.emitter, 2);
|
|
|
|
|
|
|
|
t.end();
|
2023-12-18 13:12:25 +08:00
|
|
|
});
|