Skip to content

Commit

Permalink
WIP: improve helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethanCeyer committed Mar 29, 2018
1 parent 79a2e03 commit 024fb51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/token/token.helper.base.ts
Expand Up @@ -3,7 +3,12 @@ import { TokenTypeHelper } from './token.type.helper';

export abstract class TokenHelperBase extends TokenTypeHelper {
public static isToken(token: Token.Token): boolean {
return token && (this.isNumeric(token) || this.isSymbol(token) || this.isObject(token));
const validators = [
TokenHelperBase.isNumeric,
TokenHelperBase.isSymbol,
TokenHelperBase.isObject
];
return token && validators.some(validator => validator(token));
}

public static isUnkown(token: Token.Token): boolean {
Expand Down
2 changes: 1 addition & 1 deletion src/token/token.type.helper.ts
Expand Up @@ -18,6 +18,6 @@ export abstract class TokenTypeHelper {
}

public static isValue(token: Token.Token): boolean {
return this.isObject(token) || this.isNumeric(token);
return TokenTypeHelper.isObject(token) || TokenTypeHelper.isNumeric(token);
}
}

0 comments on commit 024fb51

Please sign in to comment.