1
0
Files
sashinexists/node_modules/@weborigami/origami/src/dev/log.js
2024-12-07 13:18:31 +11:00

17 lines
513 B
JavaScript

import yaml from "../origami/yaml.js";
/**
* Log the first argument to the console as a side effect and return the second
* argument. If no second argument is provided, return the first argument.
*
* @this {import("@weborigami/types").AsyncTree|null}
* @param {any} object
* @param {any} [result]
*/
export default async function log(result, object = result) {
let text = object !== undefined ? await yaml.call(this, object) : "undefined";
text = text?.trim();
console.log(text);
return result;
}