-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change class option to take strings and document it
This changes to class option to take strings instead of integers, so 1 becomes 'IN', 3 becomes 'CH' and so on. Also documented the class option.
- Loading branch information
1 parent
a77e1bb
commit d0c5c02
Showing
4 changed files
with
36 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict' | ||
|
||
exports.toString = function (klass) { | ||
switch (klass) { | ||
case 1: return 'IN' | ||
case 2: return 'CS' | ||
case 3: return 'CH' | ||
case 4: return 'HS' | ||
case 255: return 'ANY' | ||
} | ||
return 'UNKNOWN_' + klass | ||
} | ||
|
||
exports.toClass = function (name) { | ||
switch (name.toUpperCase()) { | ||
case 'IN': return 1 | ||
case 'CS': return 2 | ||
case 'CH': return 3 | ||
case 'HS': return 4 | ||
case 'ANY': return 255 | ||
} | ||
return 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters