Spaces:
Running
Running
Download node_modules/JSONSelect/src/build/lib/squeeze-more.js from k-l-lambda/lotus: direct link, hf CLI and curl.
- Browser
- Download file 742 Bytes
-
https://huggingface.co/spaces/k-l-lambda/lotus/resolve/main/node_modules/JSONSelect/src/build/lib/squeeze-more.js
- Command line
-
hf download hf://spaces/k-l-lambda/lotus/node_modules/JSONSelect/src/build/lib/squeeze-more.js
-
curl -L -o squeeze-more.js https://huggingface.co/spaces/k-l-lambda/lotus/resolve/main/node_modules/JSONSelect/src/build/lib/squeeze-more.js
742 Bytes
| 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; | |