Created
August 20, 2020 12:42
-
-
Save roytouw7/64c00c61dc26a0150793f32c24dad971 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Classify node, dispatch to appropriate wrapper function. | |
export const dispatch = (node: Touched<ts.Node>): [Transformed<ts.Node>, RxJSPart] => { | |
const classification = classify(node); | |
switch (classification) { | |
case RxJSPart.observable: { | |
const transformed = markAsTransformed(wrapObservableStatement(node as ts.CallExpression)); | |
return [transformed, classification]; | |
} | |
case RxJSPart.subscriber: { | |
const transformed = markAsTransformed(wrapSubscribeExpression(node as ts.CallExpression)); | |
return [transformed, classification]; | |
} | |
case RxJSPart.pipeOperator: { | |
const transformed = markAsTransformed(wrapPipeOperatorExpression(node as ts.CallExpression)); | |
return [transformed, classification]; | |
} | |
default: | |
return [node, classification]; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment