shelving
Version:
Toolkit for using data in JavaScript.
18 lines (17 loc) • 660 B
JavaScript
import { Extractor } from "./Extractor.js";
/**
* Base class for an extractor that wraps another extractor.
* - Subclasses delegate to `source` and (optionally) transform the input before or the output after.
* - Composes the same way `Through*Provider` chains do — chain multiple `ThroughExtractor`s to build up behaviour.
*/
export class ThroughExtractor extends Extractor {
source;
constructor(source) {
super();
this.source = source;
}
/** Default implementation forwards to `source.extract()`. Subclasses override to do work before or after. */
extract(input) {
return this.source.extract(input);
}
}