Last active
December 14, 2015 17:59
-
-
Save hughfdjackson/5126081 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "this is a really long string this is a really long string this is a really long string this is a really long string this is a really long string this is a really long string this is a really long string this is a really long string this is a really long string this is a really long string this is a really long string" | |
| var f = function(){ | |
| var str = "this is a really long stringthis is a really long stringthis is a really long stringthis is a really long stringthis is a really long stringthis is a really long stringthis is a really long stringthis is a really long stringthis is a really long string" | |
| var short = "str" | |
| console.log('i love js muchly') | |
| } | |
| var o = { | |
| fn: function(){ | |
| "this is a really long stringthis is a really long stringthis is a really long stringthis is a really long stringthis is a really long stringthis is a really long stringthis is a really long stringthis is a really long stringthis is a really long string" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "this is a really long string this is a r" | |
| + "eally long string this is a really long " | |
| + "string this is a really long string this" | |
| + " is a really long string this is a reall" | |
| + "y long string this is a really long stri" | |
| + "ng this is a really long string this is " | |
| + "a really long string this is a really lo" | |
| + "ng string this is a really long string" | |
| var f = function(){ | |
| var str = "this is a really long stringthis is a re" | |
| + "ally long stringthis is a really long st" | |
| + "ringthis is a really long stringthis is " | |
| + "a really long stringthis is a really lon" | |
| + "g stringthis is a really long stringthis" | |
| + " is a really long stringthis is a really" | |
| + " long string" | |
| var short = "str" | |
| console.log("i love js muchly") | |
| } | |
| var o = { | |
| fn: function(){ | |
| "this is a really long stringthis is a re" | |
| + "ally long stringthis is a really long st" | |
| + "ringthis is a really long stringthis is " | |
| + "a really long stringthis is a really lon" | |
| + "g stringthis is a really long stringthis" | |
| + " is a really long stringthis is a really" | |
| + " long string" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env node | |
| var falafel = require('falafel') | |
| var fs = require('fs') | |
| var src = fs.readFileSync(process.argv[2]).toString() | |
| var chunk = function(str, size){ | |
| var a = [] | |
| for ( var i = 0; i < str.length; i += size ) a.push(str.substr(i, size)) | |
| return a | |
| } | |
| var out = falafel(src, function(node){ | |
| if ( node.type === 'Literal' && typeof node.value === 'string' ) { | |
| node.update('"' + chunk(node.value, 40).join('"\n + "') + '"') | |
| } | |
| }) | |
| console.log(out) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment