Home Manual Reference Source Test
import ModernPartialTransformer from 'atscm/src/lib/transform/PartialTransformer.js'
public class | source

ModernPartialTransformer

Extends:

Transformer → ModernPartialTransformer

A transformer that transforms only some of the files read.

Example:

Minimum implementation
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

true if file should be transformed.

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
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

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

Returns the Transformer with the given direction.

Public Methods

public abstract shouldBeTransformed(file: AtviseFile): boolean source

true if file should be transformed.

Params:

NameTypeAttributeDescription
file AtviseFile

The file to transform or not.

Return:

boolean