import ModernPartialTransformer from 'atscm/src/lib/transform/PartialTransformer.js'
ModernPartialTransformer
Extends:
A transformer that transforms only some of the files read.
Example:
class MyTransformer extends PartialTransformer {
shouldBeTransformed(node) {
return true; // or false
}
transformFromFilesystem(state, context) {
if (!this.shouldBeTransformed(state.node)) { return; }
// Apply actual transformation
}
}
Method Summary
Public Methods | ||
public abstract |
shouldBeTransformed(file: AtviseFile): boolean
|
Inherited Summary
From class Transformer | ||
public static |
combinedTransformer(transformers: Transformer[], direction: TransformDirection): function(node: Node): Promise<any> Returns a function that combines multiple transformer actions. |
|
public |
direction: * |
|
public |
compatTransform(direction: TransformDirection, node: Node, context: Object): * A transform wrapper that works with both async/await (atscm >= 1) and callback-based (atscm < 1)transformers. |
|
public |
readNodeFile(node: FileNode): boolean Determines if a node's value node should be read, e.G. The Variable.Bool file for a node defined in .Variable.Bool.Json. |
|
public |
async transformFromDB(node: BrowsedNode, context: Object) Must be overridden by all subclasses: Transforms the given node when using TransformDirection.FromDB. |
|
public |
async transformFromFilesystem(node: BrowsedNode, context: Object) Must be overridden by all subclasses: Transforms the given node when using TransformDirection.FromFilesystem. |
|
public |
withDirection(direction: TransformDirection): Transformer Returns the Transformer with the given direction. |
Public Methods
public abstract shouldBeTransformed(file: AtviseFile): boolean source
true
if file
should be transformed.
Params:
Name | Type | Attribute | Description |
file | AtviseFile | The file to transform or not. |