refactor: simplify arrow functions (#12057)
This commit is contained in:

committed by
Chuck Jazdzewski

parent
6f7ed32154
commit
0528dcb9dc
@ -400,7 +400,7 @@ export abstract class AbstractEmitterVisitor implements o.StatementVisitor, o.Ex
|
||||
}
|
||||
|
||||
visitAllStatements(statements: o.Statement[], ctx: EmitterVisitorContext): void {
|
||||
statements.forEach((stmt) => { return stmt.visitStatement(this, ctx); });
|
||||
statements.forEach((stmt) => stmt.visitStatement(this, ctx));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ var CAMEL_CASE_REGEXP = /([A-Z])/g;
|
||||
|
||||
export function camelCaseToDashCase(input: string): string {
|
||||
return StringWrapper.replaceAllMapped(
|
||||
input, CAMEL_CASE_REGEXP, (m: string[]) => { return '-' + m[1].toLowerCase(); });
|
||||
input, CAMEL_CASE_REGEXP, (m: string[]) => '-' + m[1].toLowerCase());
|
||||
}
|
||||
|
||||
export function splitAtColon(input: string, defaultValues: string[]): string[] {
|
||||
|
@ -101,9 +101,8 @@ function createQueryValues(viewValues: ViewQueryValues): o.Expression[] {
|
||||
function mapNestedViews(
|
||||
declarationAppElement: o.Expression, view: CompileView,
|
||||
expressions: o.Expression[]): o.Expression {
|
||||
var adjustedExpressions: o.Expression[] = expressions.map((expr) => {
|
||||
return o.replaceVarInExpression(o.THIS_EXPR.name, o.variable('nestedView'), expr);
|
||||
});
|
||||
var adjustedExpressions: o.Expression[] = expressions.map(
|
||||
(expr) => o.replaceVarInExpression(o.THIS_EXPR.name, o.variable('nestedView'), expr));
|
||||
return declarationAppElement.callMethod('mapNestedViews', [
|
||||
o.variable(view.className),
|
||||
o.fn(
|
||||
|
@ -24,8 +24,9 @@ export function main() {
|
||||
return flatStyles;
|
||||
};
|
||||
|
||||
var collectKeyframeStyles = (keyframe: AnimationKeyframeAst):
|
||||
{[key: string]: string | number} => { return combineStyles(keyframe.styles); };
|
||||
var collectKeyframeStyles =
|
||||
(keyframe: AnimationKeyframeAst): {[key: string]: string | number} =>
|
||||
combineStyles(keyframe.styles);
|
||||
|
||||
var collectStepStyles = (step: AnimationStepAst): Array<{[key: string]: string | number}> => {
|
||||
var keyframes = step.keyframes;
|
||||
@ -51,9 +52,8 @@ export function main() {
|
||||
var getAnimationAstFromEntryAst =
|
||||
(ast: AnimationEntryAst) => { return ast.stateTransitions[0].animation; };
|
||||
|
||||
var parseAnimationAst = (data: AnimationMetadata[]) => {
|
||||
return getAnimationAstFromEntryAst(parseAnimation(data).ast);
|
||||
};
|
||||
var parseAnimationAst = (data: AnimationMetadata[]) =>
|
||||
getAnimationAstFromEntryAst(parseAnimation(data).ast);
|
||||
|
||||
var parseAnimationAndGetErrors = (data: AnimationMetadata[]) => parseAnimation(data).errors;
|
||||
|
||||
|
@ -60,7 +60,7 @@ function removeMetadata(metadata: StringMap, remove: any, references: Map<any, s
|
||||
const propValue = metadata[prop];
|
||||
if (propValue instanceof Array) {
|
||||
metadata[prop] = propValue.filter(
|
||||
(value: any) => { return !removeObjects.has(_propHashKey(prop, value, references)); });
|
||||
(value: any) => !removeObjects.has(_propHashKey(prop, value, references)));
|
||||
} else {
|
||||
if (removeObjects.has(_propHashKey(prop, propValue, references))) {
|
||||
metadata[prop] = undefined;
|
||||
|
Reference in New Issue
Block a user