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
| // koatil/index | |
| function group (middlewares) { | |
| return function _group (ctx, next) { | |
| return runGroup(middlewares, 0, ctx, next) | |
| } | |
| } | |
| function runGroup (routes, routeIndex, ctx, next) { | |
| const route = routes[routeIndex] |
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
| <style> | |
| * { | |
| font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"; | |
| box-sizing: border-box; | |
| } | |
| body { | |
| margin: 0px; | |
| position: fixed; | |
| top: 0; |
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
| exports.createLogger = function createLogger (write, values = []) { | |
| return { | |
| log: value => write([...values, value]), | |
| withContext: value => createLogger(write, [...values, value]) | |
| } | |
| } |
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
| function withTest (service, tester) { | |
| function mark () { | |
| if (process.env.NODE_ENV !== 'test') { | |
| return service | |
| } | |
| } | |
| return { ...service, mark, testMark } | |
| } |
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
| // "substitute" is too hard to type | |
| function sub (str, candidate, replacer) { | |
| /* | |
| NOTE: Using String.prototype.replace is bad because: | |
| 1) casting an arbitrary string to a RegExp is unsafe | |
| 2) replacement has obscure substitution rules ($ is special) | |
| */ | |
| let match = str.indexOf(candidate) | |
| if (match === -1) { |
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
| <value> ::= <nil> | <boolean> | <string> | <vector> | <map> | |
| <nil> ::= "nil" | |
| <boolean> ::= "true" | "false" | |
| <character> ::= <bring-your-own-utf8-character-term> | |
| <quote-escape> ::= '\"' | |
| <string-value> ::= <character> | <quote-escape> | |
| <string-content> ::= <string-value> | <string-value> <string-content> | |
| <string> ::= '"' <string-content> '"' |
OlderNewer