functionalscript
Version:
FunctionalScript is a purely functional subset of JavaScript
27 lines (26 loc) • 629 B
JavaScript
import { flat, utf8, utf8ToString } from "./module.f.js";
import { join } from "../types/string/module.f.js";
export default {
block: () => {
const text = [
'a',
'b',
() => [
'c',
() => ['d'],
],
'e',
];
const result = join('\n')(flat(':')(text));
if (result !== 'a\nb\n:c\n::d\ne') {
throw result;
}
},
encoding: () => {
const v = utf8('Hello world!');
const r = utf8ToString(v);
if (r !== 'Hello world!') {
throw r;
}
}
};