id stringlengths 34 124 | type stringclasses 4
values | prompt stringlengths 0 4.95k | response stringlengths 21 4.89k | source_lang stringclasses 3
values | target_lang stringclasses 2
values | repo stringclasses 75
values | path stringlengths 10 88 | license stringclasses 1
value | commit stringlengths 40 40 | stars int64 431 18.7k | source_url stringlengths 86 176 | line_start int64 1 214 | line_end int64 3 253 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
flosse/sloc:src/cli.coffee:3:raw_corpus | raw_corpus | parseDir = (dir, cb) ->
files = []
res = []
exclude = null
if programm.exclude
exclude = new RegExp programm.exclude
# get a list of all files (env in sub directories)
inspect = (dir, done) ->
# exit if directory is excluded
return done() if exclude?.test dir
fs.readdir dir, (err, items) -... | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | c03903043c4352258b39181a3d75eeb514987da7 | 969 | https://github.com/flosse/sloc/blob/c03903043c4352258b39181a3d75eeb514987da7/src/cli.coffee | 30 | 79 | ||
flosse/sloc:src/cli.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
parseDir = (dir, cb) ->
files = []
res = []
exclude = null
if programm.exclude
exclude = new RegExp programm.exclude
# get a list of all files (env in sub directories)
inspect = (dir, done) ->
# exit if directory is excluded
return done(... | var parseDir;
parseDir = function(dir, cb) {
var exclude, files, inspect, res;
files = [];
res = [];
exclude = null;
if (programm.exclude) {
exclude = new RegExp(programm.exclude);
}
// get a list of all files (env in sub directories)
inspect = function(dir, done) {
if (exclude != null ? exclud... | CoffeeScript | JavaScript | flosse/sloc | src/cli.coffee | MIT | c03903043c4352258b39181a3d75eeb514987da7 | 969 | https://github.com/flosse/sloc/blob/c03903043c4352258b39181a3d75eeb514987da7/src/cli.coffee | 30 | 79 |
flosse/sloc:src/cli.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var parseDir;
parseDir = function(dir, cb) {
var exclude, files, inspect, res;
files = [];
res = [];
exclude = null;
if (programm.exclude) {
exclude = new RegExp(programm.exclude);
}
// get a list of all files (env in sub directories)
inspect =... | parseDir = (dir, cb) ->
files = []
res = []
exclude = null
if programm.exclude
exclude = new RegExp programm.exclude
# get a list of all files (env in sub directories)
inspect = (dir, done) ->
# exit if directory is excluded
return done() if exclude?.test dir
fs.readdir dir, (err, items) -... | JavaScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | c03903043c4352258b39181a3d75eeb514987da7 | 969 | https://github.com/flosse/sloc/blob/c03903043c4352258b39181a3d75eeb514987da7/src/cli.coffee | 30 | 79 |
flosse/sloc:src/cli.coffee:3:completion | completion | parseDir = (dir, cb) ->
files = []
res = []
exclude = null
if programm.exclude
exclude = new RegExp programm.exclude
# get a list of all files (env in sub directories)
inspect = (dir, done) ->
# exit if directory is excluded
return done() if exclude?.test dir
fs.readdir dir, (err, items) -... | return inspect path, next if stat.isDirectory()
files.push path
next()
, done
inspect dir, ->
async.forEach files, (f, next) ->
parseFile f, (err, r) ->
if err?
r =
err: err
path: f
else
r.path = f
res.push r
... | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | c03903043c4352258b39181a3d75eeb514987da7 | 969 | https://github.com/flosse/sloc/blob/c03903043c4352258b39181a3d75eeb514987da7/src/cli.coffee | 30 | 79 |
flosse/sloc:src/cli.coffee:6:raw_corpus | raw_corpus | print = (err, r, file=null) ->
if programm.json
return console.log JSON.stringify if err? then err: err else r
if programm.csv
return console.log if err? then err: err else csvify r
unless file?
console.log "\n---------- result ------------\n"
else
console.log "\n--- #{file}"
if err?
co... | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 7d0e243a1526caa2ce9635b43dcdca08a3f0add8 | 969 | https://github.com/flosse/sloc/blob/7d0e243a1526caa2ce9635b43dcdca08a3f0add8/src/cli.coffee | 122 | 171 | ||
flosse/sloc:src/cli.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
print = (err, r, file=null) ->
if programm.json
return console.log JSON.stringify if err? then err: err else r
if programm.csv
return console.log if err? then err: err else csvify r
unless file?
console.log "\n---------- result ------------\n"... | var print;
print = function(err, r, file = null) {
var details, i, len, ref;
if (programm.json) {
return console.log(JSON.stringify(err != null ? {
err: err
} : r));
}
if (programm.csv) {
return console.log(err != null ? {
err: err
} : csvify(r));
}
if (file == null) {
conso... | CoffeeScript | JavaScript | flosse/sloc | src/cli.coffee | MIT | 7d0e243a1526caa2ce9635b43dcdca08a3f0add8 | 969 | https://github.com/flosse/sloc/blob/7d0e243a1526caa2ce9635b43dcdca08a3f0add8/src/cli.coffee | 122 | 171 |
flosse/sloc:src/cli.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var print;
print = function(err, r, file = null) {
var details, i, len, ref;
if (programm.json) {
return console.log(JSON.stringify(err != null ? {
err: err
} : r));
}
if (programm.csv) {
return console.log(err != null ? {
err: err
... | print = (err, r, file=null) ->
if programm.json
return console.log JSON.stringify if err? then err: err else r
if programm.csv
return console.log if err? then err: err else csvify r
unless file?
console.log "\n---------- result ------------\n"
else
console.log "\n--- #{file}"
if err?
co... | JavaScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 7d0e243a1526caa2ce9635b43dcdca08a3f0add8 | 969 | https://github.com/flosse/sloc/blob/7d0e243a1526caa2ce9635b43dcdca08a3f0add8/src/cli.coffee | 122 | 171 |
flosse/sloc:src/cli.coffee:6:completion | completion | print = (err, r, file=null) ->
if programm.json
return console.log JSON.stringify if err? then err: err else r
if programm.csv
return console.log if err? then err: err else csvify r
unless file?
console.log "\n---------- result ------------\n"
else
console.log "\n--- #{file}"
if err?
co... | unless file?
if r.filesRead?
console.log "\n\nnumber of files read : #{r.filesRead}"
if r[BAD_FORMAT]
console.log "unknown source files : #{r[BAD_FORMAT]}"
if r[BAD_FILE]
console.log " broken files : #{r[BAD_FILE]}"
if r[BAD_DIR]
console.log " broken directories : #{... | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 7d0e243a1526caa2ce9635b43dcdca08a3f0add8 | 969 | https://github.com/flosse/sloc/blob/7d0e243a1526caa2ce9635b43dcdca08a3f0add8/src/cli.coffee | 122 | 171 |
flosse/sloc:src/cli.coffee:5:raw_corpus | raw_corpus | csvify = (data) ->
lines = "Path,Physical lines,Lines of source code,Total comment,Singleline,Multiline,Empty\n"
lineize = (t) ->
(if t.path then t.path else "Total") + "," + ([t.loc, t.sloc, t.cloc, t.scloc, t.mcloc, t.nloc].join ",") + "\n"
if data.details
for sf in data.details
lines += lineize... | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 23fefd37c601821665eeae3f5beb57f561823202 | 969 | https://github.com/flosse/sloc/blob/23fefd37c601821665eeae3f5beb57f561823202/src/cli.coffee | 99 | 111 | ||
flosse/sloc:src/cli.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
csvify = (data) ->
lines = "Path,Physical lines,Lines of source code,Total comment,Singleline,Multiline,Empty\n"
lineize = (t) ->
(if t.path then t.path else "Total") + "," + ([t.loc, t.sloc, t.cloc, t.scloc, t.mcloc, t.nloc].join ",") + "\n"
if data.... | var csvify;
csvify = function(data) {
var i, len, lineize, lines, ref, sf;
lines = "Path,Physical lines,Lines of source code,Total comment,Singleline,Multiline,Empty\n";
lineize = function(t) {
return (t.path ? t.path : "Total") + "," + ([t.loc, t.sloc, t.cloc, t.scloc, t.mcloc, t.nloc].join(",")) + "\n";
... | CoffeeScript | JavaScript | flosse/sloc | src/cli.coffee | MIT | 23fefd37c601821665eeae3f5beb57f561823202 | 969 | https://github.com/flosse/sloc/blob/23fefd37c601821665eeae3f5beb57f561823202/src/cli.coffee | 99 | 111 |
flosse/sloc:src/cli.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var csvify;
csvify = function(data) {
var i, len, lineize, lines, ref, sf;
lines = "Path,Physical lines,Lines of source code,Total comment,Singleline,Multiline,Empty\n";
lineize = function(t) {
return (t.path ? t.path : "Total") + "," + ([t.loc, t.sloc, ... | csvify = (data) ->
lines = "Path,Physical lines,Lines of source code,Total comment,Singleline,Multiline,Empty\n"
lineize = (t) ->
(if t.path then t.path else "Total") + "," + ([t.loc, t.sloc, t.cloc, t.scloc, t.mcloc, t.nloc].join ",") + "\n"
if data.details
for sf in data.details
lines += lineize... | JavaScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 23fefd37c601821665eeae3f5beb57f561823202 | 969 | https://github.com/flosse/sloc/blob/23fefd37c601821665eeae3f5beb57f561823202/src/cli.coffee | 99 | 111 |
flosse/sloc:src/cli.coffee:5:completion | completion | csvify = (data) ->
lines = "Path,Physical lines,Lines of source code,Total comment,Singleline,Multiline,Empty\n"
lineize = (t) ->
(if t.path then t.path else "Total") + "," + ([t.loc, t.sloc, t.cloc, t.scloc, t.mcloc, t.nloc].join ",") + "\n" | if data.details
for sf in data.details
lines += lineize sf
else
lines += lineize data
lines | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 23fefd37c601821665eeae3f5beb57f561823202 | 969 | https://github.com/flosse/sloc/blob/23fefd37c601821665eeae3f5beb57f561823202/src/cli.coffee | 99 | 111 |
flosse/sloc:src/cli.coffee:6:raw_corpus | raw_corpus | print = (err, r, file=null) ->
if programm.json
return console.log JSON.stringify if err? then err: err else r
if programm.csv
return console.log if err? then err: err else csvify r
unless file?
console.log "\n---------- result ------------\n"
else
console.log "\n--- #{file}"
if err?
co... | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 23fefd37c601821665eeae3f5beb57f561823202 | 969 | https://github.com/flosse/sloc/blob/23fefd37c601821665eeae3f5beb57f561823202/src/cli.coffee | 113 | 162 | ||
flosse/sloc:src/cli.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
print = (err, r, file=null) ->
if programm.json
return console.log JSON.stringify if err? then err: err else r
if programm.csv
return console.log if err? then err: err else csvify r
unless file?
console.log "\n---------- result ------------\n"... | var print;
print = function(err, r, file = null) {
var details, i, len, ref;
if (programm.json) {
return console.log(JSON.stringify(err != null ? {
err: err
} : r));
}
if (programm.csv) {
return console.log(err != null ? {
err: err
} : csvify(r));
}
if (file == null) {
conso... | CoffeeScript | JavaScript | flosse/sloc | src/cli.coffee | MIT | 23fefd37c601821665eeae3f5beb57f561823202 | 969 | https://github.com/flosse/sloc/blob/23fefd37c601821665eeae3f5beb57f561823202/src/cli.coffee | 113 | 162 |
flosse/sloc:src/cli.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var print;
print = function(err, r, file = null) {
var details, i, len, ref;
if (programm.json) {
return console.log(JSON.stringify(err != null ? {
err: err
} : r));
}
if (programm.csv) {
return console.log(err != null ? {
err: err
... | print = (err, r, file=null) ->
if programm.json
return console.log JSON.stringify if err? then err: err else r
if programm.csv
return console.log if err? then err: err else csvify r
unless file?
console.log "\n---------- result ------------\n"
else
console.log "\n--- #{file}"
if err?
co... | JavaScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 23fefd37c601821665eeae3f5beb57f561823202 | 969 | https://github.com/flosse/sloc/blob/23fefd37c601821665eeae3f5beb57f561823202/src/cli.coffee | 113 | 162 |
flosse/sloc:src/cli.coffee:6:completion | completion | print = (err, r, file=null) ->
if programm.json
return console.log JSON.stringify if err? then err: err else r
if programm.csv
return console.log if err? then err: err else csvify r
unless file?
console.log "\n---------- result ------------\n"
else
console.log "\n--- #{file}"
if err?
co... | console.log "\n\nnumber of files read : #{r.filesRead}"
if r[BAD_FORMAT]
console.log "unknown source files : #{r[BAD_FORMAT]}"
if r[BAD_FILE]
console.log " broken files : #{r[BAD_FILE]}"
if r[BAD_DIR]
console.log " broken directories : #{r[BAD_DIR]}"
if r.details?
c... | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 23fefd37c601821665eeae3f5beb57f561823202 | 969 | https://github.com/flosse/sloc/blob/23fefd37c601821665eeae3f5beb57f561823202/src/cli.coffee | 113 | 162 |
flosse/sloc:src/cli.coffee:7:raw_corpus | raw_corpus | if programm.args.length < 1
programm.help()
else
stats = fs.lstatSync programm.args[0]
if stats.isDirectory() then parseDir programm.args[0], print
else if stats.isFile() then parseFile programm.args[0], print | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 23fefd37c601821665eeae3f5beb57f561823202 | 969 | https://github.com/flosse/sloc/blob/23fefd37c601821665eeae3f5beb57f561823202/src/cli.coffee | 163 | 171 | ||
flosse/sloc:src/cli.coffee:7:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if programm.args.length < 1
programm.help()
else
stats = fs.lstatSync programm.args[0]
if stats.isDirectory() then parseDir programm.args[0], print
else if stats.isFile() then parseFile programm.args[0], print
``` | var stats;
if (programm.args.length < 1) {
programm.help();
} else {
stats = fs.lstatSync(programm.args[0]);
if (stats.isDirectory()) {
parseDir(programm.args[0], print);
} else if (stats.isFile()) {
parseFile(programm.args[0], print);
}
} | CoffeeScript | JavaScript | flosse/sloc | src/cli.coffee | MIT | 23fefd37c601821665eeae3f5beb57f561823202 | 969 | https://github.com/flosse/sloc/blob/23fefd37c601821665eeae3f5beb57f561823202/src/cli.coffee | 163 | 171 |
flosse/sloc:src/cli.coffee:7:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var stats;
if (programm.args.length < 1) {
programm.help();
} else {
stats = fs.lstatSync(programm.args[0]);
if (stats.isDirectory()) {
parseDir(programm.args[0], print);
} else if (stats.isFile()) {
parseFile(programm.args[0], print);
}
}
``` | if programm.args.length < 1
programm.help()
else
stats = fs.lstatSync programm.args[0]
if stats.isDirectory() then parseDir programm.args[0], print
else if stats.isFile() then parseFile programm.args[0], print | JavaScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 23fefd37c601821665eeae3f5beb57f561823202 | 969 | https://github.com/flosse/sloc/blob/23fefd37c601821665eeae3f5beb57f561823202/src/cli.coffee | 163 | 171 |
flosse/sloc:src/cli.coffee:7:completion | completion | if programm.args.length < 1
programm.help()
else | stats = fs.lstatSync programm.args[0]
if stats.isDirectory() then parseDir programm.args[0], print
else if stats.isFile() then parseFile programm.args[0], print | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 23fefd37c601821665eeae3f5beb57f561823202 | 969 | https://github.com/flosse/sloc/blob/23fefd37c601821665eeae3f5beb57f561823202/src/cli.coffee | 163 | 171 |
flosse/sloc:src/cli.coffee:6:raw_corpus | raw_corpus | print = (err, r, file=null) ->
if programm.json
return console.log JSON.stringify if err? then err: err else r
if programm.csv
return console.log if err? then err: err else csvify r
unless file?
console.log "\n---------- result ------------\n"
else
console.log "\n--- #{file}"
if err?
co... | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | ff6aed6b88fba147954309f1b71de29fac99f6ca | 969 | https://github.com/flosse/sloc/blob/ff6aed6b88fba147954309f1b71de29fac99f6ca/src/cli.coffee | 113 | 162 | ||
flosse/sloc:src/cli.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
print = (err, r, file=null) ->
if programm.json
return console.log JSON.stringify if err? then err: err else r
if programm.csv
return console.log if err? then err: err else csvify r
unless file?
console.log "\n---------- result ------------\n"... | var print;
print = function(err, r, file = null) {
var details, i, len, ref;
if (programm.json) {
return console.log(JSON.stringify(err != null ? {
err: err
} : r));
}
if (programm.csv) {
return console.log(err != null ? {
err: err
} : csvify(r));
}
if (file == null) {
conso... | CoffeeScript | JavaScript | flosse/sloc | src/cli.coffee | MIT | ff6aed6b88fba147954309f1b71de29fac99f6ca | 969 | https://github.com/flosse/sloc/blob/ff6aed6b88fba147954309f1b71de29fac99f6ca/src/cli.coffee | 113 | 162 |
flosse/sloc:src/cli.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var print;
print = function(err, r, file = null) {
var details, i, len, ref;
if (programm.json) {
return console.log(JSON.stringify(err != null ? {
err: err
} : r));
}
if (programm.csv) {
return console.log(err != null ? {
err: err
... | print = (err, r, file=null) ->
if programm.json
return console.log JSON.stringify if err? then err: err else r
if programm.csv
return console.log if err? then err: err else csvify r
unless file?
console.log "\n---------- result ------------\n"
else
console.log "\n--- #{file}"
if err?
co... | JavaScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | ff6aed6b88fba147954309f1b71de29fac99f6ca | 969 | https://github.com/flosse/sloc/blob/ff6aed6b88fba147954309f1b71de29fac99f6ca/src/cli.coffee | 113 | 162 |
flosse/sloc:src/cli.coffee:6:completion | completion | print = (err, r, file=null) ->
if programm.json
return console.log JSON.stringify if err? then err: err else r
if programm.csv
return console.log if err? then err: err else csvify r
unless file?
console.log "\n---------- result ------------\n"
else
console.log "\n--- #{file}"
if err?
co... | console.log "\n\nnumber of files read : #{r.filesRead}"
if r[BAD_FORMAT]
console.log "unknown source files : #{r[BAD_FORMAT]}"
if r[BAD_FILE]
console.log " broken files : #{r[BAD_FILE]}"
if r[BAD_DIR]
console.log " broken directories : #{r[BAD_DIR]}"
if r.details?
c... | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | ff6aed6b88fba147954309f1b71de29fac99f6ca | 969 | https://github.com/flosse/sloc/blob/ff6aed6b88fba147954309f1b71de29fac99f6ca/src/cli.coffee | 113 | 162 |
flosse/sloc:src/cli.coffee:4:raw_corpus | raw_corpus | scloc: 0
mcloc: 0
nloc: 0
init[BAD_FILE] = 0
init[BAD_FORMAT] = 0
init[BAD_DIR] = 0
res.splice 0, 0, init
sums = res.reduce (a,b) ->
o = {}
o[k] = a[k] + (b[k] or 0) for k,v of a
o[b.err]++ if b.err?
o
sums.files... | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | e54b278ab39c4fc9c64188f34867d7a6a5bab612 | 969 | https://github.com/flosse/sloc/blob/e54b278ab39c4fc9c64188f34867d7a6a5bab612/src/cli.coffee | 79 | 96 | ||
flosse/sloc:src/cli.coffee:4:completion | completion | scloc: 0
mcloc: 0
nloc: 0
init[BAD_FILE] = 0
init[BAD_FORMAT] = 0
init[BAD_DIR] = 0
res.splice 0, 0, init
sums = res.reduce (a,b) ->
o = {} | o[k] = a[k] + (b[k] or 0) for k,v of a
o[b.err]++ if b.err?
o
sums.filesRead = res.length-1
if programm.verbose
# remove counter initialization
res.splice 0, 1
sums.details = res
cb null, sums | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | e54b278ab39c4fc9c64188f34867d7a6a5bab612 | 969 | https://github.com/flosse/sloc/blob/e54b278ab39c4fc9c64188f34867d7a6a5bab612/src/cli.coffee | 79 | 96 |
flosse/sloc:src/cli.coffee:5:raw_corpus | raw_corpus | print = (err, r, file=null) ->
if programm.json
return console.log JSON.stringify if err? then err: err else r
unless file?
console.log "\n---------- result ------------\n"
else
console.log "\n--- #{file}"
if err?
console.log " error : #{err}"
else if programm.sloc
console... | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | e54b278ab39c4fc9c64188f34867d7a6a5bab612 | 969 | https://github.com/flosse/sloc/blob/e54b278ab39c4fc9c64188f34867d7a6a5bab612/src/cli.coffee | 98 | 147 | ||
flosse/sloc:src/cli.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
print = (err, r, file=null) ->
if programm.json
return console.log JSON.stringify if err? then err: err else r
unless file?
console.log "\n---------- result ------------\n"
else
console.log "\n--- #{file}"
if err?
console.log " ... | var print;
print = function(err, r, file = null) {
var details, i, len, ref;
if (programm.json) {
return console.log(JSON.stringify(err != null ? {
err: err
} : r));
}
if (file == null) {
console.log("\n---------- result ------------\n");
} else {
console.log(`\n--- ${file}`);
}
if ... | CoffeeScript | JavaScript | flosse/sloc | src/cli.coffee | MIT | e54b278ab39c4fc9c64188f34867d7a6a5bab612 | 969 | https://github.com/flosse/sloc/blob/e54b278ab39c4fc9c64188f34867d7a6a5bab612/src/cli.coffee | 98 | 147 |
flosse/sloc:src/cli.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var print;
print = function(err, r, file = null) {
var details, i, len, ref;
if (programm.json) {
return console.log(JSON.stringify(err != null ? {
err: err
} : r));
}
if (file == null) {
console.log("\n---------- result ------------\n");... | print = (err, r, file=null) ->
if programm.json
return console.log JSON.stringify if err? then err: err else r
unless file?
console.log "\n---------- result ------------\n"
else
console.log "\n--- #{file}"
if err?
console.log " error : #{err}"
else if programm.sloc
console... | JavaScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | e54b278ab39c4fc9c64188f34867d7a6a5bab612 | 969 | https://github.com/flosse/sloc/blob/e54b278ab39c4fc9c64188f34867d7a6a5bab612/src/cli.coffee | 98 | 147 |
flosse/sloc:src/cli.coffee:5:completion | completion | print = (err, r, file=null) ->
if programm.json
return console.log JSON.stringify if err? then err: err else r
unless file?
console.log "\n---------- result ------------\n"
else
console.log "\n--- #{file}"
if err?
console.log " error : #{err}"
else if programm.sloc
console... | if r[BAD_FORMAT]
console.log "unknown source files : #{r[BAD_FORMAT]}"
if r[BAD_FILE]
console.log " broken files : #{r[BAD_FILE]}"
if r[BAD_DIR]
console.log " broken directories : #{r[BAD_DIR]}"
if r.details?
console.log '\n---------- details -----------'
print deta... | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | e54b278ab39c4fc9c64188f34867d7a6a5bab612 | 969 | https://github.com/flosse/sloc/blob/e54b278ab39c4fc9c64188f34867d7a6a5bab612/src/cli.coffee | 98 | 147 |
flosse/sloc:src/cli.coffee:6:raw_corpus | raw_corpus | else
stats = fs.lstatSync programm.args[0]
if stats.isDirectory() then parseDir programm.args[0], print
else if stats.isFile() then parseFile programm.args[0], print | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | e54b278ab39c4fc9c64188f34867d7a6a5bab612 | 969 | https://github.com/flosse/sloc/blob/e54b278ab39c4fc9c64188f34867d7a6a5bab612/src/cli.coffee | 148 | 152 | ||
flosse/sloc:src/cli.coffee:6:completion | completion | else
stats = fs.lstatSync programm.args[0] | if stats.isDirectory() then parseDir programm.args[0], print
else if stats.isFile() then parseFile programm.args[0], print | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | e54b278ab39c4fc9c64188f34867d7a6a5bab612 | 969 | https://github.com/flosse/sloc/blob/e54b278ab39c4fc9c64188f34867d7a6a5bab612/src/cli.coffee | 148 | 152 |
flosse/sloc:src/cli.coffee:2:raw_corpus | raw_corpus | parseFile = (f, cb) ->
fs.readFile f, "utf8", (err, code) ->
if err?
cb? BAD_FILE_ERR
else
try
cb? null, sloc code, getExtension f
catch e
cb? BAD_FORMAT_ERR | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 79f539ba792aa9f522aa74b873130185741627a0 | 969 | https://github.com/flosse/sloc/blob/79f539ba792aa9f522aa74b873130185741627a0/src/cli.coffee | 18 | 26 | ||
flosse/sloc:src/cli.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
parseFile = (f, cb) ->
fs.readFile f, "utf8", (err, code) ->
if err?
cb? BAD_FILE_ERR
else
try
cb? null, sloc code, getExtension f
catch e
cb? BAD_FORMAT_ERR
``` | var parseFile;
parseFile = function(f, cb) {
return fs.readFile(f, "utf8", function(err, code) {
var e;
if (err != null) {
return typeof cb === "function" ? cb(BAD_FILE_ERR) : void 0;
} else {
try {
return typeof cb === "function" ? cb(null, sloc(code, getExtension(f))) : void 0;
... | CoffeeScript | JavaScript | flosse/sloc | src/cli.coffee | MIT | 79f539ba792aa9f522aa74b873130185741627a0 | 969 | https://github.com/flosse/sloc/blob/79f539ba792aa9f522aa74b873130185741627a0/src/cli.coffee | 18 | 26 |
flosse/sloc:src/cli.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var parseFile;
parseFile = function(f, cb) {
return fs.readFile(f, "utf8", function(err, code) {
var e;
if (err != null) {
return typeof cb === "function" ? cb(BAD_FILE_ERR) : void 0;
} else {
try {
return typeof cb === "function"... | parseFile = (f, cb) ->
fs.readFile f, "utf8", (err, code) ->
if err?
cb? BAD_FILE_ERR
else
try
cb? null, sloc code, getExtension f
catch e
cb? BAD_FORMAT_ERR | JavaScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 79f539ba792aa9f522aa74b873130185741627a0 | 969 | https://github.com/flosse/sloc/blob/79f539ba792aa9f522aa74b873130185741627a0/src/cli.coffee | 18 | 26 |
flosse/sloc:src/cli.coffee:3:raw_corpus | raw_corpus | parseDir = (dir, cb) ->
badFileCounter = 0
badFormatCounter = 0
files = ("#{dir}/#{f}" for f in fs.readdirSync dir)
parseFunctions = []
for f in files then do (f) ->
parseFunctions.push (next) ->
parseFile f, (err, res) ->
if err?
switch err
when BAD_FORMAT_ERR th... | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 79f539ba792aa9f522aa74b873130185741627a0 | 969 | https://github.com/flosse/sloc/blob/79f539ba792aa9f522aa74b873130185741627a0/src/cli.coffee | 28 | 59 | ||
flosse/sloc:src/cli.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
parseDir = (dir, cb) ->
badFileCounter = 0
badFormatCounter = 0
files = ("#{dir}/#{f}" for f in fs.readdirSync dir)
parseFunctions = []
for f in files then do (f) ->
parseFunctions.push (next) ->
parseFile f, (err, res) ->
if err... | var parseDir;
parseDir = function(dir, cb) {
var badFileCounter, badFormatCounter, f, files, i, len, parseFunctions;
badFileCounter = 0;
badFormatCounter = 0;
files = (function() {
var i, len, ref, results;
ref = fs.readdirSync(dir);
results = [];
for (i = 0, len = ref.length; i < len; i++) {
... | CoffeeScript | JavaScript | flosse/sloc | src/cli.coffee | MIT | 79f539ba792aa9f522aa74b873130185741627a0 | 969 | https://github.com/flosse/sloc/blob/79f539ba792aa9f522aa74b873130185741627a0/src/cli.coffee | 28 | 59 |
flosse/sloc:src/cli.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var parseDir;
parseDir = function(dir, cb) {
var badFileCounter, badFormatCounter, f, files, i, len, parseFunctions;
badFileCounter = 0;
badFormatCounter = 0;
files = (function() {
var i, len, ref, results;
ref = fs.readdirSync(dir);
results = ... | parseDir = (dir, cb) ->
badFileCounter = 0
badFormatCounter = 0
files = ("#{dir}/#{f}" for f in fs.readdirSync dir)
parseFunctions = []
for f in files then do (f) ->
parseFunctions.push (next) ->
parseFile f, (err, res) ->
if err?
switch err
when BAD_FORMAT_ERR th... | JavaScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 79f539ba792aa9f522aa74b873130185741627a0 | 969 | https://github.com/flosse/sloc/blob/79f539ba792aa9f522aa74b873130185741627a0/src/cli.coffee | 28 | 59 |
flosse/sloc:src/cli.coffee:3:completion | completion | parseDir = (dir, cb) ->
badFileCounter = 0
badFormatCounter = 0
files = ("#{dir}/#{f}" for f in fs.readdirSync dir)
parseFunctions = []
for f in files then do (f) ->
parseFunctions.push (next) ->
parseFile f, (err, res) ->
if err?
switch err
when BAD_FORMAT_ERR th... | next null, res
async.parallel parseFunctions, (err, res) ->
if err?
cb err
else
res = (r for r in res when r?)
numberOfFiles = res.length
res = res.reduce (a,b) ->
o = {}
o[k] = a[k] + b[k] for k,v of a
o
res.badFiles = badFileCounter
res.badForma... | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 79f539ba792aa9f522aa74b873130185741627a0 | 969 | https://github.com/flosse/sloc/blob/79f539ba792aa9f522aa74b873130185741627a0/src/cli.coffee | 28 | 59 |
flosse/sloc:src/cli.coffee:4:raw_corpus | raw_corpus | print = (err, r) ->
if err?
console.error err
else if programm.json
console.log JSON.stringify r
else if programm.sloc
console.log r.sloc
else
console.log """
---------- result ------------
physical lines : #{r.loc}
lines of source code : #{r.sloc}
total co... | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 79f539ba792aa9f522aa74b873130185741627a0 | 969 | https://github.com/flosse/sloc/blob/79f539ba792aa9f522aa74b873130185741627a0/src/cli.coffee | 61 | 106 | ||
flosse/sloc:src/cli.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
print = (err, r) ->
if err?
console.error err
else if programm.json
console.log JSON.stringify r
else if programm.sloc
console.log r.sloc
else
console.log """
---------- result ------------
physical lines : #{r.loc}
... | var print, stats;
print = function(err, r) {
if (err != null) {
return console.error(err);
} else if (programm.json) {
return console.log(JSON.stringify(r));
} else if (programm.sloc) {
return console.log(r.sloc);
} else {
console.log(`---------- result ------------
physical lines : ${r.... | CoffeeScript | JavaScript | flosse/sloc | src/cli.coffee | MIT | 79f539ba792aa9f522aa74b873130185741627a0 | 969 | https://github.com/flosse/sloc/blob/79f539ba792aa9f522aa74b873130185741627a0/src/cli.coffee | 61 | 106 |
flosse/sloc:src/cli.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var print, stats;
print = function(err, r) {
if (err != null) {
return console.error(err);
} else if (programm.json) {
return console.log(JSON.stringify(r));
} else if (programm.sloc) {
return console.log(r.sloc);
} else {
console.log(`----... | print = (err, r) ->
if err?
console.error err
else if programm.json
console.log JSON.stringify r
else if programm.sloc
console.log r.sloc
else
console.log """
---------- result ------------
physical lines : #{r.loc}
lines of source code : #{r.sloc}
total co... | JavaScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 79f539ba792aa9f522aa74b873130185741627a0 | 969 | https://github.com/flosse/sloc/blob/79f539ba792aa9f522aa74b873130185741627a0/src/cli.coffee | 61 | 106 |
flosse/sloc:src/cli.coffee:4:completion | completion | print = (err, r) ->
if err?
console.error err
else if programm.json
console.log JSON.stringify r
else if programm.sloc
console.log r.sloc
else
console.log """
---------- result ------------
physical lines : #{r.loc}
lines of source code : #{r.sloc}
total co... | if r.badFiles? or r.badFormats?
console.log """
unknown source files : #{r.badFormats}
broken files : #{r.badFiles}
------------------------------
"""
programm
.version('0.0.2')
.usage('[option] <file>|<directory>')
.option('-j, --json', 'return JSON object')
.op... | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 79f539ba792aa9f522aa74b873130185741627a0 | 969 | https://github.com/flosse/sloc/blob/79f539ba792aa9f522aa74b873130185741627a0/src/cli.coffee | 61 | 106 |
flosse/sloc:src/cli.coffee:3:raw_corpus | raw_corpus | parseDir = (dir, cb) ->
badFileCounter = 0
badFormatCounter = 0
files = ("#{dir}/#{f}" for f in fs.readdirSync dir)
parseFunctions = []
for f in files then do (f) ->
parseFunctions.push (next) ->
parseFile f, (err, res) ->
if err?
switch err
when BAD_FORMAT_ERR th... | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | ef6d0ed257060bc37bd3c1569bd6940b95dadfe4 | 969 | https://github.com/flosse/sloc/blob/ef6d0ed257060bc37bd3c1569bd6940b95dadfe4/src/cli.coffee | 28 | 57 | ||
flosse/sloc:src/cli.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
parseDir = (dir, cb) ->
badFileCounter = 0
badFormatCounter = 0
files = ("#{dir}/#{f}" for f in fs.readdirSync dir)
parseFunctions = []
for f in files then do (f) ->
parseFunctions.push (next) ->
parseFile f, (err, res) ->
if err... | var parseDir;
parseDir = function(dir, cb) {
var badFileCounter, badFormatCounter, f, files, i, len, parseFunctions;
badFileCounter = 0;
badFormatCounter = 0;
files = (function() {
var i, len, ref, results;
ref = fs.readdirSync(dir);
results = [];
for (i = 0, len = ref.length; i < len; i++) {
... | CoffeeScript | JavaScript | flosse/sloc | src/cli.coffee | MIT | ef6d0ed257060bc37bd3c1569bd6940b95dadfe4 | 969 | https://github.com/flosse/sloc/blob/ef6d0ed257060bc37bd3c1569bd6940b95dadfe4/src/cli.coffee | 28 | 57 |
flosse/sloc:src/cli.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var parseDir;
parseDir = function(dir, cb) {
var badFileCounter, badFormatCounter, f, files, i, len, parseFunctions;
badFileCounter = 0;
badFormatCounter = 0;
files = (function() {
var i, len, ref, results;
ref = fs.readdirSync(dir);
results = ... | parseDir = (dir, cb) ->
badFileCounter = 0
badFormatCounter = 0
files = ("#{dir}/#{f}" for f in fs.readdirSync dir)
parseFunctions = []
for f in files then do (f) ->
parseFunctions.push (next) ->
parseFile f, (err, res) ->
if err?
switch err
when BAD_FORMAT_ERR th... | JavaScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | ef6d0ed257060bc37bd3c1569bd6940b95dadfe4 | 969 | https://github.com/flosse/sloc/blob/ef6d0ed257060bc37bd3c1569bd6940b95dadfe4/src/cli.coffee | 28 | 57 |
flosse/sloc:src/cli.coffee:3:completion | completion | parseDir = (dir, cb) ->
badFileCounter = 0
badFormatCounter = 0
files = ("#{dir}/#{f}" for f in fs.readdirSync dir)
parseFunctions = []
for f in files then do (f) ->
parseFunctions.push (next) ->
parseFile f, (err, res) ->
if err?
switch err
when BAD_FORMAT_ERR th... | when BAD_FILE_ERR then badFileCounter++
next null, res
async.parallel parseFunctions, (err, res) ->
if err?
cb err
else
res = (r for r in res when r?)
res = res.reduce (a,b) ->
o = {}
o[k] = a[k] + b[k] for k,v of a
o
res.badFiles = badFileCounter
... | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | ef6d0ed257060bc37bd3c1569bd6940b95dadfe4 | 969 | https://github.com/flosse/sloc/blob/ef6d0ed257060bc37bd3c1569bd6940b95dadfe4/src/cli.coffee | 28 | 57 |
flosse/sloc:src/cli.coffee:4:raw_corpus | raw_corpus | print = (err, r) ->
if err?
console.error err
else if programm.json
console.log JSON.stringify r
else if programm.sloc
console.log r.sloc
else
console.log """
---------- result ------------
physical lines : #{r.loc}
lines of source code : #{r.sloc}
total co... | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | ef6d0ed257060bc37bd3c1569bd6940b95dadfe4 | 969 | https://github.com/flosse/sloc/blob/ef6d0ed257060bc37bd3c1569bd6940b95dadfe4/src/cli.coffee | 59 | 99 | ||
flosse/sloc:src/cli.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
print = (err, r) ->
if err?
console.error err
else if programm.json
console.log JSON.stringify r
else if programm.sloc
console.log r.sloc
else
console.log """
---------- result ------------
physical lines : #{r.loc}
... | var print, stats;
print = function(err, r) {
if (err != null) {
return console.error(err);
} else if (programm.json) {
return console.log(JSON.stringify(r));
} else if (programm.sloc) {
return console.log(r.sloc);
} else {
console.log(`---------- result ------------
physical lines : ${r.... | CoffeeScript | JavaScript | flosse/sloc | src/cli.coffee | MIT | ef6d0ed257060bc37bd3c1569bd6940b95dadfe4 | 969 | https://github.com/flosse/sloc/blob/ef6d0ed257060bc37bd3c1569bd6940b95dadfe4/src/cli.coffee | 59 | 99 |
flosse/sloc:src/cli.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var print, stats;
print = function(err, r) {
if (err != null) {
return console.error(err);
} else if (programm.json) {
return console.log(JSON.stringify(r));
} else if (programm.sloc) {
return console.log(r.sloc);
} else {
console.log(`----... | print = (err, r) ->
if err?
console.error err
else if programm.json
console.log JSON.stringify r
else if programm.sloc
console.log r.sloc
else
console.log """
---------- result ------------
physical lines : #{r.loc}
lines of source code : #{r.sloc}
total co... | JavaScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | ef6d0ed257060bc37bd3c1569bd6940b95dadfe4 | 969 | https://github.com/flosse/sloc/blob/ef6d0ed257060bc37bd3c1569bd6940b95dadfe4/src/cli.coffee | 59 | 99 |
flosse/sloc:src/cli.coffee:4:completion | completion | print = (err, r) ->
if err?
console.error err
else if programm.json
console.log JSON.stringify r
else if programm.sloc
console.log r.sloc
else
console.log """
---------- result ------------
physical lines : #{r.loc}
lines of source code : #{r.sloc}
total co... | unknown source files : #{r.badFormats}
broken files : #{r.badFiles}
------------------------------
"""
programm
.version('0.0.2')
.usage('[option] <file>|<directory>')
.option('-j, --json', 'return JSON object')
.option('-s, --sloc', 'print only number of source lines')
progr... | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | ef6d0ed257060bc37bd3c1569bd6940b95dadfe4 | 969 | https://github.com/flosse/sloc/blob/ef6d0ed257060bc37bd3c1569bd6940b95dadfe4/src/cli.coffee | 59 | 99 |
flosse/sloc:src/cli.coffee:1:raw_corpus | raw_corpus | ###
This program is distributed under the terms of the GPLv3 license.
Copyright 2012 (c) Markus Kohlhase <mail@markus-kohlhase.de>
###
fs = require 'fs'
async = require 'async'
sloc = require './sloc'
programm = require 'commander'
getExtension = (f) ->
i = f.lastIndexOf '.'
if i < 0 then '' else... | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 7acb9ef84a02e33acd29edf50f22b91001571bb8 | 969 | https://github.com/flosse/sloc/blob/7acb9ef84a02e33acd29edf50f22b91001571bb8/src/cli.coffee | 1 | 50 | ||
flosse/sloc:src/cli.coffee:1:completion | completion | ###
This program is distributed under the terms of the GPLv3 license.
Copyright 2012 (c) Markus Kohlhase <mail@markus-kohlhase.de>
###
fs = require 'fs'
async = require 'async'
sloc = require './sloc'
programm = require 'commander'
getExtension = (f) ->
i = f.lastIndexOf '.'
if i < 0 then '' else... | parseFunctions = []
for f in files then do (f) ->
parseFunctions.push (next) -> parseFile f, next
async.parallel parseFunctions, (err, res) ->
if err?
cb err
else
cb null, res.reduce (a,b) ->
o = {}
o[k] = a[k] + b[k] for k,v of a
o
print = (err, r) ->
if err?
... | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 7acb9ef84a02e33acd29edf50f22b91001571bb8 | 969 | https://github.com/flosse/sloc/blob/7acb9ef84a02e33acd29edf50f22b91001571bb8/src/cli.coffee | 1 | 50 |
flosse/sloc:src/cli.coffee:2:raw_corpus | raw_corpus | physical : #{r.loc}
source : #{r.sloc}
total comment : #{r.cloc}
singleline : #{r.scloc}
multiline : #{r.mcloc}
empty : #{r.nloc}
------------------------------
"""
programm
.version('0.0.2')
.usage('[option] <file>|<directory>')
.option('-j, ... | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 7acb9ef84a02e33acd29edf50f22b91001571bb8 | 969 | https://github.com/flosse/sloc/blob/7acb9ef84a02e33acd29edf50f22b91001571bb8/src/cli.coffee | 51 | 75 | ||
flosse/sloc:src/cli.coffee:2:completion | completion | physical : #{r.loc}
source : #{r.sloc}
total comment : #{r.cloc}
singleline : #{r.scloc}
multiline : #{r.mcloc}
empty : #{r.nloc}
------------------------------
"""
programm
.version('0.0.2')
.usage('[option] <file>|<directory>') | .option('-j, --json', 'return JSON object')
.option('-s, --sloc', 'print only number of source lines')
programm.parse process.argv
if programm.args.length < 1
programm.help()
else
stats = fs.lstatSync programm.args[0]
if stats.isDirectory() then parseDir programm.args[0], print
else if stats.isFile() the... | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 7acb9ef84a02e33acd29edf50f22b91001571bb8 | 969 | https://github.com/flosse/sloc/blob/7acb9ef84a02e33acd29edf50f22b91001571bb8/src/cli.coffee | 51 | 75 |
flosse/sloc:src/cli.coffee:2:raw_corpus | raw_corpus | physical : #{r.loc}
source : #{r.sloc}
total comment : #{r.cloc}
singleline : #{r.scloc}
multiline : #{r.mcloc}
empty : #{r.nloc}
------------------------------
"""
programm
.version('0.0.2')
.usage('[option] <file>|<directory>')
.option('-j, ... | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 2cbdfbe9374582be997f467fd207555539a135f7 | 969 | https://github.com/flosse/sloc/blob/2cbdfbe9374582be997f467fd207555539a135f7/src/cli.coffee | 51 | 71 | ||
flosse/sloc:src/cli.coffee:2:completion | completion | physical : #{r.loc}
source : #{r.sloc}
total comment : #{r.cloc}
singleline : #{r.scloc}
multiline : #{r.mcloc}
empty : #{r.nloc}
------------------------------
"""
programm | .version('0.0.2')
.usage('[option] <file>|<directory>')
.option('-j, --json', 'return JSON object')
.option('-s, --sloc', 'print only number of source lines')
programm.parse(process.argv)
stats = fs.lstatSync programm.args[0]
if stats.isDirectory() then parseDir programm.args[0], print
else if stats.isFile() ... | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | 2cbdfbe9374582be997f467fd207555539a135f7 | 969 | https://github.com/flosse/sloc/blob/2cbdfbe9374582be997f467fd207555539a135f7/src/cli.coffee | 51 | 71 |
flosse/sloc:src/cli.coffee:1:raw_corpus | raw_corpus | ###
This program is distributed under the terms of the GPLv3 license.
Copyright 2012 (c) Markus Kohlhase <mail@markus-kohlhase.de>
###
fs = require 'fs'
async = require 'async'
sloc = require './sloc'
programm = require 'commander'
getExtension = (f) ->
i = f.lastIndexOf '.'
if i < 0 then '' else... | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | f8a299c5c9e026b98e89b28e63856c824f8d6c26 | 969 | https://github.com/flosse/sloc/blob/f8a299c5c9e026b98e89b28e63856c824f8d6c26/src/cli.coffee | 1 | 50 | ||
flosse/sloc:src/cli.coffee:1:completion | completion | ###
This program is distributed under the terms of the GPLv3 license.
Copyright 2012 (c) Markus Kohlhase <mail@markus-kohlhase.de>
###
fs = require 'fs'
async = require 'async'
sloc = require './sloc'
programm = require 'commander'
getExtension = (f) ->
i = f.lastIndexOf '.'
if i < 0 then '' else... | parseFunctions = []
for f in files then do (f) ->
parseFunctions.push (next) -> parseFile f, next
async.parallel parseFunctions, (err, res) ->
if err?
cb err
else
cb null, res.reduce (a,b) ->
o = {}
o[k] = a[k] + b[k] for k,v of a
o
print = (err, r) ->
if err?
... | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | f8a299c5c9e026b98e89b28e63856c824f8d6c26 | 969 | https://github.com/flosse/sloc/blob/f8a299c5c9e026b98e89b28e63856c824f8d6c26/src/cli.coffee | 1 | 50 |
flosse/sloc:src/cli.coffee:2:raw_corpus | raw_corpus | physical lines: #{r.loc}
source lines: #{r.sloc}
total comment lines: #{r.cloc}
block comment lines: #{r.bcloc}
empty lines: #{r.nloc}
------------------------------
"""
programm
.version('0.0.1')
.usage('[option] <file>|<directory>')
.option('-j, --json', ... | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | f8a299c5c9e026b98e89b28e63856c824f8d6c26 | 969 | https://github.com/flosse/sloc/blob/f8a299c5c9e026b98e89b28e63856c824f8d6c26/src/cli.coffee | 51 | 70 | ||
flosse/sloc:src/cli.coffee:2:completion | completion | physical lines: #{r.loc}
source lines: #{r.sloc}
total comment lines: #{r.cloc}
block comment lines: #{r.bcloc}
empty lines: #{r.nloc}
------------------------------
"""
programm
.version('0.0.1') | .usage('[option] <file>|<directory>')
.option('-j, --json', 'return JSON object')
.option('-s, --sloc', 'print only number of source lines')
programm.parse(process.argv)
stats = fs.lstatSync programm.args[0]
if stats.isDirectory() then parseDir programm.args[0], print
else if stats.isFile() then parseFile progr... | CoffeeScript | CoffeeScript | flosse/sloc | src/cli.coffee | MIT | f8a299c5c9e026b98e89b28e63856c824f8d6c26 | 969 | https://github.com/flosse/sloc/blob/f8a299c5c9e026b98e89b28e63856c824f8d6c26/src/cli.coffee | 51 | 70 |
soyjavi/QuoJS:src/quo2.style.coffee:1:raw_corpus | raw_corpus | (($$) ->
$$.fn.addClass = (name) ->
@each ->
unless _existsClass(name, @className)
@className += " " + name
@className = @className.trim()
$$.fn.removeClass = (name) ->
@each ->
@className = @className.replace(name, " ").replace(/\s+/g, "... | CoffeeScript | soyjavi/QuoJS | src/quo2.style.coffee | MIT | 64fce0651ddcb2b02acf5f53f9611109591e9d46 | 2,055 | https://github.com/soyjavi/QuoJS/blob/64fce0651ddcb2b02acf5f53f9611109591e9d46/src/quo2.style.coffee | 1 | 36 | ||
soyjavi/QuoJS:src/quo2.style.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
(($$) ->
$$.fn.addClass = (name) ->
@each ->
unless _existsClass(name, @className)
@className += " " + name
@className = @className.trim()
$$.fn.removeClass = (name) ->
@each ->
@cl... | (function($$) {
var _computedStyle, _existsClass;
$$.fn.addClass = function(name) {
return this.each(function() {
if (!_existsClass(name, this.className)) {
this.className += " " + name;
return this.className = this.className.trim();
}
});
};
$$.fn.removeClass = function(name... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo2.style.coffee | MIT | 64fce0651ddcb2b02acf5f53f9611109591e9d46 | 2,055 | https://github.com/soyjavi/QuoJS/blob/64fce0651ddcb2b02acf5f53f9611109591e9d46/src/quo2.style.coffee | 1 | 36 |
soyjavi/QuoJS:src/quo2.style.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
(function($$) {
var _computedStyle, _existsClass;
$$.fn.addClass = function(name) {
return this.each(function() {
if (!_existsClass(name, this.className)) {
this.className += " " + name;
return this.className = this.className.trim();
... | (($$) ->
$$.fn.addClass = (name) ->
@each ->
unless _existsClass(name, @className)
@className += " " + name
@className = @className.trim()
$$.fn.removeClass = (name) ->
@each ->
@className = @className.replace(name, " ").replace(/\s+/g, "... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo2.style.coffee | MIT | 64fce0651ddcb2b02acf5f53f9611109591e9d46 | 2,055 | https://github.com/soyjavi/QuoJS/blob/64fce0651ddcb2b02acf5f53f9611109591e9d46/src/quo2.style.coffee | 1 | 36 |
soyjavi/QuoJS:src/quo2.style.coffee:1:completion | completion | (($$) ->
$$.fn.addClass = (name) ->
@each ->
unless _existsClass(name, @className)
@className += " " + name
@className = @className.trim()
$$.fn.removeClass = (name) ->
@each ->
@className = @className.replace(name, " ").replace(/\s+/g, "... | @className = @className.trim()
$$.fn.hasClass = (name) ->
_existsClass name, this[0].className
$$.fn.style = (property, value) ->
(if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->
@style[property] = value
))
_existsClass = ... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo2.style.coffee | MIT | 64fce0651ddcb2b02acf5f53f9611109591e9d46 | 2,055 | https://github.com/soyjavi/QuoJS/blob/64fce0651ddcb2b02acf5f53f9611109591e9d46/src/quo2.style.coffee | 1 | 36 |
jnordberg/wintersmith:src/core/graph.coffee:1:raw_corpus | raw_corpus | class Node
constructor: (@id, @item) ->
@edges = []
addEdge: (node) ->
if node not in @edges
@edges.push node | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 15 | 22 | ||
jnordberg/wintersmith:src/core/graph.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Node
constructor: (@id, @item) ->
@edges = []
addEdge: (node) ->
if node not in @edges
@edges.push node
``` | var Node,
indexOf = [].indexOf;
Node = class Node {
constructor(id, item) {
this.id = id;
this.item = item;
this.edges = [];
}
addEdge(node) {
if (indexOf.call(this.edges, node) < 0) {
return this.edges.push(node);
}
}
}; | CoffeeScript | JavaScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 15 | 22 |
jnordberg/wintersmith:src/core/graph.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Node,
indexOf = [].indexOf;
Node = class Node {
constructor(id, item) {
this.id = id;
this.item = item;
this.edges = [];
}
addEdge(node) {
if (indexOf.call(this.edges, node) < 0) {
return this.edges.push(node);
}
}
};
``` | class Node
constructor: (@id, @item) ->
@edges = []
addEdge: (node) ->
if node not in @edges
@edges.push node | JavaScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 15 | 22 |
jnordberg/wintersmith:src/core/graph.coffee:1:completion | completion | class Node
constructor: (@id, @item) ->
@edges = [] | addEdge: (node) ->
if node not in @edges
@edges.push node | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 15 | 22 |
jnordberg/wintersmith:src/core/graph.coffee:2:raw_corpus | raw_corpus | class Graph
constructor: (@identify) ->
### *identify* is a function that identifies an item. should return
a unique string value representing that item. ###
@nodes = {}
addItem: (item) ->
id = @identify item
node = new Node id, item
@nodes[id] = node
return node
addDependency: ... | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 24 | 73 | ||
jnordberg/wintersmith:src/core/graph.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Graph
constructor: (@identify) ->
### *identify* is a function that identifies an item. should return
a unique string value representing that item. ###
@nodes = {}
addItem: (item) ->
id = @identify item
node = new Node id, item... | var Graph,
indexOf = [].indexOf;
Graph = class Graph {
constructor(identify) {
this.identify = identify;
/* *identify* is a function that identifies an item. should return
a unique string value representing that item. */
this.nodes = {};
}
addItem(item) {
var id, node;
id = this... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 24 | 73 |
jnordberg/wintersmith:src/core/graph.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Graph,
indexOf = [].indexOf;
Graph = class Graph {
constructor(identify) {
this.identify = identify;
/* *identify* is a function that identifies an item. should return
a unique string value representing that item. */
this.nodes = {};... | class Graph
constructor: (@identify) ->
### *identify* is a function that identifies an item. should return
a unique string value representing that item. ###
@nodes = {}
addItem: (item) ->
id = @identify item
node = new Node id, item
@nodes[id] = node
return node
addDependency: ... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 24 | 73 |
jnordberg/wintersmith:src/core/graph.coffee:2:completion | completion | class Graph
constructor: (@identify) ->
### *identify* is a function that identifies an item. should return
a unique string value representing that item. ###
@nodes = {}
addItem: (item) ->
id = @identify item
node = new Node id, item
@nodes[id] = node
return node
addDependency: ... | dependsOn: (item) ->
### return a list of items depending on *item* ###
target = @nodeFor item
return @reverseLookup(target).map (node) -> node.item
### private ###
nodeFor: (item) ->
@nodes[@identify(item)] or @addItem(item)
resolveNode: (node, resolved=[], seen={}) ->
seen[node.id] = true... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 24 | 73 |
jnordberg/wintersmith:src/core/graph.coffee:3:raw_corpus | raw_corpus | class GraphHandler
constructor: (@target, @fn) ->
get: (receiver, key) ->
rv = @target[key]
if rv instanceof ContentPlugin
@fn rv # emit dependency
return rv
else if rv instanceof Object
handler = new GraphHandler rv, @fn
return Proxy.create handler, Object.getPrototypeOf rv
... | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 75 | 124 | ||
jnordberg/wintersmith:src/core/graph.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class GraphHandler
constructor: (@target, @fn) ->
get: (receiver, key) ->
rv = @target[key]
if rv instanceof ContentPlugin
@fn rv # emit dependency
return rv
else if rv instanceof Object
handler = new GraphHandler rv, @fn
... | var GraphHandler;
GraphHandler = class GraphHandler {
constructor(target, fn) {
this.target = target;
this.fn = fn;
}
get(receiver, key) {
var handler, rv;
rv = this.target[key];
if (rv instanceof ContentPlugin) {
this.fn(rv); // emit dependency
return rv;
} else if (rv insta... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 75 | 124 |
jnordberg/wintersmith:src/core/graph.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var GraphHandler;
GraphHandler = class GraphHandler {
constructor(target, fn) {
this.target = target;
this.fn = fn;
}
get(receiver, key) {
var handler, rv;
rv = this.target[key];
if (rv instanceof ContentPlugin) {
this.fn(rv); // e... | class GraphHandler
constructor: (@target, @fn) ->
get: (receiver, key) ->
rv = @target[key]
if rv instanceof ContentPlugin
@fn rv # emit dependency
return rv
else if rv instanceof Object
handler = new GraphHandler rv, @fn
return Proxy.create handler, Object.getPrototypeOf rv
... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 75 | 124 |
jnordberg/wintersmith:src/core/graph.coffee:3:completion | completion | class GraphHandler
constructor: (@target, @fn) ->
get: (receiver, key) ->
rv = @target[key]
if rv instanceof ContentPlugin
@fn rv # emit dependency
return rv
else if rv instanceof Object
handler = new GraphHandler rv, @fn
return Proxy.create handler, Object.getPrototypeOf rv
... | enumerate: ->
(key for key of @target)
getPropertyDescriptor: (key) ->
obj = @target
while obj
desc = Object.getOwnPropertyDescriptor obj, key
if desc
desc.configurable = true
return desc
obj = Object.getPrototypeOf obj
return
getOwnPropertyDescriptor: (key) ->
... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 75 | 124 |
jnordberg/wintersmith:src/core/graph.coffee:4:raw_corpus | raw_corpus | Object.prototype.hasOwnProperty.call @target, key
delete: (key) ->
delete @target[key]
return true
apply: (receiver, args) ->
Function.prototype.apply.call @target, receiver, args
construct: (args) ->
new Function.prototype.bind.apply @target, [null].concat(args) | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 125 | 135 | ||
jnordberg/wintersmith:src/core/graph.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Object.prototype.hasOwnProperty.call @target, key
delete: (key) ->
delete @target[key]
return true
apply: (receiver, args) ->
Function.prototype.apply.call @target, receiver, args
construct: (args) ->
new Function.prototype.bind.apply @ta... | Object.prototype.hasOwnProperty.call(this.target, key({
delete: function(key) {
delete this.target[key];
return true;
},
apply: function(receiver, args) {
return Function.prototype.apply.call(this.target, receiver, args);
},
construct: function(args) {
return new Function.prototype.bind.apply(... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 125 | 135 |
jnordberg/wintersmith:src/core/graph.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Object.prototype.hasOwnProperty.call(this.target, key({
delete: function(key) {
delete this.target[key];
return true;
},
apply: function(receiver, args) {
return Function.prototype.apply.call(this.target, receiver, args);
},
construct: functio... | Object.prototype.hasOwnProperty.call @target, key
delete: (key) ->
delete @target[key]
return true
apply: (receiver, args) ->
Function.prototype.apply.call @target, receiver, args
construct: (args) ->
new Function.prototype.bind.apply @target, [null].concat(args) | JavaScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 125 | 135 |
jnordberg/wintersmith:src/core/graph.coffee:4:completion | completion | Object.prototype.hasOwnProperty.call @target, key
delete: (key) ->
delete @target[key]
return true | apply: (receiver, args) ->
Function.prototype.apply.call @target, receiver, args
construct: (args) ->
new Function.prototype.bind.apply @target, [null].concat(args) | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 125 | 135 |
jnordberg/wintersmith:src/core/graph.coffee:5:raw_corpus | raw_corpus | GraphHandler.proxy = (tree, fn) ->
handler = new GraphHandler tree, fn
return Proxy.create handler, ContentTree.prototype
# generate dependency graph for environment | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 137 | 141 | ||
jnordberg/wintersmith:src/core/graph.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
GraphHandler.proxy = (tree, fn) ->
handler = new GraphHandler tree, fn
return Proxy.create handler, ContentTree.prototype
# generate dependency graph for environment
``` | GraphHandler.proxy = function(tree, fn) {
var handler;
handler = new GraphHandler(tree, fn);
return Proxy.create(handler, ContentTree.prototype);
};
// generate dependency graph for environment | CoffeeScript | JavaScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 137 | 141 |
jnordberg/wintersmith:src/core/graph.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
GraphHandler.proxy = function(tree, fn) {
var handler;
handler = new GraphHandler(tree, fn);
return Proxy.create(handler, ContentTree.prototype);
};
// generate dependency graph for environment
``` | GraphHandler.proxy = (tree, fn) ->
handler = new GraphHandler tree, fn
return Proxy.create handler, ContentTree.prototype
# generate dependency graph for environment | JavaScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 137 | 141 |
jnordberg/wintersmith:src/core/graph.coffee:5:completion | completion | GraphHandler.proxy = (tree, fn) ->
handler = new GraphHandler tree, fn | return Proxy.create handler, ContentTree.prototype
# generate dependency graph for environment | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 137 | 141 |
jnordberg/wintersmith:src/core/graph.coffee:6:raw_corpus | raw_corpus | buildGraph = (env, contents, templates, locals, callback) ->
if not Proxy?
callback new Error "Harmony proxies not enabled. You need to run node with --harmony-proxies."
return
current = null
items = ContentTree.flatten contents
graph = new Graph (item) -> item.__filename
graph.addItem item for item... | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 143 | 164 | ||
jnordberg/wintersmith:src/core/graph.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
buildGraph = (env, contents, templates, locals, callback) ->
if not Proxy?
callback new Error "Harmony proxies not enabled. You need to run node with --harmony-proxies."
return
current = null
items = ContentTree.flatten contents
graph = new Grap... | var buildGraph;
buildGraph = function(env, contents, templates, locals, callback) {
var current, graph, i, item, items, len, proxy;
if (typeof Proxy === "undefined" || Proxy === null) {
callback(new Error("Harmony proxies not enabled. You need to run node with --harmony-proxies."));
return;
}
current =... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 143 | 164 |
jnordberg/wintersmith:src/core/graph.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var buildGraph;
buildGraph = function(env, contents, templates, locals, callback) {
var current, graph, i, item, items, len, proxy;
if (typeof Proxy === "undefined" || Proxy === null) {
callback(new Error("Harmony proxies not enabled. You need to run node ... | buildGraph = (env, contents, templates, locals, callback) ->
if not Proxy?
callback new Error "Harmony proxies not enabled. You need to run node with --harmony-proxies."
return
current = null
items = ContentTree.flatten contents
graph = new Graph (item) -> item.__filename
graph.addItem item for item... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 143 | 164 |
jnordberg/wintersmith:src/core/graph.coffee:6:completion | completion | buildGraph = (env, contents, templates, locals, callback) ->
if not Proxy?
callback new Error "Harmony proxies not enabled. You need to run node with --harmony-proxies."
return
current = null
items = ContentTree.flatten contents
graph = new Graph (item) -> item.__filename
graph.addItem item for item... | proxy = GraphHandler.proxy contents, (dep) ->
graph.addDependency current, dep
async.eachSeries items, (item, callback) ->
current = item
# NOTE: is it ok to discard readstreams like this?
item.view env, locals, proxy, templates, callback
, (error) ->
callback error, graph
### Exports ### | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9 | 3,484 | https://github.com/jnordberg/wintersmith/blob/18eeac5b8f0029a89d4bb6dbb5f63d88fc4d35b9/src/core/graph.coffee | 143 | 164 |
jnordberg/wintersmith:src/core/graph.coffee:3:raw_corpus | raw_corpus | class GraphHandler
constructor: (@target, @fn) ->
get: (receiver, key) ->
rv = @target[key]
if rv instanceof ContentPlugin
@fn rv # emit dependency
return rv
else if rv instanceof Object
handler = new GraphHandler rv, @fn
return Proxy.create handler, Object.getPrototypeOf rv
... | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 2918c7968363b38a4be9b8d6872d53f5b745c8d5 | 3,484 | https://github.com/jnordberg/wintersmith/blob/2918c7968363b38a4be9b8d6872d53f5b745c8d5/src/core/graph.coffee | 68 | 117 | ||
jnordberg/wintersmith:src/core/graph.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class GraphHandler
constructor: (@target, @fn) ->
get: (receiver, key) ->
rv = @target[key]
if rv instanceof ContentPlugin
@fn rv # emit dependency
return rv
else if rv instanceof Object
handler = new GraphHandler rv, @fn
... | var GraphHandler;
GraphHandler = class GraphHandler {
constructor(target, fn) {
this.target = target;
this.fn = fn;
}
get(receiver, key) {
var handler, rv;
rv = this.target[key];
if (rv instanceof ContentPlugin) {
this.fn(rv); // emit dependency
return rv;
} else if (rv insta... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 2918c7968363b38a4be9b8d6872d53f5b745c8d5 | 3,484 | https://github.com/jnordberg/wintersmith/blob/2918c7968363b38a4be9b8d6872d53f5b745c8d5/src/core/graph.coffee | 68 | 117 |
jnordberg/wintersmith:src/core/graph.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var GraphHandler;
GraphHandler = class GraphHandler {
constructor(target, fn) {
this.target = target;
this.fn = fn;
}
get(receiver, key) {
var handler, rv;
rv = this.target[key];
if (rv instanceof ContentPlugin) {
this.fn(rv); // e... | class GraphHandler
constructor: (@target, @fn) ->
get: (receiver, key) ->
rv = @target[key]
if rv instanceof ContentPlugin
@fn rv # emit dependency
return rv
else if rv instanceof Object
handler = new GraphHandler rv, @fn
return Proxy.create handler, Object.getPrototypeOf rv
... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 2918c7968363b38a4be9b8d6872d53f5b745c8d5 | 3,484 | https://github.com/jnordberg/wintersmith/blob/2918c7968363b38a4be9b8d6872d53f5b745c8d5/src/core/graph.coffee | 68 | 117 |
jnordberg/wintersmith:src/core/graph.coffee:3:completion | completion | class GraphHandler
constructor: (@target, @fn) ->
get: (receiver, key) ->
rv = @target[key]
if rv instanceof ContentPlugin
@fn rv # emit dependency
return rv
else if rv instanceof Object
handler = new GraphHandler rv, @fn
return Proxy.create handler, Object.getPrototypeOf rv
... | enumerate: ->
(key for key of @target)
getPropertyDescriptor: (key) ->
obj = @target
while obj
desc = Object.getOwnPropertyDescriptor obj, key
if desc
desc.configurable = true
return desc
obj = Object.getPrototypeOf obj
return
getOwnPropertyDescriptor: (key) ->
... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 2918c7968363b38a4be9b8d6872d53f5b745c8d5 | 3,484 | https://github.com/jnordberg/wintersmith/blob/2918c7968363b38a4be9b8d6872d53f5b745c8d5/src/core/graph.coffee | 68 | 117 |
jnordberg/wintersmith:src/core/graph.coffee:6:raw_corpus | raw_corpus | buildGraph = (env, contents, templates, locals, callback) ->
if not Proxy?
callback new Error "Harmony proxies not enabled. You need to run node with --harmony-proxies."
return
current = null
items = ContentTree.flatten contents
graph = new Graph (item) -> item.__filename
graph.addItem item for item... | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 2918c7968363b38a4be9b8d6872d53f5b745c8d5 | 3,484 | https://github.com/jnordberg/wintersmith/blob/2918c7968363b38a4be9b8d6872d53f5b745c8d5/src/core/graph.coffee | 136 | 159 | ||
jnordberg/wintersmith:src/core/graph.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
buildGraph = (env, contents, templates, locals, callback) ->
if not Proxy?
callback new Error "Harmony proxies not enabled. You need to run node with --harmony-proxies."
return
current = null
items = ContentTree.flatten contents
graph = new Grap... | var buildGraph;
buildGraph = function(env, contents, templates, locals, callback) {
var current, graph, i, item, items, len, proxy;
if (typeof Proxy === "undefined" || Proxy === null) {
callback(new Error("Harmony proxies not enabled. You need to run node with --harmony-proxies."));
return;
}
current =... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 2918c7968363b38a4be9b8d6872d53f5b745c8d5 | 3,484 | https://github.com/jnordberg/wintersmith/blob/2918c7968363b38a4be9b8d6872d53f5b745c8d5/src/core/graph.coffee | 136 | 159 |
jnordberg/wintersmith:src/core/graph.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var buildGraph;
buildGraph = function(env, contents, templates, locals, callback) {
var current, graph, i, item, items, len, proxy;
if (typeof Proxy === "undefined" || Proxy === null) {
callback(new Error("Harmony proxies not enabled. You need to run node ... | buildGraph = (env, contents, templates, locals, callback) ->
if not Proxy?
callback new Error "Harmony proxies not enabled. You need to run node with --harmony-proxies."
return
current = null
items = ContentTree.flatten contents
graph = new Graph (item) -> item.__filename
graph.addItem item for item... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 2918c7968363b38a4be9b8d6872d53f5b745c8d5 | 3,484 | https://github.com/jnordberg/wintersmith/blob/2918c7968363b38a4be9b8d6872d53f5b745c8d5/src/core/graph.coffee | 136 | 159 |
jnordberg/wintersmith:src/core/graph.coffee:6:completion | completion | buildGraph = (env, contents, templates, locals, callback) ->
if not Proxy?
callback new Error "Harmony proxies not enabled. You need to run node with --harmony-proxies."
return
current = null
items = ContentTree.flatten contents
graph = new Graph (item) -> item.__filename
graph.addItem item for item... | graph.addDependency current, dep
locals.contents = proxy # TODO: don't modify locals
async.eachSeries items, (item, callback) ->
current = item
# NOTE: is it ok to discard readstreams like this?
item.view env, locals, proxy, templates, callback
, (error) ->
callback error, graph
### Exports ### | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 2918c7968363b38a4be9b8d6872d53f5b745c8d5 | 3,484 | https://github.com/jnordberg/wintersmith/blob/2918c7968363b38a4be9b8d6872d53f5b745c8d5/src/core/graph.coffee | 136 | 159 |
jnordberg/wintersmith:src/core/graph.coffee:1:raw_corpus | raw_corpus | class Node
constructor: (@id, @item) ->
@edges = []
addEdge: (node) ->
@edges.push node | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 1cad02556f9f384086b05d7d914be5dcacc13294 | 3,484 | https://github.com/jnordberg/wintersmith/blob/1cad02556f9f384086b05d7d914be5dcacc13294/src/core/graph.coffee | 8 | 14 | ||
jnordberg/wintersmith:src/core/graph.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Node
constructor: (@id, @item) ->
@edges = []
addEdge: (node) ->
@edges.push node
``` | var Node;
Node = class Node {
constructor(id, item) {
this.id = id;
this.item = item;
this.edges = [];
}
addEdge(node) {
return this.edges.push(node);
}
}; | CoffeeScript | JavaScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 1cad02556f9f384086b05d7d914be5dcacc13294 | 3,484 | https://github.com/jnordberg/wintersmith/blob/1cad02556f9f384086b05d7d914be5dcacc13294/src/core/graph.coffee | 8 | 14 |
jnordberg/wintersmith:src/core/graph.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Node;
Node = class Node {
constructor(id, item) {
this.id = id;
this.item = item;
this.edges = [];
}
addEdge(node) {
return this.edges.push(node);
}
};
``` | class Node
constructor: (@id, @item) ->
@edges = []
addEdge: (node) ->
@edges.push node | JavaScript | CoffeeScript | jnordberg/wintersmith | src/core/graph.coffee | MIT | 1cad02556f9f384086b05d7d914be5dcacc13294 | 3,484 | https://github.com/jnordberg/wintersmith/blob/1cad02556f9f384086b05d7d914be5dcacc13294/src/core/graph.coffee | 8 | 14 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.