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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
stripIndents = (node) ->
step = 0
indent = null
replace node, {}, (str) ->
# Wait for "\n"
if step is 0 or step is 1 and str.match(newLine)
step = 1
str
# Followed by spaces (supress it)
else if step is 1 and str.match(/^[ \t]+... | var stripIndents;
stripIndents = function(node) {
var indent, step;
step = 0;
indent = null;
return replace(node, {}, function(str) {
// Wait for "\n"
if (step === 0 || step === 1 && str.match(newLine)) {
step = 1;
return str;
// Followed by spaces (supress it)
} else if (step === 1... | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 17 | 47 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var stripIndents;
stripIndents = function(node) {
var indent, step;
step = 0;
indent = null;
return replace(node, {}, function(str) {
// Wait for "\n"
if (step === 0 || step === 1 && str.match(newLine)) {
step = 1;
return str;
// Fo... | stripIndents = (node) ->
step = 0
indent = null
replace node, {}, (str) ->
# Wait for "\n"
if step is 0 or step is 1 and str.match(newLine)
step = 1
str
# Followed by spaces (supress it)
else if step is 1 and str.match(/^[ \t]+$/)
indent = str
step = 2
""
# The... | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 17 | 47 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:2:completion | completion | stripIndents = (node) ->
step = 0
indent = null
replace node, {}, (str) ->
# Wait for "\n"
if step is 0 or step is 1 and str.match(newLine)
step = 1
str
# Followed by spaces (supress it)
else if step is 1 and str.match(/^[ \t]+$/)
indent = str
step = 2
"" | # Then merge the spaces into the next tode
else if step is 2
step = 1
if str.match(newLine)
str
else
indent + str
else
step = 0
str
###
# Strip beginning newlines.
### | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 17 | 47 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:3:raw_corpus | raw_corpus | stripPre = (node) ->
replace node, {}, (str) ->
if str.match(newLine)
""
else
@break()
str
###
# Strip ending newlines.
### | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 49 | 59 | ||
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
stripPre = (node) ->
replace node, {}, (str) ->
if str.match(newLine)
""
else
@break()
str
###
# Strip ending newlines.
###
``` | var stripPre;
stripPre = function(node) {
return replace(node, {}, function(str) {
if (str.match(newLine)) {
return "";
} else {
this.break();
return str;
}
});
};
/*
* Strip ending newlines.
*/ | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 49 | 59 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var stripPre;
stripPre = function(node) {
return replace(node, {}, function(str) {
if (str.match(newLine)) {
return "";
} else {
this.break();
return str;
}
});
};
/*
* Strip ending newlines.
*/
``` | stripPre = (node) ->
replace node, {}, (str) ->
if str.match(newLine)
""
else
@break()
str
###
# Strip ending newlines.
### | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 49 | 59 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:3:completion | completion | stripPre = (node) ->
replace node, {}, (str) ->
if str.match(newLine)
""
else | @break()
str
###
# Strip ending newlines.
### | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 49 | 59 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:4:raw_corpus | raw_corpus | stripPost = (node) ->
replace node, reverse: true, (str) ->
if str.match(newLine)
""
else
@break()
"#{str}\n"
###
# Strip triple new lines.
### | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 61 | 71 | ||
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
stripPost = (node) ->
replace node, reverse: true, (str) ->
if str.match(newLine)
""
else
@break()
"#{str}\n"
###
# Strip triple new lines.
###
``` | var stripPost;
stripPost = function(node) {
return replace(node, {
reverse: true
}, function(str) {
if (str.match(newLine)) {
return "";
} else {
this.break();
return `${str}\n`;
}
});
};
/*
* Strip triple new lines.
*/ | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 61 | 71 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var stripPost;
stripPost = function(node) {
return replace(node, {
reverse: true
}, function(str) {
if (str.match(newLine)) {
return "";
} else {
this.break();
return `${str}\n`;
}
});
};
/*
* Strip triple new lines.
*/
`... | stripPost = (node) ->
replace node, reverse: true, (str) ->
if str.match(newLine)
""
else
@break()
"#{str}\n"
###
# Strip triple new lines.
### | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 61 | 71 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:4:completion | completion | stripPost = (node) ->
replace node, reverse: true, (str) ->
if str.match(newLine)
""
else | @break()
"#{str}\n"
###
# Strip triple new lines.
### | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 61 | 71 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:5:raw_corpus | raw_corpus | stripMid = (node) ->
streak = 0
replace node, {}, (n) ->
if n is "\n"
streak += 1
else if n.match(/^\s*$/)
# pass
else
streak = 0
if streak >= 3 then "" else n
###
# Walk and replace.
#
# replace node, {}, (str) ->
# if str is "true"
# "replacement"
# els... | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 73 | 94 | ||
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
stripMid = (node) ->
streak = 0
replace node, {}, (n) ->
if n is "\n"
streak += 1
else if n.match(/^\s*$/)
# pass
else
streak = 0
if streak >= 3 then "" else n
###
# Walk and replace.
#
# replace node, {}, (str) ->
# ... | var stripMid;
stripMid = function(node) {
var streak;
streak = 0;
return replace(node, {}, function(n) {
if (n === "\n") {
streak += 1;
} else if (n.match(/^\s*$/)) {
} else {
// pass
streak = 0;
}
if (streak >= 3) {
return "";
} else {
return n;
}
});... | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 73 | 94 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var stripMid;
stripMid = function(node) {
var streak;
streak = 0;
return replace(node, {}, function(n) {
if (n === "\n") {
streak += 1;
} else if (n.match(/^\s*$/)) {
} else {
// pass
streak = 0;
}
if (streak >= 3) {
... | stripMid = (node) ->
streak = 0
replace node, {}, (n) ->
if n is "\n"
streak += 1
else if n.match(/^\s*$/)
# pass
else
streak = 0
if streak >= 3 then "" else n
###
# Walk and replace.
#
# replace node, {}, (str) ->
# if str is "true"
# "replacement"
# els... | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 73 | 94 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:6:raw_corpus | raw_corpus | replace = (node, options = {}, fn) ->
broken = false
ctx =
break: (str) ->
broken = true
walk = (node, options = {}, fn) ->
range = if options.reverse
[node.children.length-1..0]
else
[0...node.children.length]
for i in range
return node if broken
child = node.chil... | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 96 | 125 | ||
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
replace = (node, options = {}, fn) ->
broken = false
ctx =
break: (str) ->
broken = true
walk = (node, options = {}, fn) ->
range = if options.reverse
[node.children.length-1..0]
else
[0...node.children.length]
for i in ... | var replace;
replace = function(node, options = {}, fn) {
var broken, ctx, walk;
broken = false;
ctx = {
break: function(str) {
return broken = true;
}
};
walk = function(node, options = {}, fn) {
var child, i, j, len, output, range, ref, ref1;
range = options.reverse ? (function() {
... | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 96 | 125 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var replace;
replace = function(node, options = {}, fn) {
var broken, ctx, walk;
broken = false;
ctx = {
break: function(str) {
return broken = true;
}
};
walk = function(node, options = {}, fn) {
var child, i, j, len, output, range, re... | replace = (node, options = {}, fn) ->
broken = false
ctx =
break: (str) ->
broken = true
walk = (node, options = {}, fn) ->
range = if options.reverse
[node.children.length-1..0]
else
[0...node.children.length]
for i in range
return node if broken
child = node.chil... | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 96 | 125 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:6:completion | completion | replace = (node, options = {}, fn) ->
broken = false
ctx =
break: (str) ->
broken = true
walk = (node, options = {}, fn) ->
range = if options.reverse
[node.children.length-1..0]
else
[0...node.children.length]
for i in range
return node if broken | child = node.children[i]
if !child
# pass
else if child.children
walk child, options, fn
else if child isnt ''
output = fn.call(ctx, child)
node.children[i] = output
node
walk.call ctx, node, options, fn | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/strip_spaces.coffee | 96 | 125 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:1:raw_corpus | raw_corpus | stripSpaces = (node) ->
node = stripPre(node)
node = stripPost(node)
node = stripMid(node)
node
###
# Strip beginning newlines.
### | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 92b5bbb073d0c19014b236557f89f762de25c302 | 2,082 | https://github.com/js2coffee/js2coffee/blob/92b5bbb073d0c19014b236557f89f762de25c302/lib/builder/strip_spaces.coffee | 6 | 14 | ||
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
stripSpaces = (node) ->
node = stripPre(node)
node = stripPost(node)
node = stripMid(node)
node
###
# Strip beginning newlines.
###
``` | var stripSpaces;
stripSpaces = function(node) {
node = stripPre(node);
node = stripPost(node);
node = stripMid(node);
return node;
};
/*
* Strip beginning newlines.
*/ | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 92b5bbb073d0c19014b236557f89f762de25c302 | 2,082 | https://github.com/js2coffee/js2coffee/blob/92b5bbb073d0c19014b236557f89f762de25c302/lib/builder/strip_spaces.coffee | 6 | 14 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var stripSpaces;
stripSpaces = function(node) {
node = stripPre(node);
node = stripPost(node);
node = stripMid(node);
return node;
};
/*
* Strip beginning newlines.
*/
``` | stripSpaces = (node) ->
node = stripPre(node)
node = stripPost(node)
node = stripMid(node)
node
###
# Strip beginning newlines.
### | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 92b5bbb073d0c19014b236557f89f762de25c302 | 2,082 | https://github.com/js2coffee/js2coffee/blob/92b5bbb073d0c19014b236557f89f762de25c302/lib/builder/strip_spaces.coffee | 6 | 14 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:1:completion | completion | stripSpaces = (node) ->
node = stripPre(node)
node = stripPost(node)
node = stripMid(node) | node
###
# Strip beginning newlines.
### | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 92b5bbb073d0c19014b236557f89f762de25c302 | 2,082 | https://github.com/js2coffee/js2coffee/blob/92b5bbb073d0c19014b236557f89f762de25c302/lib/builder/strip_spaces.coffee | 6 | 14 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:2:raw_corpus | raw_corpus | stripPre = (node) ->
replace node, {}, (n) ->
if n.match(newLine)
""
else
@break()
n
###
# Strip ending newlines.
### | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 92b5bbb073d0c19014b236557f89f762de25c302 | 2,082 | https://github.com/js2coffee/js2coffee/blob/92b5bbb073d0c19014b236557f89f762de25c302/lib/builder/strip_spaces.coffee | 16 | 26 | ||
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
stripPre = (node) ->
replace node, {}, (n) ->
if n.match(newLine)
""
else
@break()
n
###
# Strip ending newlines.
###
``` | var stripPre;
stripPre = function(node) {
return replace(node, {}, function(n) {
if (n.match(newLine)) {
return "";
} else {
this.break();
return n;
}
});
};
/*
* Strip ending newlines.
*/ | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 92b5bbb073d0c19014b236557f89f762de25c302 | 2,082 | https://github.com/js2coffee/js2coffee/blob/92b5bbb073d0c19014b236557f89f762de25c302/lib/builder/strip_spaces.coffee | 16 | 26 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var stripPre;
stripPre = function(node) {
return replace(node, {}, function(n) {
if (n.match(newLine)) {
return "";
} else {
this.break();
return n;
}
});
};
/*
* Strip ending newlines.
*/
``` | stripPre = (node) ->
replace node, {}, (n) ->
if n.match(newLine)
""
else
@break()
n
###
# Strip ending newlines.
### | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 92b5bbb073d0c19014b236557f89f762de25c302 | 2,082 | https://github.com/js2coffee/js2coffee/blob/92b5bbb073d0c19014b236557f89f762de25c302/lib/builder/strip_spaces.coffee | 16 | 26 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:2:completion | completion | stripPre = (node) ->
replace node, {}, (n) ->
if n.match(newLine)
""
else | @break()
n
###
# Strip ending newlines.
### | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 92b5bbb073d0c19014b236557f89f762de25c302 | 2,082 | https://github.com/js2coffee/js2coffee/blob/92b5bbb073d0c19014b236557f89f762de25c302/lib/builder/strip_spaces.coffee | 16 | 26 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:3:raw_corpus | raw_corpus | stripPost = (node) ->
replace node, reverse: true, (n) ->
if n.match(newLine)
""
else
@break()
"#{n}\n"
###
# Strip triple new lines.
### | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 92b5bbb073d0c19014b236557f89f762de25c302 | 2,082 | https://github.com/js2coffee/js2coffee/blob/92b5bbb073d0c19014b236557f89f762de25c302/lib/builder/strip_spaces.coffee | 28 | 38 | ||
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
stripPost = (node) ->
replace node, reverse: true, (n) ->
if n.match(newLine)
""
else
@break()
"#{n}\n"
###
# Strip triple new lines.
###
``` | var stripPost;
stripPost = function(node) {
return replace(node, {
reverse: true
}, function(n) {
if (n.match(newLine)) {
return "";
} else {
this.break();
return `${n}\n`;
}
});
};
/*
* Strip triple new lines.
*/ | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 92b5bbb073d0c19014b236557f89f762de25c302 | 2,082 | https://github.com/js2coffee/js2coffee/blob/92b5bbb073d0c19014b236557f89f762de25c302/lib/builder/strip_spaces.coffee | 28 | 38 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var stripPost;
stripPost = function(node) {
return replace(node, {
reverse: true
}, function(n) {
if (n.match(newLine)) {
return "";
} else {
this.break();
return `${n}\n`;
}
});
};
/*
* Strip triple new lines.
*/
``` | stripPost = (node) ->
replace node, reverse: true, (n) ->
if n.match(newLine)
""
else
@break()
"#{n}\n"
###
# Strip triple new lines.
### | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 92b5bbb073d0c19014b236557f89f762de25c302 | 2,082 | https://github.com/js2coffee/js2coffee/blob/92b5bbb073d0c19014b236557f89f762de25c302/lib/builder/strip_spaces.coffee | 28 | 38 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:3:completion | completion | stripPost = (node) ->
replace node, reverse: true, (n) ->
if n.match(newLine)
""
else | @break()
"#{n}\n"
###
# Strip triple new lines.
### | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 92b5bbb073d0c19014b236557f89f762de25c302 | 2,082 | https://github.com/js2coffee/js2coffee/blob/92b5bbb073d0c19014b236557f89f762de25c302/lib/builder/strip_spaces.coffee | 28 | 38 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:4:raw_corpus | raw_corpus | stripMid = (node) ->
streak = 0
replace node, {}, (n) ->
if n is "\n"
streak += 1
else if n.match(/^\s*$/)
# pass
else
streak = 0
if streak >= 3 then "" else n
###
# walk and replace
### | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 92b5bbb073d0c19014b236557f89f762de25c302 | 2,082 | https://github.com/js2coffee/js2coffee/blob/92b5bbb073d0c19014b236557f89f762de25c302/lib/builder/strip_spaces.coffee | 40 | 55 | ||
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
stripMid = (node) ->
streak = 0
replace node, {}, (n) ->
if n is "\n"
streak += 1
else if n.match(/^\s*$/)
# pass
else
streak = 0
if streak >= 3 then "" else n
###
# walk and replace
###
``` | var stripMid;
stripMid = function(node) {
var streak;
streak = 0;
return replace(node, {}, function(n) {
if (n === "\n") {
streak += 1;
} else if (n.match(/^\s*$/)) {
} else {
// pass
streak = 0;
}
if (streak >= 3) {
return "";
} else {
return n;
}
});... | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 92b5bbb073d0c19014b236557f89f762de25c302 | 2,082 | https://github.com/js2coffee/js2coffee/blob/92b5bbb073d0c19014b236557f89f762de25c302/lib/builder/strip_spaces.coffee | 40 | 55 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var stripMid;
stripMid = function(node) {
var streak;
streak = 0;
return replace(node, {}, function(n) {
if (n === "\n") {
streak += 1;
} else if (n.match(/^\s*$/)) {
} else {
// pass
streak = 0;
}
if (streak >= 3) {
... | stripMid = (node) ->
streak = 0
replace node, {}, (n) ->
if n is "\n"
streak += 1
else if n.match(/^\s*$/)
# pass
else
streak = 0
if streak >= 3 then "" else n
###
# walk and replace
### | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 92b5bbb073d0c19014b236557f89f762de25c302 | 2,082 | https://github.com/js2coffee/js2coffee/blob/92b5bbb073d0c19014b236557f89f762de25c302/lib/builder/strip_spaces.coffee | 40 | 55 |
js2coffee/js2coffee:lib/builder/strip_spaces.coffee:4:completion | completion | stripMid = (node) ->
streak = 0
replace node, {}, (n) ->
if n is "\n"
streak += 1
else if n.match(/^\s*$/)
# pass | else
streak = 0
if streak >= 3 then "" else n
###
# walk and replace
### | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/builder/strip_spaces.coffee | MIT | 92b5bbb073d0c19014b236557f89f762de25c302 | 2,082 | https://github.com/js2coffee/js2coffee/blob/92b5bbb073d0c19014b236557f89f762de25c302/lib/builder/strip_spaces.coffee | 40 | 55 |
jianliaoim/talk-os:talk-web/client/app/team-settings.coffee:1:raw_corpus | raw_corpus | React = require 'react'
Immutable = require 'immutable'
recorder = require 'actions-recorder'
PureRenderMixin = require 'react-addons-pure-render-mixin'
query = require '../query'
lang = require '../locales/lang'
teamActions = require '../actions/team'
routerHandlers = require '../handlers/router'
LightDialog... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/team-settings.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/team-settings.coffee | 1 | 47 | ||
jianliaoim/talk-os:talk-web/client/app/team-settings.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
React = require 'react'
Immutable = require 'immutable'
recorder = require 'actions-recorder'
PureRenderMixin = require 'react-addons-pure-render-mixin'
query = require '../query'
lang = require '../locales/lang'
teamActions = require '../actions/team'
r... | var Immutable, LightDialog, PureRenderMixin, React, T, a, button, div, l, lang, p, query, recorder, routerHandlers, teamActions;
React = require('react');
Immutable = require('immutable');
recorder = require('actions-recorder');
PureRenderMixin = require('react-addons-pure-render-mixin');
query = require('../query... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/team-settings.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/team-settings.coffee | 1 | 47 |
jianliaoim/talk-os:talk-web/client/app/team-settings.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Immutable, LightDialog, PureRenderMixin, React, T, a, button, div, l, lang, p, query, recorder, routerHandlers, teamActions;
React = require('react');
Immutable = require('immutable');
recorder = require('actions-recorder');
PureRenderMixin = require('react... | React = require 'react'
Immutable = require 'immutable'
recorder = require 'actions-recorder'
PureRenderMixin = require 'react-addons-pure-render-mixin'
query = require '../query'
lang = require '../locales/lang'
teamActions = require '../actions/team'
routerHandlers = require '../handlers/router'
LightDialog... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/team-settings.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/team-settings.coffee | 1 | 47 |
jianliaoim/talk-os:talk-web/client/app/team-settings.coffee:1:completion | completion | React = require 'react'
Immutable = require 'immutable'
recorder = require 'actions-recorder'
PureRenderMixin = require 'react-addons-pure-render-mixin'
query = require '../query'
lang = require '../locales/lang'
teamActions = require '../actions/team'
routerHandlers = require '../handlers/router'
LightDialog... | mixins: [PureRenderMixin]
propTypes:
data: T.instanceOf(Immutable.Map)
onQuitTeam: ->
routerHandlers.settingTeams()
_userId = query.userId(recorder.getState())
data =
_teamId: @props.data.get('_id')
_userId: _userId
teamActions.teamLeave @props.data.get('_id'), data
re... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/team-settings.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/team-settings.coffee | 1 | 47 |
jashkenas/coffeescript:src/optparse.coffee:1:raw_corpus | raw_corpus | buildRules = (ruleDeclarations) ->
ruleList = for tuple in ruleDeclarations
tuple.unshift null if tuple.length < 3
buildRule tuple...
flagDict = {}
for rule in ruleList
# `shortFlag` is null if not provided in the rule.
for flag in [rule.shortFlag, rule.longFlag] when flag?
if flagDict[flag]... | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/optparse.coffee | 85 | 101 | ||
jashkenas/coffeescript:src/optparse.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
buildRules = (ruleDeclarations) ->
ruleList = for tuple in ruleDeclarations
tuple.unshift null if tuple.length < 3
buildRule tuple...
flagDict = {}
for rule in ruleList
# `shortFlag` is null if not provided in the rule.
for flag in [rule.sho... | var buildRules;
buildRules = function(ruleDeclarations) {
var flag, flagDict, i, j, len, len1, ref, rule, ruleList, tuple;
ruleList = (function() {
var i, len, results;
results = [];
for (i = 0, len = ruleDeclarations.length; i < len; i++) {
tuple = ruleDeclarations[i];
if (tuple.length < 3... | CoffeeScript | JavaScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/optparse.coffee | 85 | 101 |
jashkenas/coffeescript:src/optparse.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var buildRules;
buildRules = function(ruleDeclarations) {
var flag, flagDict, i, j, len, len1, ref, rule, ruleList, tuple;
ruleList = (function() {
var i, len, results;
results = [];
for (i = 0, len = ruleDeclarations.length; i < len; i++) {
... | buildRules = (ruleDeclarations) ->
ruleList = for tuple in ruleDeclarations
tuple.unshift null if tuple.length < 3
buildRule tuple...
flagDict = {}
for rule in ruleList
# `shortFlag` is null if not provided in the rule.
for flag in [rule.shortFlag, rule.longFlag] when flag?
if flagDict[flag]... | JavaScript | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/optparse.coffee | 85 | 101 |
jashkenas/coffeescript:src/optparse.coffee:1:completion | completion | buildRules = (ruleDeclarations) ->
ruleList = for tuple in ruleDeclarations
tuple.unshift null if tuple.length < 3
buildRule tuple...
flagDict = {}
for rule in ruleList
# `shortFlag` is null if not provided in the rule.
for flag in [rule.shortFlag, rule.longFlag] when flag? | if flagDict[flag]?
throw new Error "flag #{flag} for switch #{rule.name}
was already declared for switch #{flagDict[flag].name}"
flagDict[flag] = rule
{ruleList, flagDict}
# Build a rule from a `-o` short flag, a `--output [DIR]` long flag, and the
# description of what the option does. | CoffeeScript | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/optparse.coffee | 85 | 101 |
jashkenas/coffeescript:src/optparse.coffee:2:raw_corpus | raw_corpus | buildRule = (shortFlag, longFlag, description) ->
match = longFlag.match(OPTIONAL)
shortFlag = shortFlag?.match(SHORT_FLAG)[1]
longFlag = longFlag.match(LONG_FLAG)[1]
{
name: longFlag.replace /^--/, ''
shortFlag: shortFlag
longFlag: longFlag
description: description
hasA... | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/optparse.coffee | 102 | 113 | ||
jashkenas/coffeescript:src/optparse.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
buildRule = (shortFlag, longFlag, description) ->
match = longFlag.match(OPTIONAL)
shortFlag = shortFlag?.match(SHORT_FLAG)[1]
longFlag = longFlag.match(LONG_FLAG)[1]
{
name: longFlag.replace /^--/, ''
shortFlag: shortFlag
long... | var buildRule;
buildRule = function(shortFlag, longFlag, description) {
var match;
match = longFlag.match(OPTIONAL);
shortFlag = shortFlag != null ? shortFlag.match(SHORT_FLAG)[1] : void 0;
longFlag = longFlag.match(LONG_FLAG)[1];
return {
name: longFlag.replace(/^--/, ''),
shortFlag: shortFlag,
... | CoffeeScript | JavaScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/optparse.coffee | 102 | 113 |
jashkenas/coffeescript:src/optparse.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var buildRule;
buildRule = function(shortFlag, longFlag, description) {
var match;
match = longFlag.match(OPTIONAL);
shortFlag = shortFlag != null ? shortFlag.match(SHORT_FLAG)[1] : void 0;
longFlag = longFlag.match(LONG_FLAG)[1];
return {
name: long... | buildRule = (shortFlag, longFlag, description) ->
match = longFlag.match(OPTIONAL)
shortFlag = shortFlag?.match(SHORT_FLAG)[1]
longFlag = longFlag.match(LONG_FLAG)[1]
{
name: longFlag.replace /^--/, ''
shortFlag: shortFlag
longFlag: longFlag
description: description
hasA... | JavaScript | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/optparse.coffee | 102 | 113 |
jashkenas/coffeescript:src/optparse.coffee:3:raw_corpus | raw_corpus | normalizeArguments = (args, flagDict) ->
rules = []
positional = []
needsArgOpt = null
for arg, argIndex in args
# If the previous argument given to the script was an option that uses the
# next command-line argument as its argument, create copy of the option’s
# rule with an `argument` field.
i... | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/optparse.coffee | 115 | 164 | ||
jashkenas/coffeescript:src/optparse.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
normalizeArguments = (args, flagDict) ->
rules = []
positional = []
needsArgOpt = null
for arg, argIndex in args
# If the previous argument given to the script was an option that uses the
# next command-line argument as its argument, create copy o... | var normalizeArguments,
splice = [].splice;
normalizeArguments = function(args, flagDict) {
var arg, argIndex, flag, i, innerOpts, j, lastOpt, len, len1, multiFlags, multiOpts, needsArgOpt, positional, ref, rule, rules, singleRule, withArg;
rules = [];
positional = [];
needsArgOpt = null;
for (argIndex = i... | CoffeeScript | JavaScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/optparse.coffee | 115 | 164 |
jashkenas/coffeescript:src/optparse.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var normalizeArguments,
splice = [].splice;
normalizeArguments = function(args, flagDict) {
var arg, argIndex, flag, i, innerOpts, j, lastOpt, len, len1, multiFlags, multiOpts, needsArgOpt, positional, ref, rule, rules, singleRule, withArg;
rules = [];
pos... | normalizeArguments = (args, flagDict) ->
rules = []
positional = []
needsArgOpt = null
for arg, argIndex in args
# If the previous argument given to the script was an option that uses the
# next command-line argument as its argument, create copy of the option’s
# rule with an `argument` field.
i... | JavaScript | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/optparse.coffee | 115 | 164 |
jashkenas/coffeescript:src/optparse.coffee:3:completion | completion | normalizeArguments = (args, flagDict) ->
rules = []
positional = []
needsArgOpt = null
for arg, argIndex in args
# If the previous argument given to the script was an option that uses the
# next command-line argument as its argument, create copy of the option’s
# rule with an `argument` field.
i... | for {rule, flag} in innerOpts
if rule.hasArgument
throw new Error "cannot use option #{flag} in multi-flag #{arg} except
as the last option, because it needs an argument"
rules.push rule
if lastOpt.rule.hasArgument
needsArgOpt = lastOpt
else
rules.push las... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/optparse.coffee | 115 | 164 |
jashkenas/coffeescript:src/optparse.coffee:1:raw_corpus | raw_corpus | buildRules = (rules) ->
for tuple in rules
tuple.unshift null if tuple.length < 3
buildRule tuple...
# Build a rule from a `-o` short flag, a `--output [DIR]` long flag, and the
# description of what the option does. | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 31cd782ba7f14756eb974a30055f5e6c5e8f8102 | 16,577 | https://github.com/jashkenas/coffeescript/blob/31cd782ba7f14756eb974a30055f5e6c5e8f8102/src/optparse.coffee | 86 | 92 | ||
jashkenas/coffeescript:src/optparse.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
buildRules = (rules) ->
for tuple in rules
tuple.unshift null if tuple.length < 3
buildRule tuple...
# Build a rule from a `-o` short flag, a `--output [DIR]` long flag, and the
# description of what the option does.
``` | var buildRules;
buildRules = function(rules) {
var i, len, results, tuple;
results = [];
for (i = 0, len = rules.length; i < len; i++) {
tuple = rules[i];
if (tuple.length < 3) {
tuple.unshift(null);
}
results.push(buildRule(...tuple));
}
return results;
};
// Build a rule from a `-o` ... | CoffeeScript | JavaScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 31cd782ba7f14756eb974a30055f5e6c5e8f8102 | 16,577 | https://github.com/jashkenas/coffeescript/blob/31cd782ba7f14756eb974a30055f5e6c5e8f8102/src/optparse.coffee | 86 | 92 |
jashkenas/coffeescript:src/optparse.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var buildRules;
buildRules = function(rules) {
var i, len, results, tuple;
results = [];
for (i = 0, len = rules.length; i < len; i++) {
tuple = rules[i];
if (tuple.length < 3) {
tuple.unshift(null);
}
results.push(buildRule(...tuple));... | buildRules = (rules) ->
for tuple in rules
tuple.unshift null if tuple.length < 3
buildRule tuple...
# Build a rule from a `-o` short flag, a `--output [DIR]` long flag, and the
# description of what the option does. | JavaScript | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 31cd782ba7f14756eb974a30055f5e6c5e8f8102 | 16,577 | https://github.com/jashkenas/coffeescript/blob/31cd782ba7f14756eb974a30055f5e6c5e8f8102/src/optparse.coffee | 86 | 92 |
jashkenas/coffeescript:src/optparse.coffee:1:completion | completion | buildRules = (rules) ->
for tuple in rules
tuple.unshift null if tuple.length < 3 | buildRule tuple...
# Build a rule from a `-o` short flag, a `--output [DIR]` long flag, and the
# description of what the option does. | CoffeeScript | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 31cd782ba7f14756eb974a30055f5e6c5e8f8102 | 16,577 | https://github.com/jashkenas/coffeescript/blob/31cd782ba7f14756eb974a30055f5e6c5e8f8102/src/optparse.coffee | 86 | 92 |
jashkenas/coffeescript:src/optparse.coffee:2:raw_corpus | raw_corpus | buildRule = (shortFlag, longFlag, description, options = {}) ->
match = longFlag.match(OPTIONAL)
longFlag = longFlag.match(LONG_FLAG)[1]
{
name: longFlag.substr 2
shortFlag: shortFlag
longFlag: longFlag
description: description
hasArgument: !!(match and match[1])
isLi... | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 31cd782ba7f14756eb974a30055f5e6c5e8f8102 | 16,577 | https://github.com/jashkenas/coffeescript/blob/31cd782ba7f14756eb974a30055f5e6c5e8f8102/src/optparse.coffee | 93 | 106 | ||
jashkenas/coffeescript:src/optparse.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
buildRule = (shortFlag, longFlag, description, options = {}) ->
match = longFlag.match(OPTIONAL)
longFlag = longFlag.match(LONG_FLAG)[1]
{
name: longFlag.substr 2
shortFlag: shortFlag
longFlag: longFlag
description: desc... | var buildRule;
buildRule = function(shortFlag, longFlag, description, options = {}) {
var match;
match = longFlag.match(OPTIONAL);
longFlag = longFlag.match(LONG_FLAG)[1];
return {
name: longFlag.substr(2),
shortFlag: shortFlag,
longFlag: longFlag,
description: description,
hasArgument: !!(... | CoffeeScript | JavaScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 31cd782ba7f14756eb974a30055f5e6c5e8f8102 | 16,577 | https://github.com/jashkenas/coffeescript/blob/31cd782ba7f14756eb974a30055f5e6c5e8f8102/src/optparse.coffee | 93 | 106 |
jashkenas/coffeescript:src/optparse.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var buildRule;
buildRule = function(shortFlag, longFlag, description, options = {}) {
var match;
match = longFlag.match(OPTIONAL);
longFlag = longFlag.match(LONG_FLAG)[1];
return {
name: longFlag.substr(2),
shortFlag: shortFlag,
longFlag: longF... | buildRule = (shortFlag, longFlag, description, options = {}) ->
match = longFlag.match(OPTIONAL)
longFlag = longFlag.match(LONG_FLAG)[1]
{
name: longFlag.substr 2
shortFlag: shortFlag
longFlag: longFlag
description: description
hasArgument: !!(match and match[1])
isLi... | JavaScript | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 31cd782ba7f14756eb974a30055f5e6c5e8f8102 | 16,577 | https://github.com/jashkenas/coffeescript/blob/31cd782ba7f14756eb974a30055f5e6c5e8f8102/src/optparse.coffee | 93 | 106 |
jashkenas/coffeescript:src/optparse.coffee:2:completion | completion | buildRule = (shortFlag, longFlag, description, options = {}) ->
match = longFlag.match(OPTIONAL)
longFlag = longFlag.match(LONG_FLAG)[1]
{
name: longFlag.substr 2
shortFlag: shortFlag
longFlag: longFlag | description: description
hasArgument: !!(match and match[1])
isList: !!(match and match[2])
}
# Normalize arguments by expanding merged flags into multiple flags. This allows
# you to have `-wl` be the same as `--watch --lint`. | CoffeeScript | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 31cd782ba7f14756eb974a30055f5e6c5e8f8102 | 16,577 | https://github.com/jashkenas/coffeescript/blob/31cd782ba7f14756eb974a30055f5e6c5e8f8102/src/optparse.coffee | 93 | 106 |
jashkenas/coffeescript:src/optparse.coffee:3:raw_corpus | raw_corpus | normalizeArguments = (args) ->
args = args[..]
result = []
for arg in args
if match = arg.match MULTI_FLAG
result.push '-' + l for l in match[1].split ''
else
result.push arg
result | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 31cd782ba7f14756eb974a30055f5e6c5e8f8102 | 16,577 | https://github.com/jashkenas/coffeescript/blob/31cd782ba7f14756eb974a30055f5e6c5e8f8102/src/optparse.coffee | 107 | 115 | ||
jashkenas/coffeescript:src/optparse.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
normalizeArguments = (args) ->
args = args[..]
result = []
for arg in args
if match = arg.match MULTI_FLAG
result.push '-' + l for l in match[1].split ''
else
result.push arg
result
``` | var normalizeArguments;
normalizeArguments = function(args) {
var arg, i, j, l, len, len1, match, ref, result;
args = args.slice(0);
result = [];
for (i = 0, len = args.length; i < len; i++) {
arg = args[i];
if (match = arg.match(MULTI_FLAG)) {
ref = match[1].split('');
for (j = 0, len1 = r... | CoffeeScript | JavaScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 31cd782ba7f14756eb974a30055f5e6c5e8f8102 | 16,577 | https://github.com/jashkenas/coffeescript/blob/31cd782ba7f14756eb974a30055f5e6c5e8f8102/src/optparse.coffee | 107 | 115 |
jashkenas/coffeescript:src/optparse.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var normalizeArguments;
normalizeArguments = function(args) {
var arg, i, j, l, len, len1, match, ref, result;
args = args.slice(0);
result = [];
for (i = 0, len = args.length; i < len; i++) {
arg = args[i];
if (match = arg.match(MULTI_FLAG)) {
... | normalizeArguments = (args) ->
args = args[..]
result = []
for arg in args
if match = arg.match MULTI_FLAG
result.push '-' + l for l in match[1].split ''
else
result.push arg
result | JavaScript | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 31cd782ba7f14756eb974a30055f5e6c5e8f8102 | 16,577 | https://github.com/jashkenas/coffeescript/blob/31cd782ba7f14756eb974a30055f5e6c5e8f8102/src/optparse.coffee | 107 | 115 |
jashkenas/coffeescript:src/optparse.coffee:3:completion | completion | normalizeArguments = (args) ->
args = args[..]
result = []
for arg in args | if match = arg.match MULTI_FLAG
result.push '-' + l for l in match[1].split ''
else
result.push arg
result | CoffeeScript | CoffeeScript | jashkenas/coffeescript | src/optparse.coffee | MIT | 31cd782ba7f14756eb974a30055f5e6c5e8f8102 | 16,577 | https://github.com/jashkenas/coffeescript/blob/31cd782ba7f14756eb974a30055f5e6c5e8f8102/src/optparse.coffee | 107 | 115 |
jianliaoim/talk-os:talk-web/client/app/notify-center.coffee:1:raw_corpus | raw_corpus | module.exports = React.createClass
displayName: 'notify-center'
mixins: [mixinSubscribe, PureRenderMixin]
propTypes:
router: T.instanceOf(Immutable.Map).isRequired
getInitialState: ->
messages: @getMessages()
needUpgrade: false
noAutoUpgrade: false
prefs: @getPrefs()
componentDidMount: ... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/notify-center.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/notify-center.coffee | 35 | 84 | ||
jianliaoim/talk-os:talk-web/client/app/notify-center.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = React.createClass
displayName: 'notify-center'
mixins: [mixinSubscribe, PureRenderMixin]
propTypes:
router: T.instanceOf(Immutable.Map).isRequired
getInitialState: ->
messages: @getMessages()
needUpgrade: false
noAutoUpg... | module.exports = React.createClass({
displayName: 'notify-center',
mixins: [mixinSubscribe, PureRenderMixin],
propTypes: {
router: T.instanceOf(Immutable.Map).isRequired
},
getInitialState: function() {
return {
messages: this.getMessages(),
needUpgrade: false,
noAutoUpgrade: false,
... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/notify-center.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/notify-center.coffee | 35 | 84 |
jianliaoim/talk-os:talk-web/client/app/notify-center.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = React.createClass({
displayName: 'notify-center',
mixins: [mixinSubscribe, PureRenderMixin],
propTypes: {
router: T.instanceOf(Immutable.Map).isRequired
},
getInitialState: function() {
return {
messages: this.getMessages(),... | module.exports = React.createClass
displayName: 'notify-center'
mixins: [mixinSubscribe, PureRenderMixin]
propTypes:
router: T.instanceOf(Immutable.Map).isRequired
getInitialState: ->
messages: @getMessages()
needUpgrade: false
noAutoUpgrade: false
prefs: @getPrefs()
componentDidMount: ... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/notify-center.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/notify-center.coffee | 35 | 84 |
jianliaoim/talk-os:talk-web/client/app/notify-center.coffee:1:completion | completion | module.exports = React.createClass
displayName: 'notify-center'
mixins: [mixinSubscribe, PureRenderMixin]
propTypes:
router: T.instanceOf(Immutable.Map).isRequired
getInitialState: ->
messages: @getMessages()
needUpgrade: false
noAutoUpgrade: false
prefs: @getPrefs()
componentDidMount: ... | componentWillUnmount: ->
socket.off 'message:create', @onMessageCreate
getMessages: ->
query.notices(recorder.getState())
getPrefs: ->
query.prefs(recorder.getState()) or Immutable.Map()
detectNotification: ->
if @state.prefs.get('desktopNotification')
window.Notification?.requestPermissi... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/notify-center.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/notify-center.coffee | 35 | 84 |
jianliaoim/talk-os:talk-web/client/app/notify-center.coffee:2:raw_corpus | raw_corpus | focus: ->
window.focus()
eventBus.emit 'dirty/force-read'
onMessageCreate: (data) ->
return if not @state.prefs.get('desktopNotification')
return if detect.isPageFocused()
return if data.isSystem
_teamId = data._teamId
_channelId = lookup.getMessageChannelId(Immutable.fromJS(data))
r... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/notify-center.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/notify-center.coffee | 85 | 134 | ||
jianliaoim/talk-os:talk-web/client/app/notify-center.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
focus: ->
window.focus()
eventBus.emit 'dirty/force-read'
onMessageCreate: (data) ->
return if not @state.prefs.get('desktopNotification')
return if detect.isPageFocused()
return if data.isSystem
_teamId = data._teamId
_channelId =... | ({
focus: function() {
window.focus();
return eventBus.emit('dirty/force-read');
},
onMessageCreate: function(data) {
var _channelId, _teamId, _userId, content, ref, team, teamName;
if (!this.state.prefs.get('desktopNotification')) {
return;
}
if (detect.isPageFocused()) {
retu... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/notify-center.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/notify-center.coffee | 85 | 134 |
jianliaoim/talk-os:talk-web/client/app/notify-center.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
focus: function() {
window.focus();
return eventBus.emit('dirty/force-read');
},
onMessageCreate: function(data) {
var _channelId, _teamId, _userId, content, ref, team, teamName;
if (!this.state.prefs.get('desktopNotification')) {
ret... | focus: ->
window.focus()
eventBus.emit 'dirty/force-read'
onMessageCreate: (data) ->
return if not @state.prefs.get('desktopNotification')
return if detect.isPageFocused()
return if data.isSystem
_teamId = data._teamId
_channelId = lookup.getMessageChannelId(Immutable.fromJS(data))
r... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/notify-center.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/notify-center.coffee | 85 | 134 |
jianliaoim/talk-os:talk-web/client/app/notify-center.coffee:2:completion | completion | focus: ->
window.focus()
eventBus.emit 'dirty/force-read'
onMessageCreate: (data) ->
return if not @state.prefs.get('desktopNotification')
return if detect.isPageFocused()
return if data.isSystem
_teamId = data._teamId
_channelId = lookup.getMessageChannelId(Immutable.fromJS(data))
r... | notify.desktop content, =>
@focus()
return if config.isGuest
routerHandlers.room data._teamId, data._roomId
else if data._storyId?
if @state.prefs.get('notifyOnRelated')
return unless detect.userInContent data.body, _userId
content = assemble.notification data, teamName
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/notify-center.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/notify-center.coffee | 85 | 134 |
jianliaoim/talk-os:talk-web/client/app/notify-center.coffee:3:raw_corpus | raw_corpus | renderItem: (data) ->
iconName =
switch data.get('type')
when 'success' then 'tick-circle-solid'
when 'error' then 'remove-circle-solid'
when 'info' then 'info-solid'
when 'warn' then 'alert-circle-solid'
onRemove = => @onRemove(data)
div className: "item ... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/notify-center.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/notify-center.coffee | 135 | 161 | ||
jianliaoim/talk-os:talk-web/client/app/notify-center.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
renderItem: (data) ->
iconName =
switch data.get('type')
when 'success' then 'tick-circle-solid'
when 'error' then 'remove-circle-solid'
when 'info' then 'info-solid'
when 'warn' then 'alert-circle-solid'
... | ({
renderItem: function(data) {
var iconName, onRemove;
iconName = (function() {
switch (data.get('type')) {
case 'success':
return 'tick-circle-solid';
case 'error':
return 'remove-circle-solid';
case 'info':
return 'info-solid';
case 'warn'... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/notify-center.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/notify-center.coffee | 135 | 161 |
jianliaoim/talk-os:talk-web/client/app/notify-center.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
renderItem: function(data) {
var iconName, onRemove;
iconName = (function() {
switch (data.get('type')) {
case 'success':
return 'tick-circle-solid';
case 'error':
return 'remove-circle-solid';
case 'in... | renderItem: (data) ->
iconName =
switch data.get('type')
when 'success' then 'tick-circle-solid'
when 'error' then 'remove-circle-solid'
when 'info' then 'info-solid'
when 'warn' then 'alert-circle-solid'
onRemove = => @onRemove(data)
div className: "item ... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/notify-center.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/notify-center.coffee | 135 | 161 |
jianliaoim/talk-os:talk-web/client/app/notify-center.coffee:3:completion | completion | renderItem: (data) ->
iconName =
switch data.get('type')
when 'success' then 'tick-circle-solid'
when 'error' then 'remove-circle-solid'
when 'info' then 'info-solid'
when 'warn' then 'alert-circle-solid'
onRemove = => @onRemove(data)
div className: "item ... | if data.getIn(['config', 'isSticky'])
span className: 'ti ti-remove', onClick: onRemove
render: ->
div className: 'notify-center',
# disabled animtion temporarily due to the bugs
# https://github.com/facebook/react/issues/1326
React.createElement Transition, className: 'notify-containe... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/notify-center.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/notify-center.coffee | 135 | 161 |
jianliaoim/talk-os:talk-api2x/server/observers/story.coffee:1:raw_corpus | raw_corpus | Promise = require 'bluebird'
limbo = require 'limbo'
logger = require 'graceful-logger'
util = require '../util'
{socket} = require '../components'
{
StoryModel
SearchStoryModel
MemberModel
} = limbo.use 'talk'
###*
* Broadcast new event through websocket
###
_broadcast = (story, event) ->
channels = story.... | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/observers/story.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/observers/story.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-api2x/server/observers/story.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Promise = require 'bluebird'
limbo = require 'limbo'
logger = require 'graceful-logger'
util = require '../util'
{socket} = require '../components'
{
StoryModel
SearchStoryModel
MemberModel
} = limbo.use 'talk'
###*
* Broadcast new event through websock... | /**
* Broadcast new event through websocket
*/
var MemberModel, Promise, SearchStoryModel, StoryModel, StorySchema, _broadcast, limbo, logger, socket, util;
Promise = require('bluebird');
limbo = require('limbo');
logger = require('graceful-logger');
util = require('../util');
({socket} = require('../components'... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/server/observers/story.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/observers/story.coffee | 1 | 50 |
jianliaoim/talk-os:talk-api2x/server/observers/story.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/**
* Broadcast new event through websocket
*/
var MemberModel, Promise, SearchStoryModel, StoryModel, StorySchema, _broadcast, limbo, logger, socket, util;
Promise = require('bluebird');
limbo = require('limbo');
logger = require('graceful-logger');
util = r... | Promise = require 'bluebird'
limbo = require 'limbo'
logger = require 'graceful-logger'
util = require '../util'
{socket} = require '../components'
{
StoryModel
SearchStoryModel
MemberModel
} = limbo.use 'talk'
###*
* Broadcast new event through websocket
###
_broadcast = (story, event) ->
channels = story.... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/observers/story.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/observers/story.coffee | 1 | 50 |
jianliaoim/talk-os:talk-api2x/server/observers/story.coffee:1:completion | completion | Promise = require 'bluebird'
limbo = require 'limbo'
logger = require 'graceful-logger'
util = require '../util'
{socket} = require '../components'
{
StoryModel
SearchStoryModel
MemberModel
} = limbo.use 'talk'
###*
* Broadcast new event through websocket
###
_broadcast = (story, event) ->
channels = story.... | # Broadcast story:update event
@_wasModified = ['category', 'data', 'members'].some (field) ->
story.isDirectModified field
if @isNew
# Add creator as the first member
story = this
hasCreator = story._memberIds.some (_memberId) -> "#{_memberId}" is "#{story._creatorId}"
story.members.push story... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/observers/story.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/observers/story.coffee | 1 | 50 |
jianliaoim/talk-os:talk-api2x/server/observers/story.coffee:2:raw_corpus | raw_corpus | # Index story search data
story.indexSearch()
StorySchema.post 'updated', (story) ->
$story = story.getPopulatedAsync()
$story.then (story) -> _broadcast story, 'story:update'
return # @osv
# Index story search data
story.indexSearch()
StorySchema.post 'remove', (story) ->
_broadcast story, 'story:remov... | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/observers/story.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/observers/story.coffee | 51 | 65 | ||
jianliaoim/talk-os:talk-api2x/server/observers/story.coffee:2:completion | completion | # Index story search data
story.indexSearch()
StorySchema.post 'updated', (story) ->
$story = story.getPopulatedAsync()
$story.then (story) -> _broadcast story, 'story:update'
return # @osv | # Index story search data
story.indexSearch()
StorySchema.post 'remove', (story) ->
_broadcast story, 'story:remove'
return # @osv
# unIndex story search data
story.unIndexSearch() | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/observers/story.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/observers/story.coffee | 51 | 65 |
jianliaoim/talk-os:talk-web/test/spec/util/time.spec.coffee:1:raw_corpus | raw_corpus | describe 'util: time', ->
beforeEach ->
@time = require 'util/time'
describe 'function: notSameDay', ->
it 'should return false if two dates are the same day', ->
a = '2016-01-18T09:11:50.746Z'
b = '2016-01-18T09:11:50.746Z'
expect(@time.notSameDay(a, b)).toEqual false
it 'should re... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/util/time.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/time.spec.coffee | 1 | 34 | ||
jianliaoim/talk-os:talk-web/test/spec/util/time.spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'util: time', ->
beforeEach ->
@time = require 'util/time'
describe 'function: notSameDay', ->
it 'should return false if two dates are the same day', ->
a = '2016-01-18T09:11:50.746Z'
b = '2016-01-18T09:11:50.746Z'
expect... | describe('util: time', function() {
beforeEach(function() {
return this.time = require('util/time');
});
return describe('function: notSameDay', function() {
it('should return false if two dates are the same day', function() {
var a, b;
a = '2016-01-18T09:11:50.746Z';
b = '2016-01-18T09:... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/test/spec/util/time.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/time.spec.coffee | 1 | 34 |
jianliaoim/talk-os:talk-web/test/spec/util/time.spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('util: time', function() {
beforeEach(function() {
return this.time = require('util/time');
});
return describe('function: notSameDay', function() {
it('should return false if two dates are the same day', function() {
var a, b;
a ... | describe 'util: time', ->
beforeEach ->
@time = require 'util/time'
describe 'function: notSameDay', ->
it 'should return false if two dates are the same day', ->
a = '2016-01-18T09:11:50.746Z'
b = '2016-01-18T09:11:50.746Z'
expect(@time.notSameDay(a, b)).toEqual false
it 'should re... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/util/time.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/time.spec.coffee | 1 | 34 |
jianliaoim/talk-os:talk-web/test/spec/util/time.spec.coffee:1:completion | completion | describe 'util: time', ->
beforeEach ->
@time = require 'util/time'
describe 'function: notSameDay', ->
it 'should return false if two dates are the same day', ->
a = '2016-01-18T09:11:50.746Z'
b = '2016-01-18T09:11:50.746Z'
expect(@time.notSameDay(a, b)).toEqual false
it 'should re... | a = '2016-01-18T09:11:50.746Z'
b = '2016-02-18T09:11:50.746Z'
expect(@time.notSameDay(a, b)).toEqual true
it 'should return true if two dates are not the same month', ->
a = '2016-01-18T09:11:50.746Z'
b = '2017-02-18T09:11:50.746Z'
expect(@time.notSameDay(a, b)).toEqual true
it '... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/util/time.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/time.spec.coffee | 1 | 34 |
jianliaoim/talk-os:talk-web/client/app/roster-management.coffee:1:raw_corpus | raw_corpus | module.exports = React.createClass
displayName: 'roster-management'
mixins: [ mixinQuery, mixinSubscribe, mixinUser, PureRenderMixin ]
propTypes:
_teamId: T.string.isRequired
onClose: T.func
onSubmit: T.func
isRemovable: T.bool
selectedContacts: T.instanceOf Immutable.List
getDefaultProps:... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/roster-management.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/roster-management.coffee | 22 | 71 | ||
jianliaoim/talk-os:talk-web/client/app/roster-management.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = React.createClass
displayName: 'roster-management'
mixins: [ mixinQuery, mixinSubscribe, mixinUser, PureRenderMixin ]
propTypes:
_teamId: T.string.isRequired
onClose: T.func
onSubmit: T.func
isRemovable: T.bool
selected... | module.exports = React.createClass({
displayName: 'roster-management',
mixins: [mixinQuery, mixinSubscribe, mixinUser, PureRenderMixin],
propTypes: {
_teamId: T.string.isRequired,
onClose: T.func,
onSubmit: T.func,
isRemovable: T.bool,
selectedContacts: T.instanceOf(Immutable.List)
},
getD... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/roster-management.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/roster-management.coffee | 22 | 71 |
jianliaoim/talk-os:talk-web/client/app/roster-management.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = React.createClass({
displayName: 'roster-management',
mixins: [mixinQuery, mixinSubscribe, mixinUser, PureRenderMixin],
propTypes: {
_teamId: T.string.isRequired,
onClose: T.func,
onSubmit: T.func,
isRemovable: T.bool,
sel... | module.exports = React.createClass
displayName: 'roster-management'
mixins: [ mixinQuery, mixinSubscribe, mixinUser, PureRenderMixin ]
propTypes:
_teamId: T.string.isRequired
onClose: T.func
onSubmit: T.func
isRemovable: T.bool
selectedContacts: T.instanceOf Immutable.List
getDefaultProps:... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/roster-management.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/roster-management.coffee | 22 | 71 |
jianliaoim/talk-os:talk-web/client/app/roster-management.coffee:1:completion | completion | module.exports = React.createClass
displayName: 'roster-management'
mixins: [ mixinQuery, mixinSubscribe, mixinUser, PureRenderMixin ]
propTypes:
_teamId: T.string.isRequired
onClose: T.func
onSubmit: T.func
isRemovable: T.bool
selectedContacts: T.instanceOf Immutable.List
getDefaultProps:... | @subscribe recorder, =>
contacts = @getInitialContacts()
groups =@getInitialGroups()
@setState
groups: groups
contacts: contacts
getInitialContacts: ->
@getContacts()
.filterNot refine.byId @getUserId()
.sortBy reorder.byPinyin
.sortBy reorder.byRobot
.sortBy (c... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/roster-management.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/roster-management.coffee | 22 | 71 |
jianliaoim/talk-os:talk-web/client/app/roster-management.coffee:2:raw_corpus | raw_corpus | .map (contact) ->
contact.get '_id'
Immutable.fromJS
_id: 'all'
_memberIds: _memberIds
name: lang.getText 'everybody'
handleSelectContact: (contact) ->
targetId = contact.get '_id'
selectedContacts = @state.selectedContacts
isStatic = not @props.isRemovable and @staticSelects... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/roster-management.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/roster-management.coffee | 72 | 121 | ||
jianliaoim/talk-os:talk-web/client/app/roster-management.coffee:2:completion | completion | .map (contact) ->
contact.get '_id'
Immutable.fromJS
_id: 'all'
_memberIds: _memberIds
name: lang.getText 'everybody'
handleSelectContact: (contact) ->
targetId = contact.get '_id'
selectedContacts = @state.selectedContacts
isStatic = not @props.isRemovable and @staticSelects... | targetId = targetGroup.get '_id'
selectedGroups = @state.selectedGroups
selectedContacts = @state.selectedContacts
if selectedGroups.includes targetId
selectedGroups = selectedGroups.filterNot (id) ->
id is targetId
selectedContacts = selectedContacts.filterNot (id) =>
isStatic ... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/roster-management.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/roster-management.coffee | 72 | 121 |
jianliaoim/talk-os:talk-web/client/app/roster-management.coffee:3:raw_corpus | raw_corpus | handleSubmit: ->
@props.onSubmit @state.selectedContacts
@props.onClose()
renderFooter: ->
div className: 'footer',
span className: 'button', onClick: @handleSubmit, lang.getText('confirm')
renderSearchList: ->
SearchList
_teamId: @props._teamId
contacts: @state.contacts
gr... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/roster-management.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/roster-management.coffee | 122 | 145 | ||
jianliaoim/talk-os:talk-web/client/app/roster-management.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
handleSubmit: ->
@props.onSubmit @state.selectedContacts
@props.onClose()
renderFooter: ->
div className: 'footer',
span className: 'button', onClick: @handleSubmit, lang.getText('confirm')
renderSearchList: ->
SearchList
_teamId... | ({
handleSubmit: function() {
this.props.onSubmit(this.state.selectedContacts);
return this.props.onClose();
},
renderFooter: function() {
return div({
className: 'footer'
}, span({
className: 'button',
onClick: this.handleSubmit
}, lang.getText('confirm')));
},
renderSea... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/roster-management.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/roster-management.coffee | 122 | 145 |
jianliaoim/talk-os:talk-web/client/app/roster-management.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
handleSubmit: function() {
this.props.onSubmit(this.state.selectedContacts);
return this.props.onClose();
},
renderFooter: function() {
return div({
className: 'footer'
}, span({
className: 'button',
onClick: this.handleSu... | handleSubmit: ->
@props.onSubmit @state.selectedContacts
@props.onClose()
renderFooter: ->
div className: 'footer',
span className: 'button', onClick: @handleSubmit, lang.getText('confirm')
renderSearchList: ->
SearchList
_teamId: @props._teamId
contacts: @state.contacts
gr... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/roster-management.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/roster-management.coffee | 122 | 145 |
jianliaoim/talk-os:talk-web/client/app/roster-management.coffee:3:completion | completion | handleSubmit: ->
@props.onSubmit @state.selectedContacts
@props.onClose()
renderFooter: ->
div className: 'footer',
span className: 'button', onClick: @handleSubmit, lang.getText('confirm')
renderSearchList: ->
SearchList
_teamId: @props._teamId
contacts: @state.contacts | groups: @state.groups
selectedContacts: @state.selectedContacts
selectedGroups: @state.selectedGroups
onContactClick: @handleSelectContact
onGroupClick: @handleSelectGroup
locale: lang.getText('search-members')
placeholder: lang.getText('no-contact-result')
render: ->
div clas... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/roster-management.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/roster-management.coffee | 122 | 145 |
discolabs/cartjs:src/rivets.coffee:1:raw_corpus | raw_corpus | # CartJS.Rivets
# Adds Rivets.js functionality to CartJS if Rivets.js is available.
# -----------------------------------------------------------------
if rivets?
# Rivets.js has been loaded, so declare the CartJS.Rivets module.
CartJS.Rivets =
# Maintain a reference to the base model object so that we can r... | CoffeeScript | discolabs/cartjs | src/rivets.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/rivets.coffee | 1 | 39 | ||
discolabs/cartjs:src/rivets.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# CartJS.Rivets
# Adds Rivets.js functionality to CartJS if Rivets.js is available.
# -----------------------------------------------------------------
if rivets?
# Rivets.js has been loaded, so declare the CartJS.Rivets module.
CartJS.Rivets =
# Maint... | // CartJS.Rivets
// Adds Rivets.js functionality to CartJS if Rivets.js is available.
// -----------------------------------------------------------------
if (typeof rivets !== "undefined" && rivets !== null) {
// Rivets.js has been loaded, so declare the CartJS.Rivets module.
CartJS.Rivets = {
// Maintain a re... | CoffeeScript | JavaScript | discolabs/cartjs | src/rivets.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/rivets.coffee | 1 | 39 |
discolabs/cartjs:src/rivets.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// CartJS.Rivets
// Adds Rivets.js functionality to CartJS if Rivets.js is available.
// -----------------------------------------------------------------
if (typeof rivets !== "undefined" && rivets !== null) {
// Rivets.js has been loaded, so declare the CartJS.... | # CartJS.Rivets
# Adds Rivets.js functionality to CartJS if Rivets.js is available.
# -----------------------------------------------------------------
if rivets?
# Rivets.js has been loaded, so declare the CartJS.Rivets module.
CartJS.Rivets =
# Maintain a reference to the base model object so that we can r... | JavaScript | CoffeeScript | discolabs/cartjs | src/rivets.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/rivets.coffee | 1 | 39 |
discolabs/cartjs:src/rivets.coffee:1:completion | completion | # CartJS.Rivets
# Adds Rivets.js functionality to CartJS if Rivets.js is available.
# -----------------------------------------------------------------
if rivets?
# Rivets.js has been loaded, so declare the CartJS.Rivets module.
CartJS.Rivets =
# Maintain a reference to the base model object so that we can r... | # Tear down the Rivets module.
destroy: () ->
CartJS.Rivets.unbindViews()
# Bind all Rivets.js view elements that are currently present on the page.
bindViews: () ->
CartJS.Utils.log('Rivets.js is present, binding views.')
# Unbind any currently bound views.
CartJS.Rivets.unbindVie... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/rivets.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/rivets.coffee | 1 | 39 |
discolabs/cartjs:src/rivets.coffee:2:raw_corpus | raw_corpus | # Iterate through and bind all elements marked as Rivets.js views via the [data-cart-view] attribute.
jQuery('[data-cart-view]').each () ->
view = rivets.bind(jQuery(this), CartJS.Rivets.model)
CartJS.Rivets.boundViews.push(view)
# Unbind all currently bound Rivets.js views.
unbindViews: ... | CoffeeScript | discolabs/cartjs | src/rivets.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/rivets.coffee | 41 | 81 | ||
discolabs/cartjs:src/rivets.coffee:2:completion | completion | # Iterate through and bind all elements marked as Rivets.js views via the [data-cart-view] attribute.
jQuery('[data-cart-view]').each () ->
view = rivets.bind(jQuery(this), CartJS.Rivets.model)
CartJS.Rivets.boundViews.push(view)
# Unbind all currently bound Rivets.js views.
unbindViews: ... | rivets.formatters.lt = (a, b) ->
a < b
rivets.formatters.gt = (a, b) ->
a > b
rivets.formatters.not = (a) ->
!a
rivets.formatters.empty = (a) ->
!a.length
rivets.formatters.plus = (a, b) ->
parseInt(a) + parseInt(b)
rivets.formatters.minus = (a, b) ->
parseInt(a) - parseInt(b)
... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/rivets.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/rivets.coffee | 41 | 81 |
discolabs/cartjs:src/rivets.coffee:3:raw_corpus | raw_corpus | rivets.formatters.divided_by = (a, b) ->
a / b
rivets.formatters.modulo = (a, b) ->
a % b
rivets.formatters.prepend = (a, b) ->
b + a
rivets.formatters.append = (a, b) ->
a + b
rivets.formatters.slice = (value, start, end) ->
value.slice(start, end)
rivets.formatters.pluralize = (inpu... | CoffeeScript | discolabs/cartjs | src/rivets.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/rivets.coffee | 83 | 123 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.