mirror of
https://github.com/encounter/jco.git
synced 2026-03-30 11:18:26 -07:00
21 lines
505 B
JavaScript
21 lines
505 B
JavaScript
|
|
/**
|
||
|
|
* This module is the JS implementation of the `reverser` WIT world
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 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 = {
|
||
|
|
/**
|
||
|
|
* 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("");
|
||
|
|
}
|
||
|
|
|
||
|
|
};
|