Skip to content

Commit

Permalink
Use the typeByName hash in expect.getType
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed Feb 26, 2017
1 parent 73279fb commit d9192ed
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/Unexpected.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ function Unexpected(options) {
var that = this;
this.getType = function (typeName, ignoreParent) {
// Why not use Unexpected#typeByName?
return utils.findFirst(that.types, function (type) {
return type.name === typeName;
}) || (!ignoreParent && that.parent && that.parent.getType(typeName));
return that.typeByName[typeName] || (!ignoreParent && that.parent && that.parent.getType(typeName));
};
this.findTypeOf = function (obj) {
return utils.findFirst(that.types || [], function (type) {
Expand Down

0 comments on commit d9192ed

Please sign in to comment.