Skip to content

Commit

Permalink
fix(object pattern matching rule): in the pattern object, property wi…
Browse files Browse the repository at this point in the history
…th value undefined is ignored i
  • Loading branch information
jhe committed Jul 8, 2016
1 parent c37430d commit 7f23371
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const primitivePatternHandler = (exp, [pattern, statements, ...args]) => {
const primitiveValueEqualTest = (expression, pattern) => expression === pattern;
const objectEqualTest = (expression, pattern) => {
for (const property in pattern) {
if ( !matchTest(pattern[property], expression[property]) ) {
if ( !isUndefined(pattern[property]) && !matchTest(pattern[property], expression[property]) ) {
return false
}
}
Expand Down

0 comments on commit 7f23371

Please sign in to comment.