Skip to content

Commit 14e83b3

Browse files
author
Robert Jackson
authored
analyzeEmberObject() exits too early not allowing to enumerate `h… (#22)
analyzeEmberObject() exits too early not allowing to enumerate `helpers`
2 parents 2651d17 + 17f4ff8 commit 14e83b3

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

lib/gather/analyze-ember-object.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ module.exports = function analyzeEmberObject(possibleEmberObject) {
22
if (typeof possibleEmberObject !== 'object' || possibleEmberObject === null) {
33
return undefined;
44
}
5-
if (possibleEmberObject.default && typeof possibleEmberObject.default.proto !== 'function') {
6-
return undefined;
7-
}
8-
9-
if (possibleEmberObject.default.isHelperFactory) {
10-
return {
11-
type: 'Helper',
12-
};
5+
let eObjDefault = possibleEmberObject.default;
6+
7+
if (eObjDefault) {
8+
if (eObjDefault.isHelperFactory) {
9+
return {
10+
type: 'Helper',
11+
};
12+
} else if (typeof eObjDefault.proto !== 'function') {
13+
return undefined;
14+
}
1315
}
1416

1517
let proto = possibleEmberObject.default.proto();

lib/gather/gather-telemetry.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ describe('Provide a personalized `Gathering Function`', () => {
4646
});
4747
});
4848

49-
test('can determine components with a robust function', async () => {
49+
test('can determine most Ember types with a robust function', async () => {
5050
await gatherTelemetry('http://localhost:4200', analyzeEmberObject);
5151
let telemetry = getTelemetry();
52-
expect(Object.values(telemetry).filter(Boolean).length).toEqual(29);
52+
expect(Object.values(telemetry).filter(Boolean).length).toEqual(34);
5353
});
5454

5555
test('can handle external functions', async () => {

0 commit comments

Comments
 (0)