Current section
Files
Jump to
Current section
Files
src/pedantic_ffi.mjs
export function identity(x) {
return x;
}
export function object_from_list(list) {
const obj = {};
while (list && list.head !== undefined) {
const pair = list.head;
obj[pair[0]] = pair[1];
list = list.tail;
}
return obj;
}
export function list_to_array(list) {
const arr = [];
while (list && list.head !== undefined) {
arr.push(list.head);
list = list.tail;
}
return arr;
}
export function encode_dynamic_to_json_string(term) {
return JSON.stringify(term);
}
export function is_js_array(x) {
return Array.isArray(x);
}
export function is_js_plain_object(x) {
return x !== null && typeof x === "object" && Object.getPrototypeOf(x) === Object.prototype;
}
export function is_null_or_undefined(x) {
return x === null || x === undefined;
}