21 lines
565 B
JavaScript
21 lines
565 B
JavaScript
export default class RewriteNode {
|
|
/**
|
|
* Creates a new RewriteNode.
|
|
* @param {string} id - Unique identifier for the node.
|
|
* @param {function} transform - Function that transforms the input.
|
|
*/
|
|
constructor(id, transform) {
|
|
this.id = id;
|
|
this.type = 'rewrite';
|
|
this.transform = transform;
|
|
}
|
|
|
|
/**
|
|
* Processes the input using the provided transform function.
|
|
* @param {*} input - The input value from the preceding node(s).
|
|
* @returns {*} The transformed output.
|
|
*/
|
|
process(input) {
|
|
return this.transform(input);
|
|
}
|
|
} |