Created
August 4, 2016 09:57
-
-
Save nobitagit/2f7bdebbc1e17d5ec53dd250ec9ba1b3 to your computer and use it in GitHub Desktop.
Systematic program design in Js - How to design data - Enumeration
This file contains hidden or 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
| /** | |
| * Role is one of: | |
| * - "superAdmin" | |
| * - "admin" | |
| * - "user" | |
| * | |
| * Interp. the role of a registered user | |
| **/ | |
| // <examples are redundant for enumerations> | |
| /** | |
| * function fnForRole(role) { | |
| * if (role === "superAdmin") { | |
| * .... | |
| * } | |
| * if (role === "admin") { | |
| * .... | |
| * } | |
| * if (role === "user") { | |
| * .... | |
| * } | |
| * } | |
| * | |
| * Template rules used: | |
| * - one of: 3 cases | |
| * - atomic distinct: "superAdmin" | |
| * - atomic distinct: "admin" | |
| * - atomic distinct: "user" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment