enter: function()

in zh/builder/mangleString.js [62:107]


            enter: function (node, parent) {
                if (node.type === SYNTAX.Literal
                    && typeof node.value === 'string'
                ) {
                    // Ignore if string is the key of property
                    if (parent.type === SYNTAX.Property) {
                        return;
                    }
                    var value = node.value;
                    if (value.length > STR_MIN_LENGTH) {
                        if (!stringVariables[value]) {
                            stringVariables[value] = {
                                count: 0,
                                lastLoc: node.loc.start.line,
                                name: '__echartsString__' + base54(stringRelaceCount++)
                            };
                        }
                        var diff = node.loc.start.line - stringVariables[value].lastLoc;
                        // GZIP ?
                        if (diff >= STR_MIN_DIST) {
                            stringVariables[value].lastLoc = node.loc.start.line;
                            stringVariables[value].count++;
                        }
                    }
                }

                if (node.type === SYNTAX.MemberExpression && !node.computed) {
                    if (node.property.type === SYNTAX.Identifier) {
                        var value = node.property.name;
                        if (value.length > STR_MIN_LENGTH) {
                            if (!stringVariables[value]) {
                                stringVariables[value] = {
                                    count: 0,
                                    lastLoc: node.loc.start.line,
                                    name: '__echartsString__' + base54(stringRelaceCount++)
                                };
                            }
                            var diff = node.loc.start.line - stringVariables[value].lastLoc;
                            if (diff >= STR_MIN_DIST) {
                                stringVariables[value].lastLoc = node.loc.start.line;
                                stringVariables[value].count++;
                            }
                        }
                    }
                }
            }