Skip to content

Commit d3e8454

Browse files
committed
fix: skip language check if no lang is detected
1 parent 199101d commit d3e8454

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

source/rules/lang.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ export default (parsed, when, value) => {
55
const detected = franc.all(parsed.subject)
66
.filter(lang => lang[1] >= 0.45)
77
.map(lang => lang[0]);
8-
const matches = detected.indexOf(value) > -1;
8+
9+
// franc spits out ['und'] when unable to
10+
// guess any languages, let it through in this case
11+
const matches = detected[0] === 'und' ||
12+
detected.indexOf(value) > -1;
913

1014
return [
1115
negated ? !matches : matches,

0 commit comments

Comments
 (0)