mirror of
https://github.com/mdgriffith/elm-optimize-level-2.git
synced 2024-11-29 12:46:32 +03:00
use regex instead of replaceAll
This commit is contained in:
parent
88000c3e75
commit
4d9c38ea9f
@ -135,7 +135,8 @@ function isUpdateExpression(node: ts.Node): ts.CallExpression | null {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function generateCodeForReusableUpdate(objName: string, shape: string, objectProperties: Array<ts.ObjectLiteralElementLike>): ts.Node {
|
function generateCodeForReusableUpdate(objName: string, shape: string, objectProperties: Array<ts.ObjectLiteralElementLike>): ts.Node {
|
||||||
const updateFnName = `$$update__${shape.replaceAll(',', '__')}`;
|
|
||||||
|
const updateFnName = `$$update__${shape.replace(/,/g, '__')}`;
|
||||||
|
|
||||||
const initialArgs: Array<ts.Expression> = [ ts.createIdentifier(objName) ];
|
const initialArgs: Array<ts.Expression> = [ ts.createIdentifier(objName) ];
|
||||||
const newValues = objectProperties.map((it) => (it as ts.PropertyAssignment).initializer);
|
const newValues = objectProperties.map((it) => (it as ts.PropertyAssignment).initializer);
|
||||||
@ -279,7 +280,8 @@ function createReusableUpdateStatements(updateSet: Map<string, number>): ts.Node
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createReusableUpdateStatement(shape: string): string {
|
function createReusableUpdateStatement(shape: string): string {
|
||||||
const updateFnName = `$$update__${shape.replaceAll(',', '__')}`;
|
|
||||||
|
const updateFnName = `$$update__${shape.replace(/,/g, '__')}`;
|
||||||
|
|
||||||
const props = shape.split(',');
|
const props = shape.split(',');
|
||||||
const propSetters = props.
|
const propSetters = props.
|
||||||
|
Loading…
Reference in New Issue
Block a user