Skip to content

Commit c234de7

Browse files
committed
Added codegen test to determine if any ancient browsers don't actually support it
1 parent 19e906c commit c234de7

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/namespace.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,8 @@ NamespacePrototype.lookup = function lookup(path, filterType, parentAlreadyCheck
283283
return this.getRoot().lookup(path.slice(1), filterType);
284284
// Test if the first part matches any nested object, and if so, traverse if path contains more
285285
var found = this.get(path[0]);
286-
if (found && path.length === 1 || found instanceof Namespace && (found = found.lookup(path.slice(1), true)))
287-
if (!filterType || found instanceof filterType)
288-
return found;
286+
if (found && path.length === 1 && (!filterType || found instanceof filterType) || found instanceof Namespace && (found = found.lookup(path.slice(1), filterType, true)))
287+
return found;
289288
// If there hasn't been a match, try again at the parent
290289
if (this.parent === null || parentAlreadyChecked)
291290
return null;

tests/codegen.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
var tape = require("tape");
2+
3+
var protobuf = require("..");
4+
5+
tape.test("codegen", function(test) {
6+
test.equal(protobuf.util.codegen.supported, true, "should be supported");
7+
test.end();
8+
});

0 commit comments

Comments
 (0)