Skip to content

Instantly share code, notes, and snippets.

@hughfdjackson
Last active December 14, 2015 17:59
Show Gist options
  • Select an option

  • Save hughfdjackson/5126081 to your computer and use it in GitHub Desktop.

Select an option

Save hughfdjackson/5126081 to your computer and use it in GitHub Desktop.
"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 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"
}
}
#!/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