Skip to content

Commit

Permalink
Added codegen test to determine if any ancient browsers don't actuall…
Browse files Browse the repository at this point in the history
…y support it
  • Loading branch information
dcodeIO committed Dec 18, 2016
1 parent 19e906c commit c234de7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,8 @@ NamespacePrototype.lookup = function lookup(path, filterType, parentAlreadyCheck
return this.getRoot().lookup(path.slice(1), filterType);
// Test if the first part matches any nested object, and if so, traverse if path contains more
var found = this.get(path[0]);
if (found && path.length === 1 || found instanceof Namespace && (found = found.lookup(path.slice(1), true)))
if (!filterType || found instanceof filterType)
return found;
if (found && path.length === 1 && (!filterType || found instanceof filterType) || found instanceof Namespace && (found = found.lookup(path.slice(1), filterType, true)))
return found;
// If there hasn't been a match, try again at the parent
if (this.parent === null || parentAlreadyChecked)
return null;
Expand Down
8 changes: 8 additions & 0 deletions tests/codegen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var tape = require("tape");

var protobuf = require("..");

tape.test("codegen", function(test) {
test.equal(protobuf.util.codegen.supported, true, "should be supported");
test.end();
});

0 comments on commit c234de7

Please sign in to comment.