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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jianliaoim/talk-os:talk-web/client/module/light-checkbox.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PureRenderMixin, React, T, cx, div, span;
React = require('react');
PureRenderMixin = require('react-addons-pure-render-mixin');
div = React.createFactory('div');
span = React.createFactory('span');
T = React.PropTypes;
cx = require('classnames');
module... | React = require 'react'
PureRenderMixin = require 'react-addons-pure-render-mixin'
div = React.createFactory 'div'
span = React.createFactory 'span'
T = React.PropTypes
cx = require 'classnames'
module.exports = React.createClass
displayName: 'light-checkbox'
mixins: [PureRenderMixin]
propTypes:
checked: ... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/light-checkbox.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/light-checkbox.coffee | 1 | 43 |
jianliaoim/talk-os:talk-web/client/module/light-checkbox.coffee:1:completion | completion | React = require 'react'
PureRenderMixin = require 'react-addons-pure-render-mixin'
div = React.createFactory 'div'
span = React.createFactory 'span'
T = React.PropTypes
cx = require 'classnames'
module.exports = React.createClass
displayName: 'light-checkbox'
mixins: [PureRenderMixin]
propTypes:
checked: ... | onClick: ->
@props.onClick @props.event
onMouseEnter: ->
@setState open: true
onMouseLeave: ->
@setState open: false
render: ->
iconClass = cx
ti: true
'ti-tick': @props.checked
div className: 'light-checkbox line', onClick: @onClick, onMouseEnter: @onMouseEnter, onMouseLeave: ... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/light-checkbox.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/light-checkbox.coffee | 1 | 43 |
jeremyramin/terminal-plus:lib/panel.coffee:2:raw_corpus | raw_corpus | class TerminalPlusPanel extends View
@content: ->
@div class: 'terminal-plus-panel inline-block', =>
@span outlet: 'termStatusContainer', =>
@span click: 'newTermClick', class: "icon icon-plus"
commandViews: []
activeIndex: 0
initialize: (serializeState) ->
getSelectedText = () ->
... | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | a25930e8e3e1bd215cac0e81f26eb806c456220e | 478 | https://github.com/jeremyramin/terminal-plus/blob/a25930e8e3e1bd215cac0e81f26eb806c456220e/lib/panel.coffee | 5 | 54 | ||
jeremyramin/terminal-plus:lib/panel.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class TerminalPlusPanel extends View
@content: ->
@div class: 'terminal-plus-panel inline-block', =>
@span outlet: 'termStatusContainer', =>
@span click: 'newTermClick', class: "icon icon-plus"
commandViews: []
activeIndex: 0
initialize... | var TerminalPlusPanel;
TerminalPlusPanel = (function() {
class TerminalPlusPanel extends View {
static content() {
return this.div({
class: 'terminal-plus-panel inline-block'
}, () => {
return this.span({
outlet: 'termStatusContainer'
}, () => {
return this... | CoffeeScript | JavaScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | a25930e8e3e1bd215cac0e81f26eb806c456220e | 478 | https://github.com/jeremyramin/terminal-plus/blob/a25930e8e3e1bd215cac0e81f26eb806c456220e/lib/panel.coffee | 5 | 54 |
jeremyramin/terminal-plus:lib/panel.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TerminalPlusPanel;
TerminalPlusPanel = (function() {
class TerminalPlusPanel extends View {
static content() {
return this.div({
class: 'terminal-plus-panel inline-block'
}, () => {
return this.span({
outlet: 'termSt... | class TerminalPlusPanel extends View
@content: ->
@div class: 'terminal-plus-panel inline-block', =>
@span outlet: 'termStatusContainer', =>
@span click: 'newTermClick', class: "icon icon-plus"
commandViews: []
activeIndex: 0
initialize: (serializeState) ->
getSelectedText = () ->
... | JavaScript | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | a25930e8e3e1bd215cac0e81f26eb806c456220e | 478 | https://github.com/jeremyramin/terminal-plus/blob/a25930e8e3e1bd215cac0e81f26eb806c456220e/lib/panel.coffee | 5 | 54 |
jeremyramin/terminal-plus:lib/panel.coffee:2:completion | completion | class TerminalPlusPanel extends View
@content: ->
@div class: 'terminal-plus-panel inline-block', =>
@span outlet: 'termStatusContainer', =>
@span click: 'newTermClick', class: "icon icon-plus"
commandViews: []
activeIndex: 0
initialize: (serializeState) ->
getSelectedText = () ->
... | 'terminal-plus:reload-config': => @runInCurrentView (i) ->
i.clear()
i.reloadSettings()
i.clear()
'terminal-plus:open-config': => @runInCurrentView (i) ->
i.showSettings()
@createCommandView()
@attach()
createCommandView: ->
termStatus = $('<span class="icon icon-te... | CoffeeScript | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | a25930e8e3e1bd215cac0e81f26eb806c456220e | 478 | https://github.com/jeremyramin/terminal-plus/blob/a25930e8e3e1bd215cac0e81f26eb806c456220e/lib/panel.coffee | 5 | 54 |
jeremyramin/terminal-plus:lib/panel.coffee:3:raw_corpus | raw_corpus | @termStatusContainer.append termStatus
return terminalPlusView
activeNextCommandView: ->
@activeCommandView @activeIndex + 1
activePrevCommandView: ->
@activeCommandView @activeIndex - 1
activeCommandView: (index) ->
if index >= @commandViews.length
index = 0
if index < 0
index ... | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | a25930e8e3e1bd215cac0e81f26eb806c456220e | 478 | https://github.com/jeremyramin/terminal-plus/blob/a25930e8e3e1bd215cac0e81f26eb806c456220e/lib/panel.coffee | 55 | 104 | ||
jeremyramin/terminal-plus:lib/panel.coffee:3:completion | completion | @termStatusContainer.append termStatus
return terminalPlusView
activeNextCommandView: ->
@activeCommandView @activeIndex + 1
activePrevCommandView: ->
@activeCommandView @activeIndex - 1
activeCommandView: (index) ->
if index >= @commandViews.length
index = 0
if index < 0
index ... | return null
getForcedActiveCommandView: () ->
if @getActiveCommandView() != null && @getActiveCommandView() != undefined
return @getActiveCommandView()
ret = @activeCommandView(0)
@toggle()
return ret
setActiveCommandView: (commandView) ->
@activeIndex = @commandViews.indexOf commandView... | CoffeeScript | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | a25930e8e3e1bd215cac0e81f26eb806c456220e | 478 | https://github.com/jeremyramin/terminal-plus/blob/a25930e8e3e1bd215cac0e81f26eb806c456220e/lib/panel.coffee | 55 | 104 |
jeremyramin/terminal-plus:lib/panel.coffee:4:raw_corpus | raw_corpus | closeAll: ->
for index in [@commandViews.length .. 0]
o = @commandViews[index]
if o?
o.close()
# Tear down any state and detach
destroy: ->
for view in @commandViews
view.ptyProcess.terminate()
view.terminal.destroy()
@detach()
toggle: ->
@createCommandView() unle... | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | a25930e8e3e1bd215cac0e81f26eb806c456220e | 478 | https://github.com/jeremyramin/terminal-plus/blob/a25930e8e3e1bd215cac0e81f26eb806c456220e/lib/panel.coffee | 105 | 120 | ||
jeremyramin/terminal-plus:lib/panel.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
closeAll: ->
for index in [@commandViews.length .. 0]
o = @commandViews[index]
if o?
o.close()
# Tear down any state and detach
destroy: ->
for view in @commandViews
view.ptyProcess.terminate()
view.terminal.destroy()
... | ({
closeAll: function() {
var i, index, o, ref, results;
results = [];
for (index = i = ref = this.commandViews.length; (ref <= 0 ? i <= 0 : i >= 0); index = ref <= 0 ? ++i : --i) {
o = this.commandViews[index];
if (o != null) {
results.push(o.close());
} else {
results.p... | CoffeeScript | JavaScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | a25930e8e3e1bd215cac0e81f26eb806c456220e | 478 | https://github.com/jeremyramin/terminal-plus/blob/a25930e8e3e1bd215cac0e81f26eb806c456220e/lib/panel.coffee | 105 | 120 |
jeremyramin/terminal-plus:lib/panel.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
closeAll: function() {
var i, index, o, ref, results;
results = [];
for (index = i = ref = this.commandViews.length; (ref <= 0 ? i <= 0 : i >= 0); index = ref <= 0 ? ++i : --i) {
o = this.commandViews[index];
if (o != null) {
re... | closeAll: ->
for index in [@commandViews.length .. 0]
o = @commandViews[index]
if o?
o.close()
# Tear down any state and detach
destroy: ->
for view in @commandViews
view.ptyProcess.terminate()
view.terminal.destroy()
@detach()
toggle: ->
@createCommandView() unle... | JavaScript | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | a25930e8e3e1bd215cac0e81f26eb806c456220e | 478 | https://github.com/jeremyramin/terminal-plus/blob/a25930e8e3e1bd215cac0e81f26eb806c456220e/lib/panel.coffee | 105 | 120 |
jeremyramin/terminal-plus:lib/panel.coffee:4:completion | completion | closeAll: ->
for index in [@commandViews.length .. 0]
o = @commandViews[index]
if o?
o.close()
# Tear down any state and detach
destroy: -> | for view in @commandViews
view.ptyProcess.terminate()
view.terminal.destroy()
@detach()
toggle: ->
@createCommandView() unless @commandViews[@activeIndex]?
@commandViews[@activeIndex].toggle() | CoffeeScript | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | a25930e8e3e1bd215cac0e81f26eb806c456220e | 478 | https://github.com/jeremyramin/terminal-plus/blob/a25930e8e3e1bd215cac0e81f26eb806c456220e/lib/panel.coffee | 105 | 120 |
jeremyramin/terminal-plus:lib/panel.coffee:4:raw_corpus | raw_corpus | closeAll: ->
for index in [@commandViews.length .. 0]
o = @commandViews[index]
if o?
o.close()
# Tear down any state and detach
destroy: ->
for index in [@commandViews.length .. 0]
@removeCommandView @commandViews[index]
@detach()
toggle: ->
@createCommandView() unless ... | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | 15a422034df6c2f5a0d2b180007d8f90bfa44e98 | 478 | https://github.com/jeremyramin/terminal-plus/blob/15a422034df6c2f5a0d2b180007d8f90bfa44e98/lib/panel.coffee | 105 | 119 | ||
jeremyramin/terminal-plus:lib/panel.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
closeAll: ->
for index in [@commandViews.length .. 0]
o = @commandViews[index]
if o?
o.close()
# Tear down any state and detach
destroy: ->
for index in [@commandViews.length .. 0]
@removeCommandView @commandViews[index]
... | ({
closeAll: function() {
var i, index, o, ref, results;
results = [];
for (index = i = ref = this.commandViews.length; (ref <= 0 ? i <= 0 : i >= 0); index = ref <= 0 ? ++i : --i) {
o = this.commandViews[index];
if (o != null) {
results.push(o.close());
} else {
results.p... | CoffeeScript | JavaScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | 15a422034df6c2f5a0d2b180007d8f90bfa44e98 | 478 | https://github.com/jeremyramin/terminal-plus/blob/15a422034df6c2f5a0d2b180007d8f90bfa44e98/lib/panel.coffee | 105 | 119 |
jeremyramin/terminal-plus:lib/panel.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
closeAll: function() {
var i, index, o, ref, results;
results = [];
for (index = i = ref = this.commandViews.length; (ref <= 0 ? i <= 0 : i >= 0); index = ref <= 0 ? ++i : --i) {
o = this.commandViews[index];
if (o != null) {
re... | closeAll: ->
for index in [@commandViews.length .. 0]
o = @commandViews[index]
if o?
o.close()
# Tear down any state and detach
destroy: ->
for index in [@commandViews.length .. 0]
@removeCommandView @commandViews[index]
@detach()
toggle: ->
@createCommandView() unless ... | JavaScript | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | 15a422034df6c2f5a0d2b180007d8f90bfa44e98 | 478 | https://github.com/jeremyramin/terminal-plus/blob/15a422034df6c2f5a0d2b180007d8f90bfa44e98/lib/panel.coffee | 105 | 119 |
jeremyramin/terminal-plus:lib/panel.coffee:4:completion | completion | closeAll: ->
for index in [@commandViews.length .. 0]
o = @commandViews[index]
if o?
o.close()
# Tear down any state and detach | destroy: ->
for index in [@commandViews.length .. 0]
@removeCommandView @commandViews[index]
@detach()
toggle: ->
@createCommandView() unless @commandViews[@activeIndex]?
@commandViews[@activeIndex].toggle() | CoffeeScript | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | 15a422034df6c2f5a0d2b180007d8f90bfa44e98 | 478 | https://github.com/jeremyramin/terminal-plus/blob/15a422034df6c2f5a0d2b180007d8f90bfa44e98/lib/panel.coffee | 105 | 119 |
jeremyramin/terminal-plus:lib/panel.coffee:2:raw_corpus | raw_corpus | class TerminalPlusPanel extends View
@content: ->
@div class: 'terminal-plus-panel inline-block', =>
@span outlet: 'termStatusContainer', =>
@span click: 'newTermClick', class: "icon icon-plus"
commandViews: []
activeIndex: 0
initialize: (serializeState) ->
getSelectedText = () ->
... | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | e9dfeb4ceb8aad183da5d3f64394f275ab17cdee | 478 | https://github.com/jeremyramin/terminal-plus/blob/e9dfeb4ceb8aad183da5d3f64394f275ab17cdee/lib/panel.coffee | 5 | 54 | ||
jeremyramin/terminal-plus:lib/panel.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class TerminalPlusPanel extends View
@content: ->
@div class: 'terminal-plus-panel inline-block', =>
@span outlet: 'termStatusContainer', =>
@span click: 'newTermClick', class: "icon icon-plus"
commandViews: []
activeIndex: 0
initialize... | var TerminalPlusPanel;
TerminalPlusPanel = (function() {
class TerminalPlusPanel extends View {
static content() {
return this.div({
class: 'terminal-plus-panel inline-block'
}, () => {
return this.span({
outlet: 'termStatusContainer'
}, () => {
return this... | CoffeeScript | JavaScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | e9dfeb4ceb8aad183da5d3f64394f275ab17cdee | 478 | https://github.com/jeremyramin/terminal-plus/blob/e9dfeb4ceb8aad183da5d3f64394f275ab17cdee/lib/panel.coffee | 5 | 54 |
jeremyramin/terminal-plus:lib/panel.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TerminalPlusPanel;
TerminalPlusPanel = (function() {
class TerminalPlusPanel extends View {
static content() {
return this.div({
class: 'terminal-plus-panel inline-block'
}, () => {
return this.span({
outlet: 'termSt... | class TerminalPlusPanel extends View
@content: ->
@div class: 'terminal-plus-panel inline-block', =>
@span outlet: 'termStatusContainer', =>
@span click: 'newTermClick', class: "icon icon-plus"
commandViews: []
activeIndex: 0
initialize: (serializeState) ->
getSelectedText = () ->
... | JavaScript | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | e9dfeb4ceb8aad183da5d3f64394f275ab17cdee | 478 | https://github.com/jeremyramin/terminal-plus/blob/e9dfeb4ceb8aad183da5d3f64394f275ab17cdee/lib/panel.coffee | 5 | 54 |
jeremyramin/terminal-plus:lib/panel.coffee:2:completion | completion | class TerminalPlusPanel extends View
@content: ->
@div class: 'terminal-plus-panel inline-block', =>
@span outlet: 'termStatusContainer', =>
@span click: 'newTermClick', class: "icon icon-plus"
commandViews: []
activeIndex: 0
initialize: (serializeState) ->
getSelectedText = () ->
... | 'terminal-plus:reload-config': => @runInCurrentView (i) ->
i.clear()
i.reloadSettings()
i.clear()
'terminal-plus:open-config': => @runInCurrentView (i) ->
i.showSettings()
@createCommandView()
@attach()
getColors: ->
{
normalBlack, normalRed, normalGreen, norm... | CoffeeScript | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | e9dfeb4ceb8aad183da5d3f64394f275ab17cdee | 478 | https://github.com/jeremyramin/terminal-plus/blob/e9dfeb4ceb8aad183da5d3f64394f275ab17cdee/lib/panel.coffee | 5 | 54 |
jeremyramin/terminal-plus:lib/panel.coffee:3:raw_corpus | raw_corpus | createCommandView: ->
termStatus = $('<span class="icon icon-terminal"></span>')
options =
runCommand : atom.config.get 'terminal-plus.autoRunCommand'
shellOverride : atom.config.get 'terminal-plus.shellOverride'
shellArguments: atom.config.get 'terminal-plus.shellArguments'
titleTem... | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | e9dfeb4ceb8aad183da5d3f64394f275ab17cdee | 478 | https://github.com/jeremyramin/terminal-plus/blob/e9dfeb4ceb8aad183da5d3f64394f275ab17cdee/lib/panel.coffee | 55 | 104 | ||
jeremyramin/terminal-plus:lib/panel.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
createCommandView: ->
termStatus = $('<span class="icon icon-terminal"></span>')
options =
runCommand : atom.config.get 'terminal-plus.autoRunCommand'
shellOverride : atom.config.get 'terminal-plus.shellOverride'
shellArguments: atom... | ({
createCommandView: function() {
var options, termStatus, terminalPlusView;
termStatus = $('<span class="icon icon-terminal"></span>');
options = {
runCommand: atom.config.get('terminal-plus.autoRunCommand'),
shellOverride: atom.config.get('terminal-plus.shellOverride'),
shellArguments... | CoffeeScript | JavaScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | e9dfeb4ceb8aad183da5d3f64394f275ab17cdee | 478 | https://github.com/jeremyramin/terminal-plus/blob/e9dfeb4ceb8aad183da5d3f64394f275ab17cdee/lib/panel.coffee | 55 | 104 |
jeremyramin/terminal-plus:lib/panel.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
createCommandView: function() {
var options, termStatus, terminalPlusView;
termStatus = $('<span class="icon icon-terminal"></span>');
options = {
runCommand: atom.config.get('terminal-plus.autoRunCommand'),
shellOverride: atom.config.g... | createCommandView: ->
termStatus = $('<span class="icon icon-terminal"></span>')
options =
runCommand : atom.config.get 'terminal-plus.autoRunCommand'
shellOverride : atom.config.get 'terminal-plus.shellOverride'
shellArguments: atom.config.get 'terminal-plus.shellArguments'
titleTem... | JavaScript | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | e9dfeb4ceb8aad183da5d3f64394f275ab17cdee | 478 | https://github.com/jeremyramin/terminal-plus/blob/e9dfeb4ceb8aad183da5d3f64394f275ab17cdee/lib/panel.coffee | 55 | 104 |
jeremyramin/terminal-plus:lib/panel.coffee:3:completion | completion | createCommandView: ->
termStatus = $('<span class="icon icon-terminal"></span>')
options =
runCommand : atom.config.get 'terminal-plus.autoRunCommand'
shellOverride : atom.config.get 'terminal-plus.shellOverride'
shellArguments: atom.config.get 'terminal-plus.shellArguments'
titleTem... | activePrevCommandView: ->
@activeCommandView @activeIndex - 1
activeCommandView: (index) ->
if index >= @commandViews.length
index = 0
if index < 0
index = @commandViews.length - 1
@updateStatusBar @commandViews[index]
@commandViews[index] and @commandViews[index].open()
getActiveC... | CoffeeScript | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | e9dfeb4ceb8aad183da5d3f64394f275ab17cdee | 478 | https://github.com/jeremyramin/terminal-plus/blob/e9dfeb4ceb8aad183da5d3f64394f275ab17cdee/lib/panel.coffee | 55 | 104 |
jeremyramin/terminal-plus:lib/panel.coffee:4:raw_corpus | raw_corpus | @toggle()
return ret
setActiveCommandView: (commandView) ->
@activeIndex = @commandViews.indexOf commandView
removeCommandView: (commandView) ->
index = @commandViews.indexOf commandView
index >=0 and @commandViews.splice index, 1
newTermClick: ->
@createCommandView().toggle()
attach: ()... | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | e9dfeb4ceb8aad183da5d3f64394f275ab17cdee | 478 | https://github.com/jeremyramin/terminal-plus/blob/e9dfeb4ceb8aad183da5d3f64394f275ab17cdee/lib/panel.coffee | 105 | 139 | ||
jeremyramin/terminal-plus:lib/panel.coffee:4:completion | completion | @toggle()
return ret
setActiveCommandView: (commandView) ->
@activeIndex = @commandViews.indexOf commandView
removeCommandView: (commandView) ->
index = @commandViews.indexOf commandView
index >=0 and @commandViews.splice index, 1
newTermClick: ->
@createCommandView().toggle()
attach: ()... | destroyActiveTerm: ->
@commandViews[@activeIndex]?.destroy()
closeAll: ->
for index in [@commandViews.length .. 0]
o = @commandViews[index]
if o?
o.close()
# Tear down any state and detach
destroy: ->
for index in [@commandViews.length .. 0]
@removeCommandView @commandView... | CoffeeScript | CoffeeScript | jeremyramin/terminal-plus | lib/panel.coffee | MIT | e9dfeb4ceb8aad183da5d3f64394f275ab17cdee | 478 | https://github.com/jeremyramin/terminal-plus/blob/e9dfeb4ceb8aad183da5d3f64394f275ab17cdee/lib/panel.coffee | 105 | 139 |
jsdf/coffee-react-transform:csx.coffee:1:raw_corpus | raw_corpus | module.exports = class Parser
astLeafNode: (type, value = null) -> {type, value}
astBranchNode: (type, value = null) -> {type, value, children:[]}
activeBranchNode: -> last(@activeStates)
newestNode: -> last(@activeBranchNode().children) or @activeBranchNode()
pushActiveBranchNode: (node) ->
@activeBranc... | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 9998cde01b3b6acef3e4c52a5b3f9fa632a1742c | 431 | https://github.com/jsdf/coffee-react-transform/blob/9998cde01b3b6acef3e4c52a5b3f9fa632a1742c/csx.coffee | 13 | 62 | ||
jsdf/coffee-react-transform:csx.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class Parser
astLeafNode: (type, value = null) -> {type, value}
astBranchNode: (type, value = null) -> {type, value, children:[]}
activeBranchNode: -> last(@activeStates)
newestNode: -> last(@activeBranchNode().children) or @activeBranch... | var Parser;
module.exports = Parser = class Parser {
astLeafNode(type, value = null) {
return {type, value};
}
astBranchNode(type, value = null) {
return {
type,
value,
children: []
};
}
activeBranchNode() {
return last(this.activeStates);
}
newestNode() {
return ... | CoffeeScript | JavaScript | jsdf/coffee-react-transform | csx.coffee | MIT | 9998cde01b3b6acef3e4c52a5b3f9fa632a1742c | 431 | https://github.com/jsdf/coffee-react-transform/blob/9998cde01b3b6acef3e4c52a5b3f9fa632a1742c/csx.coffee | 13 | 62 |
jsdf/coffee-react-transform:csx.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Parser;
module.exports = Parser = class Parser {
astLeafNode(type, value = null) {
return {type, value};
}
astBranchNode(type, value = null) {
return {
type,
value,
children: []
};
}
activeBranchNode() {
return las... | module.exports = class Parser
astLeafNode: (type, value = null) -> {type, value}
astBranchNode: (type, value = null) -> {type, value, children:[]}
activeBranchNode: -> last(@activeStates)
newestNode: -> last(@activeBranchNode().children) or @activeBranchNode()
pushActiveBranchNode: (node) ->
@activeBranc... | JavaScript | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 9998cde01b3b6acef3e4c52a5b3f9fa632a1742c | 431 | https://github.com/jsdf/coffee-react-transform/blob/9998cde01b3b6acef3e4c52a5b3f9fa632a1742c/csx.coffee | 13 | 62 |
jsdf/coffee-react-transform:csx.coffee:1:completion | completion | module.exports = class Parser
astLeafNode: (type, value = null) -> {type, value}
astBranchNode: (type, value = null) -> {type, value, children:[]}
activeBranchNode: -> last(@activeStates)
newestNode: -> last(@activeBranchNode().children) or @activeBranchNode()
pushActiveBranchNode: (node) ->
@activeBranc... | @csxEscape() or
@csxUnescape() or
@csxEnd() or
@csxText() or
@coffeescriptCode()
# Update position
[@chunkLine, @chunkColumn] = @getLineAndColumnFromChunk consumed
i += consumed
@ast
csxStart: ->
return 0 unless match = OPENING_TAG.exec @chunk
[input, ... | CoffeeScript | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 9998cde01b3b6acef3e4c52a5b3f9fa632a1742c | 431 | https://github.com/jsdf/coffee-react-transform/blob/9998cde01b3b6acef3e4c52a5b3f9fa632a1742c/csx.coffee | 13 | 62 |
jsdf/coffee-react-transform:csx.coffee:2:raw_corpus | raw_corpus | input.length
csxEscape: ->
return 0 unless @activeBranchNode().type == CSX_EL and @chunk.charAt(0) == '{'
@pushActiveBranchNode @astBranchNode CSX_ESC
# console.log CSX_ESC_START
return 1
csxUnescape: ->
return 0 unless @activeBranchNode().type == CSX_ESC and @chunk.charAt(0) == '}'
@pop... | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 9998cde01b3b6acef3e4c52a5b3f9fa632a1742c | 431 | https://github.com/jsdf/coffee-react-transform/blob/9998cde01b3b6acef3e4c52a5b3f9fa632a1742c/csx.coffee | 63 | 112 | ||
jsdf/coffee-react-transform:csx.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
input.length
csxEscape: ->
return 0 unless @activeBranchNode().type == CSX_EL and @chunk.charAt(0) == '{'
@pushActiveBranchNode @astBranchNode CSX_ESC
# console.log CSX_ESC_START
return 1
csxUnescape: ->
return 0 unless @activeBranchNod... | input.length({
csxEscape: function() {
if (!(this.activeBranchNode().type === CSX_EL && this.chunk.charAt(0) === '{')) {
return 0;
}
this.pushActiveBranchNode(this.astBranchNode(CSX_ESC));
// console.log CSX_ESC_START
return 1;
},
csxUnescape: function() {
if (!(this.activeBranchNode... | CoffeeScript | JavaScript | jsdf/coffee-react-transform | csx.coffee | MIT | 9998cde01b3b6acef3e4c52a5b3f9fa632a1742c | 431 | https://github.com/jsdf/coffee-react-transform/blob/9998cde01b3b6acef3e4c52a5b3f9fa632a1742c/csx.coffee | 63 | 112 |
jsdf/coffee-react-transform:csx.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
input.length({
csxEscape: function() {
if (!(this.activeBranchNode().type === CSX_EL && this.chunk.charAt(0) === '{')) {
return 0;
}
this.pushActiveBranchNode(this.astBranchNode(CSX_ESC));
// console.log CSX_ESC_START
return 1;
},
cs... | input.length
csxEscape: ->
return 0 unless @activeBranchNode().type == CSX_EL and @chunk.charAt(0) == '{'
@pushActiveBranchNode @astBranchNode CSX_ESC
# console.log CSX_ESC_START
return 1
csxUnescape: ->
return 0 unless @activeBranchNode().type == CSX_ESC and @chunk.charAt(0) == '}'
@pop... | JavaScript | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 9998cde01b3b6acef3e4c52a5b3f9fa632a1742c | 431 | https://github.com/jsdf/coffee-react-transform/blob/9998cde01b3b6acef3e4c52a5b3f9fa632a1742c/csx.coffee | 63 | 112 |
jsdf/coffee-react-transform:csx.coffee:2:completion | completion | input.length
csxEscape: ->
return 0 unless @activeBranchNode().type == CSX_EL and @chunk.charAt(0) == '{'
@pushActiveBranchNode @astBranchNode CSX_ESC
# console.log CSX_ESC_START
return 1
csxUnescape: ->
return 0 unless @activeBranchNode().type == CSX_ESC and @chunk.charAt(0) == '}'
@pop... | @popActiveBranchNode() # close csx tag
# console.log CSX_END
input.length
csxText: ->
return 0 unless @activeBranchNode().type == CSX_EL
unless @newestNode().type == CSX_TEXT
@addLeafNodeToActiveBranch @astLeafNode CSX_TEXT, '' # init value as string
# newestNode is (now) CSX_TEXT
@n... | CoffeeScript | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 9998cde01b3b6acef3e4c52a5b3f9fa632a1742c | 431 | https://github.com/jsdf/coffee-react-transform/blob/9998cde01b3b6acef3e4c52a5b3f9fa632a1742c/csx.coffee | 63 | 112 |
jsdf/coffee-react-transform:csx.coffee:3:raw_corpus | raw_corpus | @newestNode().value += @chunk.charAt 0
return 1
rewriteAttributes: (attributesText) ->
unless attributesText.length
attributesText = null
@astBranchNode CSX_ATTRS, attributesText
clean: (code) ->
code = code.slice(1) if code.charCodeAt(0) is BOM
code = code.replace(/\r/g, '').replace T... | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 9998cde01b3b6acef3e4c52a5b3f9fa632a1742c | 431 | https://github.com/jsdf/coffee-react-transform/blob/9998cde01b3b6acef3e4c52a5b3f9fa632a1742c/csx.coffee | 113 | 162 | ||
jsdf/coffee-react-transform:csx.coffee:3:completion | completion | @newestNode().value += @chunk.charAt 0
return 1
rewriteAttributes: (attributesText) ->
unless attributesText.length
attributesText = null
@astBranchNode CSX_ATTRS, attributesText
clean: (code) ->
code = code.slice(1) if code.charCodeAt(0) is BOM
code = code.replace(/\r/g, '').replace T... | if offset is 0
return [@chunkLine, @chunkColumn]
if offset >= @chunk.length
string = @chunk
else
string = @chunk[..offset-1]
lineCount = count string, '\n'
column = @chunkColumn
if lineCount > 0
lines = string.split '\n'
column = last(lines).length
else
col... | CoffeeScript | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 9998cde01b3b6acef3e4c52a5b3f9fa632a1742c | 431 | https://github.com/jsdf/coffee-react-transform/blob/9998cde01b3b6acef3e4c52a5b3f9fa632a1742c/csx.coffee | 113 | 162 |
jsdf/coffee-react-transform:csx.coffee:4:raw_corpus | raw_corpus | CSX_ESC = 'CSX_ESC'
CSX_ATTRS = 'CSX_ATTRS'
CSX_ATTR_PAIR = 'CSX_ATTR_PAIR'
# leaf nodes
CS = 'CS'
CSX_TEXT = 'CSX_TEXT'
CSX_ATTR_KEY = 'CSX_ATTR_KEY'
CSX_ATTR_VAL = 'CSX_ATTR_VAL'
# tokens
CSX_START = 'CSX_START'
CSX_END = 'CSX_END'
CSX_ESC_START = 'CSX_ESC_START'
CSX_ESC_END = 'CSX_ESC_END'
# [1] tag name
# [2] a... | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 9998cde01b3b6acef3e4c52a5b3f9fa632a1742c | 431 | https://github.com/jsdf/coffee-react-transform/blob/9998cde01b3b6acef3e4c52a5b3f9fa632a1742c/csx.coffee | 163 | 207 | ||
jsdf/coffee-react-transform:csx.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
CSX_ESC = 'CSX_ESC'
CSX_ATTRS = 'CSX_ATTRS'
CSX_ATTR_PAIR = 'CSX_ATTR_PAIR'
# leaf nodes
CS = 'CS'
CSX_TEXT = 'CSX_TEXT'
CSX_ATTR_KEY = 'CSX_ATTR_KEY'
CSX_ATTR_VAL = 'CSX_ATTR_VAL'
# tokens
CSX_START = 'CSX_START'
CSX_END = 'CSX_END'
CSX_ESC_START = 'CSX_ESC_ST... | var BOM, CLOSING_TAG, COMMENT, CS, CSX_ATTRS, CSX_ATTR_KEY, CSX_ATTR_PAIR, CSX_ATTR_VAL, CSX_END, CSX_ESC, CSX_ESC_END, CSX_ESC_START, CSX_START, CSX_TEXT, OPENING_TAG, TAG_ATTRIBUTES, TRAILING_SPACES, WHITESPACE;
CSX_ESC = 'CSX_ESC';
CSX_ATTRS = 'CSX_ATTRS';
CSX_ATTR_PAIR = 'CSX_ATTR_PAIR';
// leaf nodes
CS = 'CS'... | CoffeeScript | JavaScript | jsdf/coffee-react-transform | csx.coffee | MIT | 9998cde01b3b6acef3e4c52a5b3f9fa632a1742c | 431 | https://github.com/jsdf/coffee-react-transform/blob/9998cde01b3b6acef3e4c52a5b3f9fa632a1742c/csx.coffee | 163 | 207 |
jsdf/coffee-react-transform:csx.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var BOM, CLOSING_TAG, COMMENT, CS, CSX_ATTRS, CSX_ATTR_KEY, CSX_ATTR_PAIR, CSX_ATTR_VAL, CSX_END, CSX_ESC, CSX_ESC_END, CSX_ESC_START, CSX_START, CSX_TEXT, OPENING_TAG, TAG_ATTRIBUTES, TRAILING_SPACES, WHITESPACE;
CSX_ESC = 'CSX_ESC';
CSX_ATTRS = 'CSX_ATTRS';
CS... | CSX_ESC = 'CSX_ESC'
CSX_ATTRS = 'CSX_ATTRS'
CSX_ATTR_PAIR = 'CSX_ATTR_PAIR'
# leaf nodes
CS = 'CS'
CSX_TEXT = 'CSX_TEXT'
CSX_ATTR_KEY = 'CSX_ATTR_KEY'
CSX_ATTR_VAL = 'CSX_ATTR_VAL'
# tokens
CSX_START = 'CSX_START'
CSX_END = 'CSX_END'
CSX_ESC_START = 'CSX_ESC_START'
CSX_ESC_END = 'CSX_ESC_END'
# [1] tag name
# [2] a... | JavaScript | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 9998cde01b3b6acef3e4c52a5b3f9fa632a1742c | 431 | https://github.com/jsdf/coffee-react-transform/blob/9998cde01b3b6acef3e4c52a5b3f9fa632a1742c/csx.coffee | 163 | 207 |
jsdf/coffee-react-transform:csx.coffee:4:completion | completion | CSX_ESC = 'CSX_ESC'
CSX_ATTRS = 'CSX_ATTRS'
CSX_ATTR_PAIR = 'CSX_ATTR_PAIR'
# leaf nodes
CS = 'CS'
CSX_TEXT = 'CSX_TEXT'
CSX_ATTR_KEY = 'CSX_ATTR_KEY'
CSX_ATTR_VAL = 'CSX_ATTR_VAL'
# tokens
CSX_START = 'CSX_START'
CSX_END = 'CSX_END'
CSX_ESC_START = 'CSX_ESC_START'
CSX_ESC_END = 'CSX_ESC_END'
# [1] tag name
# [2] a... | # [1] tag name
CLOSING_TAG = /^<\/([-A-Za-z0-9_]+)[^>]*>/
# exec (call until null)
# [0] attr=val
# [1] attr
# [2] val if quoted
# [3]
# [4] val if not quoted
TAG_ATTRIBUTES = /^([-A-Za-z0-9_]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g
# from coffeescript lexer
# The character code of ... | CoffeeScript | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 9998cde01b3b6acef3e4c52a5b3f9fa632a1742c | 431 | https://github.com/jsdf/coffee-react-transform/blob/9998cde01b3b6acef3e4c52a5b3f9fa632a1742c/csx.coffee | 163 | 207 |
jsdf/coffee-react-transform:csx.coffee:1:raw_corpus | raw_corpus | # Import the helpers we need.
{count, starts, compact, last, repeat, invertLiterate,
locationDataToString, throwSyntaxError} = require './helpers'
# nextTag = (remainingText) ->
# remainingText.match OPENING_TAG
# remainingText.match CLOSING_TAG
# getAttributes = (attributesText) ->
# attributesValues = {}
# ... | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 72f811c4ff7660f362048e5ec2e6d7ad3e423861 | 431 | https://github.com/jsdf/coffee-react-transform/blob/72f811c4ff7660f362048e5ec2e6d7ad3e423861/csx.coffee | 1 | 42 | ||
jsdf/coffee-react-transform:csx.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Import the helpers we need.
{count, starts, compact, last, repeat, invertLiterate,
locationDataToString, throwSyntaxError} = require './helpers'
# nextTag = (remainingText) ->
# remainingText.match OPENING_TAG
# remainingText.match CLOSING_TAG
# getAttr... | // Import the helpers we need.
var Rewriter, compact, count, invertLiterate, last, locationDataToString, repeat, starts, throwSyntaxError;
({count, starts, compact, last, repeat, invertLiterate, locationDataToString, throwSyntaxError} = require('./helpers'));
// nextTag = (remainingText) ->
// remainingText.match O... | CoffeeScript | JavaScript | jsdf/coffee-react-transform | csx.coffee | MIT | 72f811c4ff7660f362048e5ec2e6d7ad3e423861 | 431 | https://github.com/jsdf/coffee-react-transform/blob/72f811c4ff7660f362048e5ec2e6d7ad3e423861/csx.coffee | 1 | 42 |
jsdf/coffee-react-transform:csx.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Import the helpers we need.
var Rewriter, compact, count, invertLiterate, last, locationDataToString, repeat, starts, throwSyntaxError;
({count, starts, compact, last, repeat, invertLiterate, locationDataToString, throwSyntaxError} = require('./helpers'));
// ... | # Import the helpers we need.
{count, starts, compact, last, repeat, invertLiterate,
locationDataToString, throwSyntaxError} = require './helpers'
# nextTag = (remainingText) ->
# remainingText.match OPENING_TAG
# remainingText.match CLOSING_TAG
# getAttributes = (attributesText) ->
# attributesValues = {}
# ... | JavaScript | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 72f811c4ff7660f362048e5ec2e6d7ad3e423861 | 431 | https://github.com/jsdf/coffee-react-transform/blob/72f811c4ff7660f362048e5ec2e6d7ad3e423861/csx.coffee | 1 | 42 |
jsdf/coffee-react-transform:csx.coffee:1:completion | completion | # Import the helpers we need.
{count, starts, compact, last, repeat, invertLiterate,
locationDataToString, throwSyntaxError} = require './helpers'
# nextTag = (remainingText) ->
# remainingText.match OPENING_TAG
# remainingText.match CLOSING_TAG
# getAttributes = (attributesText) ->
# attributesValues = {}
# ... | exports.Rewriter = class Rewriter
rewrite: (code, opts = {}) ->
@activeStates = [] # stack for states
@output = [] # buffer for rewritten fragments
@previousState = null # last state encountered
@chunkLine = 0 # The start line for the current @chunk.
@chunkColumn = 0 # The start column of the curr... | CoffeeScript | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 72f811c4ff7660f362048e5ec2e6d7ad3e423861 | 431 | https://github.com/jsdf/coffee-react-transform/blob/72f811c4ff7660f362048e5ec2e6d7ad3e423861/csx.coffee | 1 | 42 |
jsdf/coffee-react-transform:csx.coffee:2:raw_corpus | raw_corpus | # Update position
[@chunkLine, @chunkColumn] = @getLineAndColumnFromChunk consumed
i += consumed
csxStart: ->
return 0 unless match = OPENING_TAG.exec @chunk
[input, tagName, attributesText, selfClosing] = match
@output.push tagName, '(', rewriteAttributes(attributesText)
if selfClosing... | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 72f811c4ff7660f362048e5ec2e6d7ad3e423861 | 431 | https://github.com/jsdf/coffee-react-transform/blob/72f811c4ff7660f362048e5ec2e6d7ad3e423861/csx.coffee | 44 | 84 | ||
jsdf/coffee-react-transform:csx.coffee:2:completion | completion | # Update position
[@chunkLine, @chunkColumn] = @getLineAndColumnFromChunk consumed
i += consumed
csxStart: ->
return 0 unless match = OPENING_TAG.exec @chunk
[input, tagName, attributesText, selfClosing] = match
@output.push tagName, '(', rewriteAttributes(attributesText)
if selfClosing... | # do we need a comma? TODO REPLACE WITH STATES AST
if @previousState == CSX_TEXT
@previousState == CSX_START or
@previousState == CSX_END or
@previousState == CSX_ESC_END
@output.push ','
@activeStates.push CSX_ESC_START
@previousState = CSX_ESC_START
return 1
csxUnescape: ->
r... | CoffeeScript | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 72f811c4ff7660f362048e5ec2e6d7ad3e423861 | 431 | https://github.com/jsdf/coffee-react-transform/blob/72f811c4ff7660f362048e5ec2e6d7ad3e423861/csx.coffee | 44 | 84 |
jsdf/coffee-react-transform:csx.coffee:3:raw_corpus | raw_corpus | @output.push ')'
@activeStates.pop()
@previousState = CSX_END
input.length
csxText: ->
return 0 unless last(@activeStates) == CSX_START
# do we need a comma? TODO REPLACE WITH STATES AST
unless @previousState == CSX_TEXT
if @previousState == CSX_START or
@previousState == CSX_EN... | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 72f811c4ff7660f362048e5ec2e6d7ad3e423861 | 431 | https://github.com/jsdf/coffee-react-transform/blob/72f811c4ff7660f362048e5ec2e6d7ad3e423861/csx.coffee | 86 | 130 | ||
jsdf/coffee-react-transform:csx.coffee:3:completion | completion | @output.push ')'
@activeStates.pop()
@previousState = CSX_END
input.length
csxText: ->
return 0 unless last(@activeStates) == CSX_START
# do we need a comma? TODO REPLACE WITH STATES AST
unless @previousState == CSX_TEXT
if @previousState == CSX_START or
@previousState == CSX_EN... | @output.push @chunk.charAt 0
@previousState = COFFEESCRIPT_CODE
return 1
rewriteAttributes: (attributesText) ->
clean: (code) ->
code = code.slice(1) if code.charCodeAt(0) is BOM
code = code.replace(/\r/g, '').replace TRAILING_SPACES, ''
if WHITESPACE.test code
code = "\n#{code}"
@... | CoffeeScript | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 72f811c4ff7660f362048e5ec2e6d7ad3e423861 | 431 | https://github.com/jsdf/coffee-react-transform/blob/72f811c4ff7660f362048e5ec2e6d7ad3e423861/csx.coffee | 86 | 130 |
jsdf/coffee-react-transform:csx.coffee:4:raw_corpus | raw_corpus | if offset >= @chunk.length
string = @chunk
else
string = @chunk[..offset-1]
lineCount = count string, '\n'
column = @chunkColumn
if lineCount > 0
lines = string.split '\n'
column = last(lines).length
else
column += string.length
[@chunkLine + lineCount, column]
... | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 72f811c4ff7660f362048e5ec2e6d7ad3e423861 | 431 | https://github.com/jsdf/coffee-react-transform/blob/72f811c4ff7660f362048e5ec2e6d7ad3e423861/csx.coffee | 132 | 173 | ||
jsdf/coffee-react-transform:csx.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if offset >= @chunk.length
string = @chunk
else
string = @chunk[..offset-1]
lineCount = count string, '\n'
column = @chunkColumn
if lineCount > 0
lines = string.split '\n'
column = last(lines).length
else
column... | var CLOSING_TAG, COFFEESCRIPT_CODE, CSX_END, CSX_ESC_END, CSX_ESC_START, CSX_START, CSX_TEXT, OPENING_TAG, TAG_ATTRIBUTES, column, lineCount, lines, string;
if (offset >= this.chunk.length) {
string = this.chunk;
} else {
string = this.chunk.slice(0, +(offset - 1) + 1 || 9e9);
}
lineCount = count(string, '\n');
... | CoffeeScript | JavaScript | jsdf/coffee-react-transform | csx.coffee | MIT | 72f811c4ff7660f362048e5ec2e6d7ad3e423861 | 431 | https://github.com/jsdf/coffee-react-transform/blob/72f811c4ff7660f362048e5ec2e6d7ad3e423861/csx.coffee | 132 | 173 |
jsdf/coffee-react-transform:csx.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var CLOSING_TAG, COFFEESCRIPT_CODE, CSX_END, CSX_ESC_END, CSX_ESC_START, CSX_START, CSX_TEXT, OPENING_TAG, TAG_ATTRIBUTES, column, lineCount, lines, string;
if (offset >= this.chunk.length) {
string = this.chunk;
} else {
string = this.chunk.slice(0, +(offset ... | if offset >= @chunk.length
string = @chunk
else
string = @chunk[..offset-1]
lineCount = count string, '\n'
column = @chunkColumn
if lineCount > 0
lines = string.split '\n'
column = last(lines).length
else
column += string.length
[@chunkLine + lineCount, column]
... | JavaScript | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 72f811c4ff7660f362048e5ec2e6d7ad3e423861 | 431 | https://github.com/jsdf/coffee-react-transform/blob/72f811c4ff7660f362048e5ec2e6d7ad3e423861/csx.coffee | 132 | 173 |
jsdf/coffee-react-transform:csx.coffee:4:completion | completion | if offset >= @chunk.length
string = @chunk
else
string = @chunk[..offset-1]
lineCount = count string, '\n'
column = @chunkColumn
if lineCount > 0
lines = string.split '\n'
column = last(lines).length
else
column += string.length
[@chunkLine + lineCount, column]
... | CSX_END = {}
CSX_ESC_START = {}
CSX_ESC_END = {}
CSX_TEXT = {}
# [1] tag name
# [2] attributes text
# [3] self closing?
OPENING_TAG = /^<([-A-Za-z0-9_]+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/
# [1] tag name
CLOSING_TAG = /^<\/([-A-Za-z0-9_]+)[^>]*>/
# exec (call until null)
# [0] att... | CoffeeScript | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 72f811c4ff7660f362048e5ec2e6d7ad3e423861 | 431 | https://github.com/jsdf/coffee-react-transform/blob/72f811c4ff7660f362048e5ec2e6d7ad3e423861/csx.coffee | 132 | 173 |
jsdf/coffee-react-transform:csx.coffee:1:raw_corpus | raw_corpus | # ALL_TAGS = /<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/
# [0] tag name
# [1] attributes text
# [2] self closing?
OPENING_TAG = /<([-A-Za-z0-9_]+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/
# [0] tag name
CLOSING_TAG = /<\/([-A-Za-z0-9_]+)[^>]*>/
# exec (call until n... | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 26fc1a2cc95e3b349da1f83780c5b77b1ba5274a | 431 | https://github.com/jsdf/coffee-react-transform/blob/26fc1a2cc95e3b349da1f83780c5b77b1ba5274a/csx.coffee | 1 | 34 | ||
jsdf/coffee-react-transform:csx.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# ALL_TAGS = /<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/
# [0] tag name
# [1] attributes text
# [2] self closing?
OPENING_TAG = /<([-A-Za-z0-9_]+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/
# [0] tag name
CLOSIN... | // ALL_TAGS = /<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/
// [0] tag name
// [1] attributes text
// [2] self closing?
var CLOSING_TAG, OPENING_TAG, TAG_ATTRIBUTES, getAttributes, nextTag, transformTag;
OPENING_TAG = /<([-A-Za-z0-9_]+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\... | CoffeeScript | JavaScript | jsdf/coffee-react-transform | csx.coffee | MIT | 26fc1a2cc95e3b349da1f83780c5b77b1ba5274a | 431 | https://github.com/jsdf/coffee-react-transform/blob/26fc1a2cc95e3b349da1f83780c5b77b1ba5274a/csx.coffee | 1 | 34 |
jsdf/coffee-react-transform:csx.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// ALL_TAGS = /<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/
// [0] tag name
// [1] attributes text
// [2] self closing?
var CLOSING_TAG, OPENING_TAG, TAG_ATTRIBUTES, getAttributes, nextTag, transformTag;
OPENING_TAG = /<([-A-Za-z0-9_]+)((?:\s... | # ALL_TAGS = /<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/
# [0] tag name
# [1] attributes text
# [2] self closing?
OPENING_TAG = /<([-A-Za-z0-9_]+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/
# [0] tag name
CLOSING_TAG = /<\/([-A-Za-z0-9_]+)[^>]*>/
# exec (call until n... | JavaScript | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 26fc1a2cc95e3b349da1f83780c5b77b1ba5274a | 431 | https://github.com/jsdf/coffee-react-transform/blob/26fc1a2cc95e3b349da1f83780c5b77b1ba5274a/csx.coffee | 1 | 34 |
jsdf/coffee-react-transform:csx.coffee:1:completion | completion | # ALL_TAGS = /<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/
# [0] tag name
# [1] attributes text
# [2] self closing?
OPENING_TAG = /<([-A-Za-z0-9_]+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/
# [0] tag name
CLOSING_TAG = /<\/([-A-Za-z0-9_]+)[^>]*>/
# exec (call until n... | nextTag = (remainingText) ->
remainingText.match OPENING_TAG
remainingText.match CLOSING_TAG
getAttributes = (attributesText) ->
attributesValues = {}
TAG_ATTRIBUTES.lastIndex = 0
while attrMatches = TAG_ATTRIBUTES.exec attributesText
attributesValues[attrMatches[1]] = attrMatches[2] || attrMatches[4] ||... | CoffeeScript | CoffeeScript | jsdf/coffee-react-transform | csx.coffee | MIT | 26fc1a2cc95e3b349da1f83780c5b77b1ba5274a | 431 | https://github.com/jsdf/coffee-react-transform/blob/26fc1a2cc95e3b349da1f83780c5b77b1ba5274a/csx.coffee | 1 | 34 |
nevir/groc:lib/utils/style_helpers.coffee:1:raw_corpus | raw_corpus | module.exports = StyleHelpers =
# Generate a table of contents as a tree of {node: {...}, children: []} objects.
#
# We want a pretty complex hierarchy in our table of contents:
# buildTableOfContents: (files) ->
# Given an array of markdowned segments, convert their list of headers into a hierarchical
# o... | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/style_helpers.coffee | 9 | 58 | ||
nevir/groc:lib/utils/style_helpers.coffee:1:completion | completion | module.exports = StyleHelpers =
# Generate a table of contents as a tree of {node: {...}, children: []} objects.
#
# We want a pretty complex hierarchy in our table of contents:
# buildTableOfContents: (files) ->
# Given an array of markdowned segments, convert their list of headers into a hierarchical
# o... | # We want a pretty complex hierarchy in our table of contents:
buildTableOfContents: (files, outlines) ->
files = files.sort (a, b) ->
# * The index is always first in the table of contents.
return -1 if a.targetPath == 'index'
return 1 if b.targetPath == 'index'
return 0 if a.targetPath... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/style_helpers.coffee | 9 | 58 |
nevir/groc:lib/utils/style_helpers.coffee:2:raw_corpus | raw_corpus | path: targetChunks[0..i].join '/'
title: if chunk == 'index' and i is 0 then file.pageTitle else targetChunks[i]
depth: i + 1
prevPath = [] # Make sure that we don't match directories several levels in, after a fail.
prevPath = targetChunks
fileData = _(file).clone()
... | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/style_helpers.coffee | 59 | 108 | ||
nevir/groc:lib/utils/style_helpers.coffee:2:completion | completion | path: targetChunks[0..i].join '/'
title: if chunk == 'index' and i is 0 then file.pageTitle else targetChunks[i]
depth: i + 1
prevPath = [] # Make sure that we don't match directories several levels in, after a fail.
prevPath = targetChunks
fileData = _(file).clone()
... | type: 'file'
data: fileData
depth: file.targetPath.split( path.join('/') ).length
outline: outlines[file.targetPath]
@buildNodeTree nodes
# Take a flat, though ordered, list of nodes and convert them into a tree.
#
# Nodes are expected to have a `depth` property. Each node is... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/style_helpers.coffee | 59 | 108 |
nevir/groc:lib/utils/style_helpers.coffee:3:raw_corpus | raw_corpus | _(stack).last().children.push node
stack.push node
result
# It helps visually to separate headers that are not attached to other comments into their own
# segment.
segmentizeSoloHeaders: (segments) ->
results = []
for segment in segments
headerOnly = segment.markdownedComments.match /^\... | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/style_helpers.coffee | 109 | 137 | ||
nevir/groc:lib/utils/style_helpers.coffee:3:completion | completion | _(stack).last().children.push node
stack.push node
result
# It helps visually to separate headers that are not attached to other comments into their own
# segment.
segmentizeSoloHeaders: (segments) ->
results = []
for segment in segments
headerOnly = segment.markdownedComments.match /^\... | code: []
comments: segment.comments
highlightedCode: ''
markdownedComments: segment.markdownedComments
results.push
code: segment.code
comments: []
highlightedCode: segment.highlightedCode
... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/style_helpers.coffee | 109 | 137 |
nevir/groc:lib/utils/style_helpers.coffee:2:raw_corpus | raw_corpus | path: targetChunks[0..i].join '/'
title: targetChunks[i]
depth: i + 1
prevPath = [] # Make sure that we don't match directories several levels in, after a fail.
prevPath = targetChunks
fileData = _(file).clone()
# Annotate the file data with a title to represen... | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | 06224d7677026cd74e74de3cb556ecb704e9dadc | 579 | https://github.com/nevir/groc/blob/06224d7677026cd74e74de3cb556ecb704e9dadc/lib/utils/style_helpers.coffee | 59 | 108 | ||
nevir/groc:lib/utils/style_helpers.coffee:2:completion | completion | path: targetChunks[0..i].join '/'
title: targetChunks[i]
depth: i + 1
prevPath = [] # Make sure that we don't match directories several levels in, after a fail.
prevPath = targetChunks
fileData = _(file).clone()
# Annotate the file data with a title to represen... | type: 'file'
data: fileData
depth: file.targetPath.split( path.join('/') ).length
outline: outlines[file.targetPath]
@buildNodeTree nodes
# Take a flat, though ordered, list of nodes and convert them into a tree.
#
# Nodes are expected to have a `depth` property. Each node is... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | 06224d7677026cd74e74de3cb556ecb704e9dadc | 579 | https://github.com/nevir/groc/blob/06224d7677026cd74e74de3cb556ecb704e9dadc/lib/utils/style_helpers.coffee | 59 | 108 |
nevir/groc:lib/utils/style_helpers.coffee:1:raw_corpus | raw_corpus | # # Style Helpers
#
# A collection of helpful functions to support styles and their behavior.
StyleHelpers =
# Generate a table of contents as a tree of {node: {...}, children: []} objects.
#
# We want a pretty complex hierarchy in our table of contents:
# buildTableOfContents: (files) ->
# Given an array of... | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | 3a6c454a7d1a5391ad45749f60026cecb1eb644d | 579 | https://github.com/nevir/groc/blob/3a6c454a7d1a5391ad45749f60026cecb1eb644d/lib/utils/style_helpers.coffee | 1 | 44 | ||
nevir/groc:lib/utils/style_helpers.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# # Style Helpers
#
# A collection of helpful functions to support styles and their behavior.
StyleHelpers =
# Generate a table of contents as a tree of {node: {...}, children: []} objects.
#
# We want a pretty complex hierarchy in our table of contents:
... | // # Style Helpers
// A collection of helpful functions to support styles and their behavior.
var StyleHelpers;
StyleHelpers = {
// Generate a table of contents as a tree of {node: {...}, children: []} objects.
// We want a pretty complex hierarchy in our table of contents:
// buildTableOfContents: (files) ->
... | CoffeeScript | JavaScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | 3a6c454a7d1a5391ad45749f60026cecb1eb644d | 579 | https://github.com/nevir/groc/blob/3a6c454a7d1a5391ad45749f60026cecb1eb644d/lib/utils/style_helpers.coffee | 1 | 44 |
nevir/groc:lib/utils/style_helpers.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// # Style Helpers
// A collection of helpful functions to support styles and their behavior.
var StyleHelpers;
StyleHelpers = {
// Generate a table of contents as a tree of {node: {...}, children: []} objects.
// We want a pretty complex hierarchy in our ta... | # # Style Helpers
#
# A collection of helpful functions to support styles and their behavior.
StyleHelpers =
# Generate a table of contents as a tree of {node: {...}, children: []} objects.
#
# We want a pretty complex hierarchy in our table of contents:
# buildTableOfContents: (files) ->
# Given an array of... | JavaScript | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | 3a6c454a7d1a5391ad45749f60026cecb1eb644d | 579 | https://github.com/nevir/groc/blob/3a6c454a7d1a5391ad45749f60026cecb1eb644d/lib/utils/style_helpers.coffee | 1 | 44 |
nevir/groc:lib/utils/style_helpers.coffee:1:completion | completion | # # Style Helpers
#
# A collection of helpful functions to support styles and their behavior.
StyleHelpers =
# Generate a table of contents as a tree of {node: {...}, children: []} objects.
#
# We want a pretty complex hierarchy in our table of contents:
# buildTableOfContents: (files) ->
# Given an array of... | @buildNodeTree nodes
# Generate a table of contents as a tree of {..., children: []} objects.
#
# We take a list of file info objects, and a map of outlines to fileInfo.targetPath.
#
# We want a pretty complex hierarchy in our table of contents:
buildTableOfContents: (files, outlines) ->
files = files.... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | 3a6c454a7d1a5391ad45749f60026cecb1eb644d | 579 | https://github.com/nevir/groc/blob/3a6c454a7d1a5391ad45749f60026cecb1eb644d/lib/utils/style_helpers.coffee | 1 | 44 |
nevir/groc:lib/utils/style_helpers.coffee:2:raw_corpus | raw_corpus | # * If a file has the same name as a directory, it takes ownership of that directory's folder.
for chunk, i in pathChunks
if prevPath[i] != chunk
# * Otherwise we have a generic folder node that takes its place in the table of contents.
# TODO: We probably want some way to rename fol... | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | 3a6c454a7d1a5391ad45749f60026cecb1eb644d | 579 | https://github.com/nevir/groc/blob/3a6c454a7d1a5391ad45749f60026cecb1eb644d/lib/utils/style_helpers.coffee | 46 | 84 | ||
nevir/groc:lib/utils/style_helpers.coffee:2:completion | completion | # * If a file has the same name as a directory, it takes ownership of that directory's folder.
for chunk, i in pathChunks
if prevPath[i] != chunk
# * Otherwise we have a generic folder node that takes its place in the table of contents.
# TODO: We probably want some way to rename fol... | #
# If possible, we use the initial header in the file,
if outlines[file.targetPath]?[0]?.data?.isFileHeader
fileData.firstHeader = outlines[file.targetPath].shift()
fileData.title = fileData.firstHeader.data.title
if fileData.firstHeader.children?.length > 0
outline... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | 3a6c454a7d1a5391ad45749f60026cecb1eb644d | 579 | https://github.com/nevir/groc/blob/3a6c454a7d1a5391ad45749f60026cecb1eb644d/lib/utils/style_helpers.coffee | 46 | 84 |
nevir/groc:lib/utils/style_helpers.coffee:3:raw_corpus | raw_corpus | # Take a flat, though ordered, list of nodes and convert them into a tree.
#
# Nodes are expected to have a `depth` property. Each node is annotated with an array of
# `children` if it does not exist. Children are appended, otherwise.
buildNodeTree: (nodes) ->
result = []
stack = []
for node in ... | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | 3a6c454a7d1a5391ad45749f60026cecb1eb644d | 579 | https://github.com/nevir/groc/blob/3a6c454a7d1a5391ad45749f60026cecb1eb644d/lib/utils/style_helpers.coffee | 86 | 127 | ||
nevir/groc:lib/utils/style_helpers.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Take a flat, though ordered, list of nodes and convert them into a tree.
#
# Nodes are expected to have a `depth` property. Each node is annotated with an array of
# `children` if it does not exist. Children are appended, otherwise.
buildNodeTree: (no... | // Take a flat, though ordered, list of nodes and convert them into a tree.
// Nodes are expected to have a `depth` property. Each node is annotated with an array of
// `children` if it does not exist. Children are appended, otherwise.
({
buildNodeTree: function(nodes) {
var base, i, len, node, ref, result, st... | CoffeeScript | JavaScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | 3a6c454a7d1a5391ad45749f60026cecb1eb644d | 579 | https://github.com/nevir/groc/blob/3a6c454a7d1a5391ad45749f60026cecb1eb644d/lib/utils/style_helpers.coffee | 86 | 127 |
nevir/groc:lib/utils/style_helpers.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Take a flat, though ordered, list of nodes and convert them into a tree.
// Nodes are expected to have a `depth` property. Each node is annotated with an array of
// `children` if it does not exist. Children are appended, otherwise.
({
buildNodeTree: functi... | # Take a flat, though ordered, list of nodes and convert them into a tree.
#
# Nodes are expected to have a `depth` property. Each node is annotated with an array of
# `children` if it does not exist. Children are appended, otherwise.
buildNodeTree: (nodes) ->
result = []
stack = []
for node in ... | JavaScript | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | 3a6c454a7d1a5391ad45749f60026cecb1eb644d | 579 | https://github.com/nevir/groc/blob/3a6c454a7d1a5391ad45749f60026cecb1eb644d/lib/utils/style_helpers.coffee | 86 | 127 |
nevir/groc:lib/utils/style_helpers.coffee:3:completion | completion | # Take a flat, though ordered, list of nodes and convert them into a tree.
#
# Nodes are expected to have a `depth` property. Each node is annotated with an array of
# `children` if it does not exist. Children are appended, otherwise.
buildNodeTree: (nodes) ->
result = []
stack = []
for node in ... | result
# It helps visually to separate headers that are not attached to other comments into their own
# segment.
segmentizeSoloHeaders: (segments) ->
results = []
for segment in segments
headerOnly = segment.markdownedComments.match /^\s*<h\d[^>]*>[^<]*<\/h\d>\s*$/
if headerOnly and not segme... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | 3a6c454a7d1a5391ad45749f60026cecb1eb644d | 579 | https://github.com/nevir/groc/blob/3a6c454a7d1a5391ad45749f60026cecb1eb644d/lib/utils/style_helpers.coffee | 86 | 127 |
nevir/groc:lib/utils/style_helpers.coffee:1:raw_corpus | raw_corpus | # # Style Helpers
#
# A collection of helpful functions to support styles and their behavior.
StyleHelpers =
# Generate a table of contents as a tree of {node: {...}, children: []} objects.
#
# We want a pretty complex hierarchy in our table of contents:
# buildTableOfContents: (files) ->
# Given an array of... | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | ad129c0cb396c1bbf000e9954b167d442ae42c2d | 579 | https://github.com/nevir/groc/blob/ad129c0cb396c1bbf000e9954b167d442ae42c2d/lib/utils/style_helpers.coffee | 1 | 44 | ||
nevir/groc:lib/utils/style_helpers.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# # Style Helpers
#
# A collection of helpful functions to support styles and their behavior.
StyleHelpers =
# Generate a table of contents as a tree of {node: {...}, children: []} objects.
#
# We want a pretty complex hierarchy in our table of contents:
... | // # Style Helpers
// A collection of helpful functions to support styles and their behavior.
var StyleHelpers;
StyleHelpers = {
// Generate a table of contents as a tree of {node: {...}, children: []} objects.
// We want a pretty complex hierarchy in our table of contents:
// buildTableOfContents: (files) ->
... | CoffeeScript | JavaScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | ad129c0cb396c1bbf000e9954b167d442ae42c2d | 579 | https://github.com/nevir/groc/blob/ad129c0cb396c1bbf000e9954b167d442ae42c2d/lib/utils/style_helpers.coffee | 1 | 44 |
nevir/groc:lib/utils/style_helpers.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// # Style Helpers
// A collection of helpful functions to support styles and their behavior.
var StyleHelpers;
StyleHelpers = {
// Generate a table of contents as a tree of {node: {...}, children: []} objects.
// We want a pretty complex hierarchy in our ta... | # # Style Helpers
#
# A collection of helpful functions to support styles and their behavior.
StyleHelpers =
# Generate a table of contents as a tree of {node: {...}, children: []} objects.
#
# We want a pretty complex hierarchy in our table of contents:
# buildTableOfContents: (files) ->
# Given an array of... | JavaScript | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | ad129c0cb396c1bbf000e9954b167d442ae42c2d | 579 | https://github.com/nevir/groc/blob/ad129c0cb396c1bbf000e9954b167d442ae42c2d/lib/utils/style_helpers.coffee | 1 | 44 |
nevir/groc:lib/utils/style_helpers.coffee:1:completion | completion | # # Style Helpers
#
# A collection of helpful functions to support styles and their behavior.
StyleHelpers =
# Generate a table of contents as a tree of {node: {...}, children: []} objects.
#
# We want a pretty complex hierarchy in our table of contents:
# buildTableOfContents: (files) ->
# Given an array of... | @buildNodeTree nodes
# Generate a table of contents as a tree of {..., children: []} objects.
#
# We take a list of file info objects, and a map of outlines to fileInfo.targetPath.
#
# We want a pretty complex hierarchy in our table of contents:
buildTableOfContents: (files, outlines) ->
files = files.... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | ad129c0cb396c1bbf000e9954b167d442ae42c2d | 579 | https://github.com/nevir/groc/blob/ad129c0cb396c1bbf000e9954b167d442ae42c2d/lib/utils/style_helpers.coffee | 1 | 44 |
nevir/groc:lib/utils/style_helpers.coffee:2:raw_corpus | raw_corpus | # * If a file has the same name as a directory, it takes ownership of that directory's folder.
for chunk, i in pathChunks
if prevPath[i] != chunk
# * Otherwise we have a generic folder node that takes its place in the table of contents.
# TODO: We probably want some way to rename fol... | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | ad129c0cb396c1bbf000e9954b167d442ae42c2d | 579 | https://github.com/nevir/groc/blob/ad129c0cb396c1bbf000e9954b167d442ae42c2d/lib/utils/style_helpers.coffee | 46 | 84 | ||
nevir/groc:lib/utils/style_helpers.coffee:2:completion | completion | # * If a file has the same name as a directory, it takes ownership of that directory's folder.
for chunk, i in pathChunks
if prevPath[i] != chunk
# * Otherwise we have a generic folder node that takes its place in the table of contents.
# TODO: We probably want some way to rename fol... | #
# If possible, we use the initial header in the file,
if outlines[file.targetPath]?[0]?.data?.isFileHeader
fileData.firstHeader = outlines[file.targetPath].shift()
fileData.title = fileData.firstHeader.data.title
if fileData.firstHeader.children?.length > 0
outline... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | ad129c0cb396c1bbf000e9954b167d442ae42c2d | 579 | https://github.com/nevir/groc/blob/ad129c0cb396c1bbf000e9954b167d442ae42c2d/lib/utils/style_helpers.coffee | 46 | 84 |
nevir/groc:lib/utils/style_helpers.coffee:2:raw_corpus | raw_corpus | # * If a file has the same name as a directory, it takes ownership of that directory's folder.
for chunk, i in pathChunks
if prevPath[i] != chunk
# * Otherwise we have a generic folder node that takes its place in the table of contents.
# TODO: We probably want some way to rename fol... | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | e2d2229cac05e6ef5625b636587ca61e21edc288 | 579 | https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/utils/style_helpers.coffee | 46 | 84 | ||
nevir/groc:lib/utils/style_helpers.coffee:2:completion | completion | # * If a file has the same name as a directory, it takes ownership of that directory's folder.
for chunk, i in pathChunks
if prevPath[i] != chunk
# * Otherwise we have a generic folder node that takes its place in the table of contents.
# TODO: We probably want some way to rename fol... | #
# If possible, we use the initial header in the file,
if outlines[file.targetPath]?[0]?.data?.isFileHeader
fileData.firstHeader = outlines[file.targetPath].shift()
fileData.title = fileData.firstHeader.data.title
if fileData.firstHeader.children?.length > 0
outline... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/style_helpers.coffee | MIT | e2d2229cac05e6ef5625b636587ca61e21edc288 | 579 | https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/utils/style_helpers.coffee | 46 | 84 |
Pagedraw/pagedraw:src/migrations/noop-migration.coffee:1:raw_corpus | raw_corpus | require('../../coffeescript-register-web')
{migrationCheck} = require './map_prod'
migrationCheck (docjson) -> docjson | CoffeeScript | Pagedraw/pagedraw | src/migrations/noop-migration.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/migrations/noop-migration.coffee | 1 | 4 | ||
Pagedraw/pagedraw:src/migrations/noop-migration.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
require('../../coffeescript-register-web')
{migrationCheck} = require './map_prod'
migrationCheck (docjson) -> docjson
``` | var migrationCheck;
require('../../coffeescript-register-web');
({migrationCheck} = require('./map_prod'));
migrationCheck(function(docjson) {
return docjson;
}); | CoffeeScript | JavaScript | Pagedraw/pagedraw | src/migrations/noop-migration.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/migrations/noop-migration.coffee | 1 | 4 |
Pagedraw/pagedraw:src/migrations/noop-migration.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var migrationCheck;
require('../../coffeescript-register-web');
({migrationCheck} = require('./map_prod'));
migrationCheck(function(docjson) {
return docjson;
});
``` | require('../../coffeescript-register-web')
{migrationCheck} = require './map_prod'
migrationCheck (docjson) -> docjson | JavaScript | CoffeeScript | Pagedraw/pagedraw | src/migrations/noop-migration.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/migrations/noop-migration.coffee | 1 | 4 |
Pagedraw/pagedraw:src/migrations/noop-migration.coffee:1:completion | completion | require('../../coffeescript-register-web')
{migrationCheck} = require './map_prod' | migrationCheck (docjson) -> docjson | CoffeeScript | CoffeeScript | Pagedraw/pagedraw | src/migrations/noop-migration.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/migrations/noop-migration.coffee | 1 | 4 |
snd/url-pattern:test/errors.coffee:1:raw_corpus | raw_corpus | test = require 'tape'
UrlPattern = require '../lib/url-pattern'
test 'invalid argument', (t) ->
UrlPattern
t.plan 5
try
new UrlPattern()
catch e
t.equal e.message, "argument must be a regex or a string"
try
new UrlPattern(5)
catch e
t.equal e.message, "argument must be a regex or a string"
... | CoffeeScript | snd/url-pattern | test/errors.coffee | MIT | 845881ae23ee8dd2a2b106dfbadabe1d91b532a8 | 588 | https://github.com/snd/url-pattern/blob/845881ae23ee8dd2a2b106dfbadabe1d91b532a8/test/errors.coffee | 1 | 45 | ||
snd/url-pattern:test/errors.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
test = require 'tape'
UrlPattern = require '../lib/url-pattern'
test 'invalid argument', (t) ->
UrlPattern
t.plan 5
try
new UrlPattern()
catch e
t.equal e.message, "argument must be a regex or a string"
try
new UrlPattern(5)
catch e
t... | var UrlPattern, test;
test = require('tape');
UrlPattern = require('../lib/url-pattern');
test('invalid argument', function(t) {
UrlPattern;
var e;
t.plan(5);
try {
new UrlPattern();
} catch (error) {
e = error;
t.equal(e.message, "argument must be a regex or a string");
}
try {
new Url... | CoffeeScript | JavaScript | snd/url-pattern | test/errors.coffee | MIT | 845881ae23ee8dd2a2b106dfbadabe1d91b532a8 | 588 | https://github.com/snd/url-pattern/blob/845881ae23ee8dd2a2b106dfbadabe1d91b532a8/test/errors.coffee | 1 | 45 |
snd/url-pattern:test/errors.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var UrlPattern, test;
test = require('tape');
UrlPattern = require('../lib/url-pattern');
test('invalid argument', function(t) {
UrlPattern;
var e;
t.plan(5);
try {
new UrlPattern();
} catch (error) {
e = error;
t.equal(e.message, "argument... | test = require 'tape'
UrlPattern = require '../lib/url-pattern'
test 'invalid argument', (t) ->
UrlPattern
t.plan 5
try
new UrlPattern()
catch e
t.equal e.message, "argument must be a regex or a string"
try
new UrlPattern(5)
catch e
t.equal e.message, "argument must be a regex or a string"
... | JavaScript | CoffeeScript | snd/url-pattern | test/errors.coffee | MIT | 845881ae23ee8dd2a2b106dfbadabe1d91b532a8 | 588 | https://github.com/snd/url-pattern/blob/845881ae23ee8dd2a2b106dfbadabe1d91b532a8/test/errors.coffee | 1 | 45 |
snd/url-pattern:test/errors.coffee:1:completion | completion | test = require 'tape'
UrlPattern = require '../lib/url-pattern'
test 'invalid argument', (t) ->
UrlPattern
t.plan 5
try
new UrlPattern()
catch e
t.equal e.message, "argument must be a regex or a string"
try
new UrlPattern(5)
catch e
t.equal e.message, "argument must be a regex or a string"
... | try
new UrlPattern ' fo o'
catch e
t.equal e.message, "argument must not contain whitespace"
t.end()
test 'invalid variable name in pattern', (t) ->
UrlPattern
t.plan 3
try
new UrlPattern ':'
catch e
t.equal e.message, "couldn't parse pattern"
try
new UrlPattern ':.'
catch e
t.e... | CoffeeScript | CoffeeScript | snd/url-pattern | test/errors.coffee | MIT | 845881ae23ee8dd2a2b106dfbadabe1d91b532a8 | 588 | https://github.com/snd/url-pattern/blob/845881ae23ee8dd2a2b106dfbadabe1d91b532a8/test/errors.coffee | 1 | 45 |
snd/url-pattern:test/errors.coffee:2:raw_corpus | raw_corpus | test 'too many closing parentheses', (t) ->
t.plan 2
try
new UrlPattern ')'
catch e
# TODO did not plan ) at 0
t.equal e.message, "couldn't parse pattern"
try
new UrlPattern '((foo)))bar'
catch e
# TODO did not plan ) at 7
t.equal e.message, "could only partially parse pattern"
t.end... | CoffeeScript | snd/url-pattern | test/errors.coffee | MIT | 845881ae23ee8dd2a2b106dfbadabe1d91b532a8 | 588 | https://github.com/snd/url-pattern/blob/845881ae23ee8dd2a2b106dfbadabe1d91b532a8/test/errors.coffee | 47 | 89 | ||
snd/url-pattern:test/errors.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
test 'too many closing parentheses', (t) ->
t.plan 2
try
new UrlPattern ')'
catch e
# TODO did not plan ) at 0
t.equal e.message, "couldn't parse pattern"
try
new UrlPattern '((foo)))bar'
catch e
# TODO did not plan ) at 7
t.equa... | test('too many closing parentheses', function(t) {
var e;
t.plan(2);
try {
new UrlPattern(')');
} catch (error) {
e = error;
// TODO did not plan ) at 0
t.equal(e.message, "couldn't parse pattern");
}
try {
new UrlPattern('((foo)))bar');
} catch (error) {
e = error;
// TODO did... | CoffeeScript | JavaScript | snd/url-pattern | test/errors.coffee | MIT | 845881ae23ee8dd2a2b106dfbadabe1d91b532a8 | 588 | https://github.com/snd/url-pattern/blob/845881ae23ee8dd2a2b106dfbadabe1d91b532a8/test/errors.coffee | 47 | 89 |
snd/url-pattern:test/errors.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
test('too many closing parentheses', function(t) {
var e;
t.plan(2);
try {
new UrlPattern(')');
} catch (error) {
e = error;
// TODO did not plan ) at 0
t.equal(e.message, "couldn't parse pattern");
}
try {
new UrlPattern('((foo)))ba... | test 'too many closing parentheses', (t) ->
t.plan 2
try
new UrlPattern ')'
catch e
# TODO did not plan ) at 0
t.equal e.message, "couldn't parse pattern"
try
new UrlPattern '((foo)))bar'
catch e
# TODO did not plan ) at 7
t.equal e.message, "could only partially parse pattern"
t.end... | JavaScript | CoffeeScript | snd/url-pattern | test/errors.coffee | MIT | 845881ae23ee8dd2a2b106dfbadabe1d91b532a8 | 588 | https://github.com/snd/url-pattern/blob/845881ae23ee8dd2a2b106dfbadabe1d91b532a8/test/errors.coffee | 47 | 89 |
snd/url-pattern:test/errors.coffee:2:completion | completion | test 'too many closing parentheses', (t) ->
t.plan 2
try
new UrlPattern ')'
catch e
# TODO did not plan ) at 0
t.equal e.message, "couldn't parse pattern"
try
new UrlPattern '((foo)))bar'
catch e
# TODO did not plan ) at 7
t.equal e.message, "could only partially parse pattern"
t.end... | try
new UrlPattern '(((foo)bar(boo)far)'
catch e
# TODO unclosed parentheses at 19
t.equal e.message, "couldn't parse pattern"
t.end()
test 'regex names', (t) ->
t.plan 3
try
new UrlPattern /x/, 5
catch e
t.equal e.message, 'if first argument is a regex the second argument may be an array... | CoffeeScript | CoffeeScript | snd/url-pattern | test/errors.coffee | MIT | 845881ae23ee8dd2a2b106dfbadabe1d91b532a8 | 588 | https://github.com/snd/url-pattern/blob/845881ae23ee8dd2a2b106dfbadabe1d91b532a8/test/errors.coffee | 47 | 89 |
snd/url-pattern:test/errors.coffee:3:raw_corpus | raw_corpus | test 'stringify regex', (t) ->
t.plan 1
pattern = new UrlPattern /x/
try
pattern.stringify()
catch e
t.equal e.message, "can't stringify patterns generated from a regex"
t.end()
test 'stringify argument', (t) ->
t.plan 1
pattern = new UrlPattern 'foo'
try
pattern.stringify(5)
catch e
... | CoffeeScript | snd/url-pattern | test/errors.coffee | MIT | 845881ae23ee8dd2a2b106dfbadabe1d91b532a8 | 588 | https://github.com/snd/url-pattern/blob/845881ae23ee8dd2a2b106dfbadabe1d91b532a8/test/errors.coffee | 91 | 107 | ||
snd/url-pattern:test/errors.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
test 'stringify regex', (t) ->
t.plan 1
pattern = new UrlPattern /x/
try
pattern.stringify()
catch e
t.equal e.message, "can't stringify patterns generated from a regex"
t.end()
test 'stringify argument', (t) ->
t.plan 1
pattern = new UrlPa... | test('stringify regex', function(t) {
var e, pattern;
t.plan(1);
pattern = new UrlPattern(/x/);
try {
pattern.stringify();
} catch (error) {
e = error;
t.equal(e.message, "can't stringify patterns generated from a regex");
}
return t.end();
});
test('stringify argument', function(t) {
var e... | CoffeeScript | JavaScript | snd/url-pattern | test/errors.coffee | MIT | 845881ae23ee8dd2a2b106dfbadabe1d91b532a8 | 588 | https://github.com/snd/url-pattern/blob/845881ae23ee8dd2a2b106dfbadabe1d91b532a8/test/errors.coffee | 91 | 107 |
snd/url-pattern:test/errors.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
test('stringify regex', function(t) {
var e, pattern;
t.plan(1);
pattern = new UrlPattern(/x/);
try {
pattern.stringify();
} catch (error) {
e = error;
t.equal(e.message, "can't stringify patterns generated from a regex");
}
return t.end()... | test 'stringify regex', (t) ->
t.plan 1
pattern = new UrlPattern /x/
try
pattern.stringify()
catch e
t.equal e.message, "can't stringify patterns generated from a regex"
t.end()
test 'stringify argument', (t) ->
t.plan 1
pattern = new UrlPattern 'foo'
try
pattern.stringify(5)
catch e
... | JavaScript | CoffeeScript | snd/url-pattern | test/errors.coffee | MIT | 845881ae23ee8dd2a2b106dfbadabe1d91b532a8 | 588 | https://github.com/snd/url-pattern/blob/845881ae23ee8dd2a2b106dfbadabe1d91b532a8/test/errors.coffee | 91 | 107 |
snd/url-pattern:test/errors.coffee:3:completion | completion | test 'stringify regex', (t) ->
t.plan 1
pattern = new UrlPattern /x/
try
pattern.stringify()
catch e
t.equal e.message, "can't stringify patterns generated from a regex"
t.end() | test 'stringify argument', (t) ->
t.plan 1
pattern = new UrlPattern 'foo'
try
pattern.stringify(5)
catch e
t.equal e.message, "argument must be an object or undefined"
t.end() | CoffeeScript | CoffeeScript | snd/url-pattern | test/errors.coffee | MIT | 845881ae23ee8dd2a2b106dfbadabe1d91b532a8 | 588 | https://github.com/snd/url-pattern/blob/845881ae23ee8dd2a2b106dfbadabe1d91b532a8/test/errors.coffee | 91 | 107 |
snd/url-pattern:test/errors.coffee:1:raw_corpus | raw_corpus | module.exports =
'invalid argument': (test) ->
UrlPattern
test.expect 5
try
new UrlPattern()
catch e
test.equal e.message, "argument must be a regex or a string"
try
new UrlPattern(5)
catch e
test.equal e.message, "argument must be a regex or a string"
try
ne... | CoffeeScript | snd/url-pattern | test/errors.coffee | MIT | d9843a09ca2171908c18198f7906eae6a58086e6 | 588 | https://github.com/snd/url-pattern/blob/d9843a09ca2171908c18198f7906eae6a58086e6/test/errors.coffee | 3 | 52 | ||
snd/url-pattern:test/errors.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
'invalid argument': (test) ->
UrlPattern
test.expect 5
try
new UrlPattern()
catch e
test.equal e.message, "argument must be a regex or a string"
try
new UrlPattern(5)
catch e
test.equal e.message... | module.exports = {
'invalid argument': function(test) {
UrlPattern;
var e;
test.expect(5);
try {
new UrlPattern();
} catch (error) {
e = error;
test.equal(e.message, "argument must be a regex or a string");
}
try {
new UrlPattern(5);
} catch (error) {
e = ... | CoffeeScript | JavaScript | snd/url-pattern | test/errors.coffee | MIT | d9843a09ca2171908c18198f7906eae6a58086e6 | 588 | https://github.com/snd/url-pattern/blob/d9843a09ca2171908c18198f7906eae6a58086e6/test/errors.coffee | 3 | 52 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.