Sha256: df23cac5c33773f4795b0ed9dbbe4948017533b81b00d5aa0821b3458117cce6

Contents?: true

Size: 742 Bytes

Versions: 21

Compression:

Stored size: 742 Bytes

Contents

var jsp = require("./parse-js"),
    pro = require("./process"),
    slice = jsp.slice,
    member = jsp.member,
    PRECEDENCE = jsp.PRECEDENCE,
    OPERATORS = jsp.OPERATORS;

function ast_squeeze_more(ast) {
        var w = pro.ast_walker(), walk = w.walk;
        return w.with_walkers({
                "call": function(expr, args) {
                        if (expr[0] == "dot" && expr[2] == "toString" && args.length == 0) {
                                // foo.toString()  ==>  foo+""
                                return [ "binary", "+", expr[1], [ "string", "" ]];
                        }
                }
        }, function() {
                return walk(ast);
        });
};

exports.ast_squeeze_more = ast_squeeze_more;

Version data entries

21 entries across 21 versions & 4 rubygems

Version Path
assets_booster-0.0.13 lib/assets_booster/compiler/node-js/squeeze-more.js
iron_worker_ng-0.10.1 iron_worker_examples/binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/node_modules/uglify-js/lib/squeeze-more.js
coffeescript-router-0.0.1 node_modules/uglify-js/lib/squeeze-more.js
uglifier-0.5.3 vendor/uglifyjs/lib/squeeze-more.js
uglifier-0.5.2 vendor/uglifyjs/lib/squeeze-more.js
assets_booster-0.0.12 lib/assets_booster/compiler/node-js/squeeze-more.js
assets_booster-0.0.11 lib/assets_booster/compiler/node-js/squeeze-more.js
assets_booster-0.0.10 lib/assets_booster/compiler/node-js/squeeze-more.js
assets_booster-0.0.9 lib/assets_booster/compiler/node-js/squeeze-more.js
assets_booster-0.0.8 lib/assets_booster/compiler/node-js/squeeze-more.js
assets_booster-0.0.7 lib/assets_booster/compiler/node-js/squeeze-more.js
uglifier-0.5.0 vendor/uglifyjs/lib/squeeze-more.js
assets_booster-0.0.6 lib/assets_booster/compiler/node-js/squeeze-more.js
assets_booster-0.0.5 lib/assets_booster/compiler/node-js/squeeze-more.js
assets_booster-0.0.4 lib/assets_booster/compiler/node-js/squeeze-more.js
assets_booster-0.0.3 lib/assets_booster/compiler/node-js/squeeze-more.js
assets_booster-0.0.2 lib/assets_booster/compiler/node-js/squeeze-more.js
assets_booster-0.0.1 lib/assets_booster/compiler/node-js/squeeze-more.js
uglifier-0.4.0 vendor/uglifyjs/lib/squeeze-more.js
uglifier-0.3.0 vendor/uglifyjs/lib/squeeze-more.js