UNPKG

functionalscript

Version:

FunctionalScript is a purely functional subset of JavaScript

27 lines (26 loc) 641 B
import { flat, msbUtf8, msbUtf8ToString } 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 = msbUtf8('Hello world!'); const r = msbUtf8ToString(v); if (r !== 'Hello world!') { throw r; } } };