refactor: strictly typed

This commit is contained in:
harttle
2019-02-23 00:49:54 +08:00
parent 51f7e66f60
commit 5b6100d12b
86 changed files with 2630 additions and 2590 deletions
+6 -6
View File
@@ -49,27 +49,27 @@ export const operators = [
/==|!=|<=|>=|<|>|\s+contains\s+/
]
export function isInteger (str) {
export function isInteger (str: string) {
return integerLine.test(str)
}
export function isLiteral (str) {
export function isLiteral (str: string) {
return literalLine.test(str)
}
export function isRange (str) {
export function isRange (str: string) {
return rangeLine.test(str)
}
export function isVariable (str) {
export function isVariable (str: string) {
return variableLine.test(str)
}
export function matchValue (str) {
export function matchValue (str: string) {
return value.exec(str)
}
export function parseLiteral (str) {
export function parseLiteral (str: string) {
let res = str.match(numberLine)
if (res) {
return Number(str)