-
Notifications
You must be signed in to change notification settings - Fork 42
Conversation
metadata[metadataKey] = buildRuleset(metadataKey, metadataRule)(doc); | ||
} else { | ||
metadata[metadataKey] = getMetadata(doc, metadataRule); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine, but I'm still trying to wrap my head around the shift from typeof metadataRule === 'function'
to Array.isArray()
and if the code is doing the same thing here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a weird difference. Where previously we were looking for typeof function because we had already applied buildRuleset and so each 'rule' was a callable. But now we've pushed that off, and so we're looking for arrays which are lists of rules, and then we wrap them in buildRuleset and apply them, or recurse deeper.
R+ Looks good to me (with the one question/concern noted above). |
Fixes #50