Skip to content

Commit

Permalink
refactor(examples): inline reverseString() in example
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
  • Loading branch information
vados-cosmonic committed Oct 16, 2024
1 parent 8ba4fe9 commit 8f776c3
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions examples/components/string-reverse/string-reverse.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
* This module is the JS implementation of the `reverser` WIT world
*/

/**
* This Javascript will be interpreted by `jco` and turned into a
* WebAssembly binary with a single export (this `reverse` function).
*/
function reverseString(s) {
return s.split("")
.reverse()
.join("");
}

/**
* The Javascript export below represents the export of the `reverse` interface,
* which which contains `reverse-string` as it's primary exported function.
*/
export const reverse = {
reverseString,
/**
* This Javascript will be interpreted by `jco` and turned into a
* WebAssembly binary with a single export (this `reverse` function).
*/
reverseString(s) {
return s.split("")
.reverse()
.join("");
}

};

0 comments on commit 8f776c3

Please sign in to comment.