Permalink
Browse files

feat(api): static method for matching a comparator

  • Loading branch information...
RangerRick committed Aug 4, 2017
1 parent 6897389 commit df907513bbf57fbcd02aaca05e786a260b3e7540
Showing with 11 additions and 0 deletions.
  1. +11 −0 src/api/Comparator.ts
View
@@ -5,6 +5,17 @@ import {OnmsEnum} from '../internal/OnmsEnum';
* @module Comparator
*/
export class Comparator extends OnmsEnum<number> {
/** Find the comparator that matches the given comparator string. */
public static find(comparator: string) {
for (const key of Object.keys(Comparators)) {
const comp = Comparators[key];
if (comp.matches(comparator)) {
return comp;
}
}
return null;
}
/** Aliases for the command-line. */
private aliases = [] as string[];

0 comments on commit df90751

Please sign in to comment.