Skip to content

Commit

Permalink
style: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinaldy Rafli committed Aug 21, 2021
1 parent da32b65 commit 7e78c28
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/points.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export function getPoints(lineOfCode: string, checkers: LanguagePattern[]): numb
const checker: number[] = checkers.map((o) => {
if (o.pattern.test(lineOfCode)) {
if (o.points) {
return o.points
return o.points;
}
return parsePoint(o.type)
};
return parsePoint(o.type);
}
return 0;
});
const reduced = checker.reduce((memo, num) => memo + num, 0);
Expand All @@ -39,30 +39,30 @@ function parsePoint(type: Type) {
case 'constant.null':
case 'meta.import':
case 'meta.module':
return 5
return 5;
case 'keyword.function':
return 4
return 4;
case 'constant.type':
case 'constant.string':
case 'constant.numeric':
case 'constant.boolean':
case 'constant.dictionary':
case 'constant.array':
case 'keyword.variable':
return 3
return 3;
case 'section.scope':
case 'keyword.other':
case 'keyword.operator':
case 'keyword.control':
case 'keyword':
return 2
return 2;
case 'comment.block':
case 'comment.line':
case 'comment.documentation':
case 'macro':
return 1
return 1;
case 'not':
default:
return -50
return -50;
}
}
}
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type Type =
| 'keyword.operator' // >, <, -, << not important tbh you could get away with this
| 'keyword.function' // func pattern() {, function pattern(), fn pattern() {
| 'macro' // @println, println!
| 'not' // not in current language
| 'not'; // not in current language

export interface LanguagePattern {
pattern: RegExp;
Expand Down

0 comments on commit 7e78c28

Please sign in to comment.