A component extends Component and overrides run().
run() is standalone mode. The same class also works inside a pipeline, as the next example shows.
The program
examples/component/index.ts
import { Component } from'@astack-tech/core';
/**
* A component is a class with input and output ports.
* `run()` is its standalone mode: call it like a function.
*/classUppercaseextendsComponent {
constructor() {
super({});
}
overriderun(text: unknown): string {
returnString(text).toUpperCase();
}
}
const uppercase = newUppercase();
console.log(uppercase.run('hello, astack'));
// HELLO, ASTACK