| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,25 @@ | |||
| 1 | + "use strict"; | ||
| 2 | + import Junction from "./junction"; | ||
| 3 | + import assert from "power-assert"; | ||
| 4 | + let junction = new Junction(); | ||
| 5 | + junction.use(function toUpperCase(res, next) { | ||
| 6 | + res.value = res.value.toUpperCase(); | ||
| 7 | + next(); | ||
| 8 | + }); | ||
| 9 | + junction.use(function exclamationMark(res, next) { | ||
| 10 | + res.value = res.value + "!"; | ||
| 11 | + next(); | ||
| 12 | + }); | ||
| 13 | + junction.use(function (error, res, next) { | ||
| 14 | + console.error(error.stack); | ||
| 15 | + next(); | ||
| 16 | + }); | ||
| 17 | + | ||
| 18 | + let text = "hello world"; | ||
| 19 | + junction.process(text, function (error, result) { | ||
| 20 | + if (error) { | ||
| 21 | + console.error(error); | ||
| 22 | + } | ||
| 23 | + let value = result.value; | ||
| 24 | + assert.equal(value, "HELLO WORLD!"); | ||
| 25 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments