in v4/zh/builder/mangleString.js [111:143]
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 str = node.value;
if (stringVariables[str] && stringVariables[str].count > STR_MIN_COUNT) {
return {
type: SYNTAX.Identifier,
name: stringVariables[str].name
};
}
}
if (node.type === SYNTAX.MemberExpression && !node.computed) {
if (node.property.type === SYNTAX.Identifier) {
var str = node.property.name;
if (stringVariables[str] && stringVariables[str].count > STR_MIN_COUNT) {
return {
type: SYNTAX.MemberExpression,
object: node.object,
property: {
type: SYNTAX.Identifier,
name: stringVariables[str].name
},
computed: true
};
}
}
}
}