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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
orktes/atom-react:lib/atom-react.coffee:2:completion | completion | return @editor.indentationForBufferRow(precedingRow)
precedingLine = @buffer.lineForRow(precedingRow)
return indent if not precedingLine?
indent += 1 if tagStartRegex.testSync(precedingLine) and complexAttributeRegex.testSync(precedingLine) and not @editor.isBufferRowCommented(precedingRow)
i... | autoSetGrammar: (editor) ->
return if @isReactEnabledForEditor editor
path = require 'path'
# Check if file extension is .jsx or the file has the old JSX notation
extName = path.extname(editor.getPath())
if extName is ".jsx" or (extName is ".js" and @isJSX(editor.getText()))
jsxGrammar = ato... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | cbdc69554e7cb49c1a1a9f4c6fa414fc1f40c2b9 | 473 | https://github.com/orktes/atom-react/blob/cbdc69554e7cb49c1a1a9f4c6fa414fc1f40c2b9/lib/atom-react.coffee | 53 | 102 |
orktes/atom-react:lib/atom-react.coffee:1:raw_corpus | raw_corpus | class AtomReact
Subscriber.includeInto(this)
constructor: ->
patchEditorLangModeAutoDecreaseIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.autoDecreaseIndentForBufferRow
editor.languageMode.autoDecreaseIndentForBufferRow = (bufferRow, options) ->
return fn.call(editor.langu... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | a335d3e9bd22059620712212735395d96250d436 | 473 | https://github.com/orktes/atom-react/blob/a335d3e9bd22059620712212735395d96250d436/lib/atom-react.coffee | 3 | 52 | ||
orktes/atom-react:lib/atom-react.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class AtomReact
Subscriber.includeInto(this)
constructor: ->
patchEditorLangModeAutoDecreaseIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.autoDecreaseIndentForBufferRow
editor.languageMode.autoDecreaseIndentForBufferRow = ... | var AtomReact;
AtomReact = (function() {
class AtomReact {
constructor() {}
patchEditorLangModeAutoDecreaseIndentForBufferRow(editor) {
var fn, self;
self = this;
fn = editor.languageMode.autoDecreaseIndentForBufferRow;
return editor.languageMode.autoDecreaseIndentForBufferRow = func... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | a335d3e9bd22059620712212735395d96250d436 | 473 | https://github.com/orktes/atom-react/blob/a335d3e9bd22059620712212735395d96250d436/lib/atom-react.coffee | 3 | 52 |
orktes/atom-react:lib/atom-react.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var AtomReact;
AtomReact = (function() {
class AtomReact {
constructor() {}
patchEditorLangModeAutoDecreaseIndentForBufferRow(editor) {
var fn, self;
self = this;
fn = editor.languageMode.autoDecreaseIndentForBufferRow;
return ed... | class AtomReact
Subscriber.includeInto(this)
constructor: ->
patchEditorLangModeAutoDecreaseIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.autoDecreaseIndentForBufferRow
editor.languageMode.autoDecreaseIndentForBufferRow = (bufferRow, options) ->
return fn.call(editor.langu... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | a335d3e9bd22059620712212735395d96250d436 | 473 | https://github.com/orktes/atom-react/blob/a335d3e9bd22059620712212735395d96250d436/lib/atom-react.coffee | 3 | 52 |
orktes/atom-react:lib/atom-react.coffee:1:completion | completion | class AtomReact
Subscriber.includeInto(this)
constructor: ->
patchEditorLangModeAutoDecreaseIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.autoDecreaseIndentForBufferRow
editor.languageMode.autoDecreaseIndentForBufferRow = (bufferRow, options) ->
return fn.call(editor.langu... | currentIndentLevel -= 1 if decreaseIndentRegex and decreaseIndentRegex.testSync(line)
desiredIndentLevel = currentIndentLevel - 1
if desiredIndentLevel >= 0 and desiredIndentLevel < currentIndentLevel
@editor.setIndentationForBufferRow(bufferRow, desiredIndentLevel)
else
fn.call(... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | a335d3e9bd22059620712212735395d96250d436 | 473 | https://github.com/orktes/atom-react/blob/a335d3e9bd22059620712212735395d96250d436/lib/atom-react.coffee | 3 | 52 |
orktes/atom-react:lib/atom-react.coffee:2:raw_corpus | raw_corpus | return indent if not precedingLine?
indent += 1 if tagStartRegex.testSync(precedingLine) and complexAttributeRegex.testSync(precedingLine)
indent -= 1 if precedingLine and decreaseNextLineIndentRegex.testSync(precedingLine)
return Math.max(indent, 0)
patchEditorLangMode: (editor) ->
@patchEdi... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | a335d3e9bd22059620712212735395d96250d436 | 473 | https://github.com/orktes/atom-react/blob/a335d3e9bd22059620712212735395d96250d436/lib/atom-react.coffee | 53 | 102 | ||
orktes/atom-react:lib/atom-react.coffee:2:completion | completion | return indent if not precedingLine?
indent += 1 if tagStartRegex.testSync(precedingLine) and complexAttributeRegex.testSync(precedingLine)
indent -= 1 if precedingLine and decreaseNextLineIndentRegex.testSync(precedingLine)
return Math.max(indent, 0)
patchEditorLangMode: (editor) ->
@patchEdi... | # Check if file extension is .jsx or the file has the old JSX notation
extName = path.extname(editor.getPath())
if extName is ".jsx" or (extName is ".js" and @isJSX(editor.getText()))
jsxGrammar = atom.syntax.grammarsByScopeName["source.js.jsx"]
editor.setGrammar jsxGrammar if jsxGrammar
onHTMLTo... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | a335d3e9bd22059620712212735395d96250d436 | 473 | https://github.com/orktes/atom-react/blob/a335d3e9bd22059620712212735395d96250d436/lib/atom-react.coffee | 53 | 102 |
orktes/atom-react:lib/atom-react.coffee:3:raw_corpus | raw_corpus | jsxformat.setOptions({});
jsxOutput = jsxformat.format(jsxOutput)
selection.insertText(jsxOutput, autoIndent: true);
onReformat: ->
jsxformat = require 'jsxformat'
_ = require 'lodash'
editor = atom.workspace.getActiveEditor()
return if not @isReactEnabledForEditor editor
... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | a335d3e9bd22059620712212735395d96250d436 | 473 | https://github.com/orktes/atom-react/blob/a335d3e9bd22059620712212735395d96250d436/lib/atom-react.coffee | 103 | 152 | ||
orktes/atom-react:lib/atom-react.coffee:3:completion | completion | jsxformat.setOptions({});
jsxOutput = jsxformat.format(jsxOutput)
selection.insertText(jsxOutput, autoIndent: true);
onReformat: ->
jsxformat = require 'jsxformat'
_ = require 'lodash'
editor = atom.workspace.getActiveEditor()
return if not @isReactEnabledForEditor editor
... | range = selection.getBufferRange().serialize()
# esprima ast line count starts for 1
range[0][0]++
range[1][0]++
jsxformat.setOptions({range: range});
# TODO: use fold
original = editor.getText();
try
result = jsxformat.format(original... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | a335d3e9bd22059620712212735395d96250d436 | 473 | https://github.com/orktes/atom-react/blob/a335d3e9bd22059620712212735395d96250d436/lib/atom-react.coffee | 103 | 152 |
orktes/atom-react:lib/atom-react.coffee:4:raw_corpus | raw_corpus | processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseIndentForNextLinePattern = '/>\\s*,?\\s*$'
atom.config.s... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | a335d3e9bd22059620712212735395d96250d436 | 473 | https://github.com/orktes/atom-react/blob/a335d3e9bd22059620712212735395d96250d436/lib/atom-react.coffee | 153 | 171 | ||
orktes/atom-react:lib/atom-react.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseInde... | ({
processEditor: function(editor) {
this.patchEditorLangMode(editor);
return this.autoSetGrammar(editor);
},
activate: function() {
var decreaseIndentForNextLinePattern, jsxComplexAttributePattern, jsxTagStartPattern;
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))';
jsxC... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | a335d3e9bd22059620712212735395d96250d436 | 473 | https://github.com/orktes/atom-react/blob/a335d3e9bd22059620712212735395d96250d436/lib/atom-react.coffee | 153 | 171 |
orktes/atom-react:lib/atom-react.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
processEditor: function(editor) {
this.patchEditorLangMode(editor);
return this.autoSetGrammar(editor);
},
activate: function() {
var decreaseIndentForNextLinePattern, jsxComplexAttributePattern, jsxTagStartPattern;
jsxTagStartPattern = '(?... | processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseIndentForNextLinePattern = '/>\\s*,?\\s*$'
atom.config.s... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | a335d3e9bd22059620712212735395d96250d436 | 473 | https://github.com/orktes/atom-react/blob/a335d3e9bd22059620712212735395d96250d436/lib/atom-react.coffee | 153 | 171 |
orktes/atom-react:lib/atom-react.coffee:4:completion | completion | processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseIndentForNextLinePattern = '/>\\s*,?\\s*$' | atom.config.set("react.jsxTagStartPattern", jsxTagStartPattern)
atom.config.set("react.jsxComplexAttributePattern", jsxComplexAttributePattern)
atom.config.set("react.decreaseIndentForNextLinePattern", decreaseIndentForNextLinePattern)
# Bind events
atom.commands.add 'atom-workspace', 'react:reformat-J... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | a335d3e9bd22059620712212735395d96250d436 | 473 | https://github.com/orktes/atom-react/blob/a335d3e9bd22059620712212735395d96250d436/lib/atom-react.coffee | 153 | 171 |
orktes/atom-react:lib/atom-react.coffee:3:raw_corpus | raw_corpus | jsxformat.setOptions({});
jsxOutput = jsxformat.format(jsxOutput)
selection.insertText(jsxOutput, autoIndent: true);
onReformat: ->
jsxformat = require 'jsxformat'
_ = require 'lodash'
editor = atom.workspace.getActiveEditor()
return if not @isReactEnabledForEditor editor
... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 393e92b4f9d37201559b153e2c5fee5b974a0684 | 473 | https://github.com/orktes/atom-react/blob/393e92b4f9d37201559b153e2c5fee5b974a0684/lib/atom-react.coffee | 103 | 152 | ||
orktes/atom-react:lib/atom-react.coffee:3:completion | completion | jsxformat.setOptions({});
jsxOutput = jsxformat.format(jsxOutput)
selection.insertText(jsxOutput, autoIndent: true);
onReformat: ->
jsxformat = require 'jsxformat'
_ = require 'lodash'
editor = atom.workspace.getActiveEditor()
return if not @isReactEnabledForEditor editor
... | # Parsing/formatting the selection failed lets try to parse the whole file but format the selection only
range = selection.getBufferRange().serialize()
# esprima ast line count starts for 1
range[0][0]++
range[1][0]++
jsxformat.setOptions({range: range});
# ... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 393e92b4f9d37201559b153e2c5fee5b974a0684 | 473 | https://github.com/orktes/atom-react/blob/393e92b4f9d37201559b153e2c5fee5b974a0684/lib/atom-react.coffee | 103 | 152 |
orktes/atom-react:lib/atom-react.coffee:4:raw_corpus | raw_corpus | editor.setCursorBufferPosition([firstChangedLine, range[0][1]])
processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
d... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 393e92b4f9d37201559b153e2c5fee5b974a0684 | 473 | https://github.com/orktes/atom-react/blob/393e92b4f9d37201559b153e2c5fee5b974a0684/lib/atom-react.coffee | 153 | 173 | ||
orktes/atom-react:lib/atom-react.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
editor.setCursorBufferPosition([firstChangedLine, range[0][1]])
processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAtt... | editor.setCursorBufferPosition([firstChangedLine, range[0][1]])({
processEditor: function(editor) {
this.patchEditorLangMode(editor);
return this.autoSetGrammar(editor);
},
activate: function() {
var decreaseIndentForNextLinePattern, jsxComplexAttributePattern, jsxTagStartPattern;
jsxTagStartPatte... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | 393e92b4f9d37201559b153e2c5fee5b974a0684 | 473 | https://github.com/orktes/atom-react/blob/393e92b4f9d37201559b153e2c5fee5b974a0684/lib/atom-react.coffee | 153 | 173 |
orktes/atom-react:lib/atom-react.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
editor.setCursorBufferPosition([firstChangedLine, range[0][1]])({
processEditor: function(editor) {
this.patchEditorLangMode(editor);
return this.autoSetGrammar(editor);
},
activate: function() {
var decreaseIndentForNextLinePattern, jsxComplexAtt... | editor.setCursorBufferPosition([firstChangedLine, range[0][1]])
processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
d... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 393e92b4f9d37201559b153e2c5fee5b974a0684 | 473 | https://github.com/orktes/atom-react/blob/393e92b4f9d37201559b153e2c5fee5b974a0684/lib/atom-react.coffee | 153 | 173 |
orktes/atom-react:lib/atom-react.coffee:4:completion | completion | editor.setCursorBufferPosition([firstChangedLine, range[0][1]])
processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $' | decreaseIndentForNextLinePattern = '/>\\s*,?\\s*$'
atom.config.set("react.jsxTagStartPattern", jsxTagStartPattern)
atom.config.set("react.jsxComplexAttributePattern", jsxComplexAttributePattern)
atom.config.set("react.decreaseIndentForNextLinePattern", decreaseIndentForNextLinePattern)
# Bind events
... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 393e92b4f9d37201559b153e2c5fee5b974a0684 | 473 | https://github.com/orktes/atom-react/blob/393e92b4f9d37201559b153e2c5fee5b974a0684/lib/atom-react.coffee | 153 | 173 |
orktes/atom-react:lib/atom-react.coffee:4:raw_corpus | raw_corpus | processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseIndentForNextLinePattern = '/>\\s*,?\\s*$'
atom.config.s... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 02f63b4b1471997195cc5c0a9141eb694b5d4778 | 473 | https://github.com/orktes/atom-react/blob/02f63b4b1471997195cc5c0a9141eb694b5d4778/lib/atom-react.coffee | 153 | 171 | ||
orktes/atom-react:lib/atom-react.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseInde... | ({
processEditor: function(editor) {
this.patchEditorLangMode(editor);
return this.autoSetGrammar(editor);
},
activate: function() {
var decreaseIndentForNextLinePattern, jsxComplexAttributePattern, jsxTagStartPattern;
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))';
jsxC... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | 02f63b4b1471997195cc5c0a9141eb694b5d4778 | 473 | https://github.com/orktes/atom-react/blob/02f63b4b1471997195cc5c0a9141eb694b5d4778/lib/atom-react.coffee | 153 | 171 |
orktes/atom-react:lib/atom-react.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
processEditor: function(editor) {
this.patchEditorLangMode(editor);
return this.autoSetGrammar(editor);
},
activate: function() {
var decreaseIndentForNextLinePattern, jsxComplexAttributePattern, jsxTagStartPattern;
jsxTagStartPattern = '(?... | processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseIndentForNextLinePattern = '/>\\s*,?\\s*$'
atom.config.s... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 02f63b4b1471997195cc5c0a9141eb694b5d4778 | 473 | https://github.com/orktes/atom-react/blob/02f63b4b1471997195cc5c0a9141eb694b5d4778/lib/atom-react.coffee | 153 | 171 |
orktes/atom-react:lib/atom-react.coffee:4:completion | completion | processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseIndentForNextLinePattern = '/>\\s*,?\\s*$' | atom.config.set("react.jsxTagStartPattern", jsxTagStartPattern)
atom.config.set("react.jsxComplexAttributePattern", jsxComplexAttributePattern)
atom.config.set("react.decreaseIndentForNextLinePattern", decreaseIndentForNextLinePattern)
# Bind events
atom.commands.add 'atom-workspace', 'react:reformat-J... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 02f63b4b1471997195cc5c0a9141eb694b5d4778 | 473 | https://github.com/orktes/atom-react/blob/02f63b4b1471997195cc5c0a9141eb694b5d4778/lib/atom-react.coffee | 153 | 171 |
orktes/atom-react:lib/atom-react.coffee:2:raw_corpus | raw_corpus | return indent if not precedingLine?
indent += 1 if tagStartRegex.testSync(precedingLine) and complexAttributeRegex.testSync(precedingLine)
indent -= 1 if precedingLine and decreaseNextLineIndentRegex.testSync(precedingLine)
return Math.max(indent, 0)
patchEditorLangMode: (editor) ->
@patchEdi... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 843f6d7de393223ed5cdb818ce467612917922f1 | 473 | https://github.com/orktes/atom-react/blob/843f6d7de393223ed5cdb818ce467612917922f1/lib/atom-react.coffee | 53 | 102 | ||
orktes/atom-react:lib/atom-react.coffee:2:completion | completion | return indent if not precedingLine?
indent += 1 if tagStartRegex.testSync(precedingLine) and complexAttributeRegex.testSync(precedingLine)
indent -= 1 if precedingLine and decreaseNextLineIndentRegex.testSync(precedingLine)
return Math.max(indent, 0)
patchEditorLangMode: (editor) ->
@patchEdi... | extName = path.extname(editor.getPath())
if extName is ".jsx" or (extName is ".js" and @isJSX(editor.getText()))
jsxGrammar = atom.syntax.grammarsByScopeName["source.js.jsx"]
editor.setGrammar jsxGrammar if jsxGrammar
onHTMLToJSX: ->
jsxformat = require 'jsxformat'
HTMLtoJSX = require './html... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 843f6d7de393223ed5cdb818ce467612917922f1 | 473 | https://github.com/orktes/atom-react/blob/843f6d7de393223ed5cdb818ce467612917922f1/lib/atom-react.coffee | 53 | 102 |
orktes/atom-react:lib/atom-react.coffee:3:raw_corpus | raw_corpus | selection.insertText(jsxOutput, autoIndent: true);
onReformat: ->
jsxformat = require 'jsxformat'
_ = require 'lodash'
editor = atom.workspace.getActiveEditor()
return if not editor?
selections = editor.getSelections()
editor.transact =>
for selection in selections
try
... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 843f6d7de393223ed5cdb818ce467612917922f1 | 473 | https://github.com/orktes/atom-react/blob/843f6d7de393223ed5cdb818ce467612917922f1/lib/atom-react.coffee | 103 | 152 | ||
orktes/atom-react:lib/atom-react.coffee:3:completion | completion | selection.insertText(jsxOutput, autoIndent: true);
onReformat: ->
jsxformat = require 'jsxformat'
_ = require 'lodash'
editor = atom.workspace.getActiveEditor()
return if not editor?
selections = editor.getSelections()
editor.transact =>
for selection in selections
try
... | jsxformat.setOptions({range: range});
# TODO: use fold
original = editor.getText();
try
result = jsxformat.format(original)
selection.clear()
originalLineCount = editor.getLineCount()
editor.setText(result)
newLineCount = edito... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 843f6d7de393223ed5cdb818ce467612917922f1 | 473 | https://github.com/orktes/atom-react/blob/843f6d7de393223ed5cdb818ce467612917922f1/lib/atom-react.coffee | 103 | 152 |
orktes/atom-react:lib/atom-react.coffee:4:raw_corpus | raw_corpus | @autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseIndentForNextLinePattern = '/>\\s*,?\\s*$'
atom.config.set("react.jsxTagStartPattern", jsxTagStartPattern)
atom.conf... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 843f6d7de393223ed5cdb818ce467612917922f1 | 473 | https://github.com/orktes/atom-react/blob/843f6d7de393223ed5cdb818ce467612917922f1/lib/atom-react.coffee | 153 | 168 | ||
orktes/atom-react:lib/atom-react.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseIndentForNextLinePattern = '/>\\s*,?\\s*$'
atom.config.set("rea... | this.autoSetGrammar(editor)({
activate: function() {
var decreaseIndentForNextLinePattern, jsxComplexAttributePattern, jsxTagStartPattern;
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))';
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $';
decreaseIndentForNextLineP... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | 843f6d7de393223ed5cdb818ce467612917922f1 | 473 | https://github.com/orktes/atom-react/blob/843f6d7de393223ed5cdb818ce467612917922f1/lib/atom-react.coffee | 153 | 168 |
orktes/atom-react:lib/atom-react.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.autoSetGrammar(editor)({
activate: function() {
var decreaseIndentForNextLinePattern, jsxComplexAttributePattern, jsxTagStartPattern;
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))';
jsxComplexAttributePattern = '(?x)\\{ [^}... | @autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseIndentForNextLinePattern = '/>\\s*,?\\s*$'
atom.config.set("react.jsxTagStartPattern", jsxTagStartPattern)
atom.conf... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 843f6d7de393223ed5cdb818ce467612917922f1 | 473 | https://github.com/orktes/atom-react/blob/843f6d7de393223ed5cdb818ce467612917922f1/lib/atom-react.coffee | 153 | 168 |
orktes/atom-react:lib/atom-react.coffee:4:completion | completion | @autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseIndentForNextLinePattern = '/>\\s*,?\\s*$'
atom.config.set("react.jsxTagStartPattern", jsxTagStartPattern) | atom.config.set("react.jsxComplexAttributePattern", jsxComplexAttributePattern)
atom.config.set("react.decreaseIndentForNextLinePattern", decreaseIndentForNextLinePattern)
# Bind events
atom.commands.add 'atom-workspace', 'react:reformat-JSX', @onReformat
atom.commands.add 'atom-workspace', 'react:HTML... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 843f6d7de393223ed5cdb818ce467612917922f1 | 473 | https://github.com/orktes/atom-react/blob/843f6d7de393223ed5cdb818ce467612917922f1/lib/atom-react.coffee | 153 | 168 |
orktes/atom-react:lib/atom-react.coffee:2:raw_corpus | raw_corpus | return indent if not precedingLine?
indent += 1 if tagStartRegex.testSync(precedingLine) and complexAttributeRegex.testSync(precedingLine)
indent -= 1 if precedingLine and decreaseNextLineIndentRegex.testSync(precedingLine)
return Math.max(indent, 0)
patchEditorLangMode: (editor) ->
@patchEdi... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 943121788f540b8076899bcc00e3fa4a9432707f | 473 | https://github.com/orktes/atom-react/blob/943121788f540b8076899bcc00e3fa4a9432707f/lib/atom-react.coffee | 53 | 102 | ||
orktes/atom-react:lib/atom-react.coffee:2:completion | completion | return indent if not precedingLine?
indent += 1 if tagStartRegex.testSync(precedingLine) and complexAttributeRegex.testSync(precedingLine)
indent -= 1 if precedingLine and decreaseNextLineIndentRegex.testSync(precedingLine)
return Math.max(indent, 0)
patchEditorLangMode: (editor) ->
@patchEdi... | extName = path.extname(editor.getPath())
if extName is ".jsx" or (extName is ".js" and @isJSX(editor.getText()))
jsxGrammar = atom.syntax.grammarsByScopeName["source.js.jsx"]
editor.setGrammar jsxGrammar if jsxGrammar
onHTMLToJSX: ->
jsxformat = require 'jsxformat'
HTMLtoJSX = require './lib/... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 943121788f540b8076899bcc00e3fa4a9432707f | 473 | https://github.com/orktes/atom-react/blob/943121788f540b8076899bcc00e3fa4a9432707f/lib/atom-react.coffee | 53 | 102 |
js2coffee/js2coffee:lib/builder/base.coffee:1:raw_corpus | raw_corpus | class BuilderBase
constructor: (@root, @options={}) ->
@path = []
run: ->
@walk(@root)
walk: (node, type) =>
oldLength = @path.length
@path.push(node)
type = undefined if typeof type isnt 'string'
type or= node.type
@ctx = { path: @path, type: type, parent: @path[@path.length-2] }
... | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/base.coffee | 28 | 77 | ||
js2coffee/js2coffee:lib/builder/base.coffee:1:completion | completion | class BuilderBase
constructor: (@root, @options={}) ->
@path = []
run: ->
@walk(@root)
walk: (node, type) =>
oldLength = @path.length
@path.push(node)
type = undefined if typeof type isnt 'string'
type or= node.type
@ctx = { path: @path, type: type, parent: @path[@path.length-2] }
... | else
out = @onUnknownNode(node, @ctx)
@path.splice(oldLength)
out
###*
# get():
# Returns the output of source-map.
###
get: ->
node = @run()
node = stripSpaces(node)
node.toStringWithSourceMap()
###*
# decorator():
# Takes the output of each of the node visitors and turns ... | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/base.coffee | 28 | 77 |
js2coffee/js2coffee:lib/builder/base.coffee:2:raw_corpus | raw_corpus | node?.loc?.start?.line,
node?.loc?.start?.column,
@options.filename,
output) | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/base.coffee | 78 | 81 | ||
js2coffee/js2coffee:lib/builder/base.coffee:2:completion | completion | node?.loc?.start?.line,
node?.loc?.start?.column, | @options.filename,
output) | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/builder/base.coffee | 78 | 81 |
js2coffee/js2coffee:lib/builder/base.coffee:1:raw_corpus | raw_corpus | class BuilderBase
constructor: (@root, @options={}) ->
@path = []
run: ->
@walk(@root)
walk: (node, type) =>
oldLength = @path.length
@path.push(node)
type = undefined if typeof type isnt 'string'
type or= node.type
@ctx = { path: @path, type: type, parent: @path[@path.length-2] }
... | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 26 | 75 | ||
js2coffee/js2coffee:lib/builder/base.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class BuilderBase
constructor: (@root, @options={}) ->
@path = []
run: ->
@walk(@root)
walk: (node, type) =>
oldLength = @path.length
@path.push(node)
type = undefined if typeof type isnt 'string'
type or= node.type
@ctx = { p... | var BuilderBase;
BuilderBase = class BuilderBase {
constructor(root, options = {}) {
this.walk = this.walk.bind(this);
this.root = root;
this.options = options;
this.path = [];
}
run() {
return this.walk(this.root);
}
walk(node, type) {
var fn, oldLength, out;
oldLength = this.p... | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 26 | 75 |
js2coffee/js2coffee:lib/builder/base.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var BuilderBase;
BuilderBase = class BuilderBase {
constructor(root, options = {}) {
this.walk = this.walk.bind(this);
this.root = root;
this.options = options;
this.path = [];
}
run() {
return this.walk(this.root);
}
walk(node, typ... | class BuilderBase
constructor: (@root, @options={}) ->
@path = []
run: ->
@walk(@root)
walk: (node, type) =>
oldLength = @path.length
@path.push(node)
type = undefined if typeof type isnt 'string'
type or= node.type
@ctx = { path: @path, type: type, parent: @path[@path.length-2] }
... | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 26 | 75 |
js2coffee/js2coffee:lib/builder/base.coffee:1:completion | completion | class BuilderBase
constructor: (@root, @options={}) ->
@path = []
run: ->
@walk(@root)
walk: (node, type) =>
oldLength = @path.length
@path.push(node)
type = undefined if typeof type isnt 'string'
type or= node.type
@ctx = { path: @path, type: type, parent: @path[@path.length-2] }
... | else
out = @onUnknownNode(node, @ctx)
@path.splice(oldLength)
out
###*
# get():
# Returns the output of source-map.
###
get: ->
node = @run()
node = stripPre(node)
node = stripPost(node)
node = stripMid(node)
node.toStringWithSourceMap()
###*
# decorator():
# Takes ... | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 26 | 75 |
js2coffee/js2coffee:lib/builder/base.coffee:2:raw_corpus | raw_corpus | {SourceNode} = require("source-map")
new SourceNode(
node?.loc?.start?.line,
node?.loc?.start?.column,
@options.filename,
output) | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 76 | 81 | ||
js2coffee/js2coffee:lib/builder/base.coffee:2:completion | completion | {SourceNode} = require("source-map")
new SourceNode(
node?.loc?.start?.line, | node?.loc?.start?.column,
@options.filename,
output) | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 76 | 81 |
js2coffee/js2coffee:lib/builder/base.coffee:4:raw_corpus | raw_corpus | stripPre = (node) ->
wreplace node, {}, (n) ->
throw n unless n.match(/^\s*\n+\s*$/)
""
###
# strip ending newlines
### | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 93 | 100 | ||
js2coffee/js2coffee:lib/builder/base.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
stripPre = (node) ->
wreplace node, {}, (n) ->
throw n unless n.match(/^\s*\n+\s*$/)
""
###
# strip ending newlines
###
``` | var stripPre;
stripPre = function(node) {
return wreplace(node, {}, function(n) {
if (!n.match(/^\s*\n+\s*$/)) {
throw n;
}
return "";
});
};
/*
* strip ending newlines
*/ | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 93 | 100 |
js2coffee/js2coffee:lib/builder/base.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var stripPre;
stripPre = function(node) {
return wreplace(node, {}, function(n) {
if (!n.match(/^\s*\n+\s*$/)) {
throw n;
}
return "";
});
};
/*
* strip ending newlines
*/
``` | stripPre = (node) ->
wreplace node, {}, (n) ->
throw n unless n.match(/^\s*\n+\s*$/)
""
###
# strip ending newlines
### | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 93 | 100 |
js2coffee/js2coffee:lib/builder/base.coffee:5:raw_corpus | raw_corpus | stripPost = (node) ->
wreplace node, reverse: true, (n) ->
throw "#{n}\n" unless n.match(/^\s*\n+\s*$/)
""
###
# strip triple new lines
### | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 102 | 109 | ||
js2coffee/js2coffee:lib/builder/base.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
stripPost = (node) ->
wreplace node, reverse: true, (n) ->
throw "#{n}\n" unless n.match(/^\s*\n+\s*$/)
""
###
# strip triple new lines
###
``` | var stripPost;
stripPost = function(node) {
return wreplace(node, {
reverse: true
}, function(n) {
if (!n.match(/^\s*\n+\s*$/)) {
throw `${n}\n`;
}
return "";
});
};
/*
* strip triple new lines
*/ | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 102 | 109 |
js2coffee/js2coffee:lib/builder/base.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var stripPost;
stripPost = function(node) {
return wreplace(node, {
reverse: true
}, function(n) {
if (!n.match(/^\s*\n+\s*$/)) {
throw `${n}\n`;
}
return "";
});
};
/*
* strip triple new lines
*/
``` | stripPost = (node) ->
wreplace node, reverse: true, (n) ->
throw "#{n}\n" unless n.match(/^\s*\n+\s*$/)
""
###
# strip triple new lines
### | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 102 | 109 |
js2coffee/js2coffee:lib/builder/base.coffee:6:raw_corpus | raw_corpus | stripMid = (node) ->
streak = 0
wreplace 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/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 111 | 126 | ||
js2coffee/js2coffee:lib/builder/base.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
stripMid = (node) ->
streak = 0
wreplace 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 wreplace(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/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 111 | 126 |
js2coffee/js2coffee:lib/builder/base.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var stripMid;
stripMid = function(node) {
var streak;
streak = 0;
return wreplace(node, {}, function(n) {
if (n === "\n") {
streak += 1;
} else if (n.match(/^\s*$/)) {
} else {
// pass
streak = 0;
}
if (streak >= 3) {
... | stripMid = (node) ->
streak = 0
wreplace 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/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 111 | 126 |
js2coffee/js2coffee:lib/builder/base.coffee:6:completion | completion | stripMid = (node) ->
streak = 0
wreplace 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/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 111 | 126 |
js2coffee/js2coffee:lib/builder/base.coffee:7:raw_corpus | raw_corpus | wreplace = (node, options = {}, fn) ->
walk = (node, options = {}, fn) ->
range = if options.reverse
[node.children.length-1..0]
else
[0...node.children.length]
for i in range
child = node.children[i]
if !child
else if child.children
walk child, options, fn
els... | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 128 | 154 | ||
js2coffee/js2coffee:lib/builder/base.coffee:7:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
wreplace = (node, options = {}, fn) ->
walk = (node, options = {}, fn) ->
range = if options.reverse
[node.children.length-1..0]
else
[0...node.children.length]
for i in range
child = node.children[i]
if !child
else if... | var wreplace;
wreplace = function(node, options = {}, fn) {
var e, walk;
walk = function(node, options = {}, fn) {
var child, e, i, j, len, output, range, ref, ref1;
range = options.reverse ? (function() {
var results = [];
for (var j = ref = node.children.length - 1; ref <= 0 ? j <= 0 : j >= 0... | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 128 | 154 |
js2coffee/js2coffee:lib/builder/base.coffee:7:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var wreplace;
wreplace = function(node, options = {}, fn) {
var e, walk;
walk = function(node, options = {}, fn) {
var child, e, i, j, len, output, range, ref, ref1;
range = options.reverse ? (function() {
var results = [];
for (var j = ref... | wreplace = (node, options = {}, fn) ->
walk = (node, options = {}, fn) ->
range = if options.reverse
[node.children.length-1..0]
else
[0...node.children.length]
for i in range
child = node.children[i]
if !child
else if child.children
walk child, options, fn
els... | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 128 | 154 |
js2coffee/js2coffee:lib/builder/base.coffee:7:completion | completion | wreplace = (node, options = {}, fn) ->
walk = (node, options = {}, fn) ->
range = if options.reverse
[node.children.length-1..0]
else
[0...node.children.length]
for i in range
child = node.children[i]
if !child
else if child.children
walk child, options, fn
els... | try
output = fn(child)
node.children[i] = output
catch e
throw e unless typeof e is 'string'
node.children[i] = e
throw {break: true}
node
try
walk node, options, fn
catch e
throw e unless e.break is true
node | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | fac5bc1bf42b64519695e211886369fd694fa5f0 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fac5bc1bf42b64519695e211886369fd694fa5f0/lib/builder/base.coffee | 128 | 154 |
js2coffee/js2coffee:lib/builder/base.coffee:1:raw_corpus | raw_corpus | class BuilderBase
constructor: (@root, @options) ->
@path = []
run: ->
@walk(@root)
walk: (node, type) =>
oldLength = @path.length
@path.push(node)
type = undefined if typeof type isnt 'string'
type or= node.type
@ctx = { path: @path, type: type, parent: @path[@path.length-2] }
... | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | 1eaeded88592bf115ab65f5dc9c81f5872e9278d | 2,082 | https://github.com/js2coffee/js2coffee/blob/1eaeded88592bf115ab65f5dc9c81f5872e9278d/lib/builder/base.coffee | 26 | 75 | ||
js2coffee/js2coffee:lib/builder/base.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class BuilderBase
constructor: (@root, @options) ->
@path = []
run: ->
@walk(@root)
walk: (node, type) =>
oldLength = @path.length
@path.push(node)
type = undefined if typeof type isnt 'string'
type or= node.type
@ctx = { path... | var BuilderBase;
BuilderBase = class BuilderBase {
constructor(root, options) {
this.walk = this.walk.bind(this);
this.root = root;
this.options = options;
this.path = [];
}
run() {
return this.walk(this.root);
}
walk(node, type) {
var fn, oldLength, out;
oldLength = this.path.l... | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | 1eaeded88592bf115ab65f5dc9c81f5872e9278d | 2,082 | https://github.com/js2coffee/js2coffee/blob/1eaeded88592bf115ab65f5dc9c81f5872e9278d/lib/builder/base.coffee | 26 | 75 |
js2coffee/js2coffee:lib/builder/base.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var BuilderBase;
BuilderBase = class BuilderBase {
constructor(root, options) {
this.walk = this.walk.bind(this);
this.root = root;
this.options = options;
this.path = [];
}
run() {
return this.walk(this.root);
}
walk(node, type) {
... | class BuilderBase
constructor: (@root, @options) ->
@path = []
run: ->
@walk(@root)
walk: (node, type) =>
oldLength = @path.length
@path.push(node)
type = undefined if typeof type isnt 'string'
type or= node.type
@ctx = { path: @path, type: type, parent: @path[@path.length-2] }
... | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | 1eaeded88592bf115ab65f5dc9c81f5872e9278d | 2,082 | https://github.com/js2coffee/js2coffee/blob/1eaeded88592bf115ab65f5dc9c81f5872e9278d/lib/builder/base.coffee | 26 | 75 |
js2coffee/js2coffee:lib/builder/base.coffee:1:completion | completion | class BuilderBase
constructor: (@root, @options) ->
@path = []
run: ->
@walk(@root)
walk: (node, type) =>
oldLength = @path.length
@path.push(node)
type = undefined if typeof type isnt 'string'
type or= node.type
@ctx = { path: @path, type: type, parent: @path[@path.length-2] }
... | else
out = @onUnknownNode(node, @ctx)
@path.splice(oldLength)
out
###*
# get():
# Returns the output of source-map.
###
get: ->
node = @run()
node = stripPre(node)
node = stripPost(node)
node = stripMid(node)
node.toStringWithSourceMap()
###*
# decorator():
# Takes ... | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | 1eaeded88592bf115ab65f5dc9c81f5872e9278d | 2,082 | https://github.com/js2coffee/js2coffee/blob/1eaeded88592bf115ab65f5dc9c81f5872e9278d/lib/builder/base.coffee | 26 | 75 |
js2coffee/js2coffee:lib/builder/base.coffee:6:raw_corpus | raw_corpus | stripMid = (node) ->
streak = 0
wreplace node, {}, (n) ->
if n is "\n"
streak += 1
else
streak = 0
if streak >= 3 then "" else n
###
# walk and replace
### | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | 1eaeded88592bf115ab65f5dc9c81f5872e9278d | 2,082 | https://github.com/js2coffee/js2coffee/blob/1eaeded88592bf115ab65f5dc9c81f5872e9278d/lib/builder/base.coffee | 111 | 124 | ||
js2coffee/js2coffee:lib/builder/base.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
stripMid = (node) ->
streak = 0
wreplace node, {}, (n) ->
if n is "\n"
streak += 1
else
streak = 0
if streak >= 3 then "" else n
###
# walk and replace
###
``` | var stripMid;
stripMid = function(node) {
var streak;
streak = 0;
return wreplace(node, {}, function(n) {
if (n === "\n") {
streak += 1;
} else {
streak = 0;
}
if (streak >= 3) {
return "";
} else {
return n;
}
});
};
/*
* walk and replace
*/ | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | 1eaeded88592bf115ab65f5dc9c81f5872e9278d | 2,082 | https://github.com/js2coffee/js2coffee/blob/1eaeded88592bf115ab65f5dc9c81f5872e9278d/lib/builder/base.coffee | 111 | 124 |
js2coffee/js2coffee:lib/builder/base.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var stripMid;
stripMid = function(node) {
var streak;
streak = 0;
return wreplace(node, {}, function(n) {
if (n === "\n") {
streak += 1;
} else {
streak = 0;
}
if (streak >= 3) {
return "";
} else {
return n;
}... | stripMid = (node) ->
streak = 0
wreplace node, {}, (n) ->
if n is "\n"
streak += 1
else
streak = 0
if streak >= 3 then "" else n
###
# walk and replace
### | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | 1eaeded88592bf115ab65f5dc9c81f5872e9278d | 2,082 | https://github.com/js2coffee/js2coffee/blob/1eaeded88592bf115ab65f5dc9c81f5872e9278d/lib/builder/base.coffee | 111 | 124 |
js2coffee/js2coffee:lib/builder/base.coffee:6:completion | completion | stripMid = (node) ->
streak = 0
wreplace node, {}, (n) ->
if n is "\n"
streak += 1
else | streak = 0
if streak >= 3 then "" else n
###
# walk and replace
### | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | 1eaeded88592bf115ab65f5dc9c81f5872e9278d | 2,082 | https://github.com/js2coffee/js2coffee/blob/1eaeded88592bf115ab65f5dc9c81f5872e9278d/lib/builder/base.coffee | 111 | 124 |
js2coffee/js2coffee:lib/builder/base.coffee:7:raw_corpus | raw_corpus | wreplace = (node, options = {}, fn) ->
walk = (node, options = {}, fn) ->
range = if options.reverse
[node.children.length-1..0]
else
[0...node.children.length]
for i in range
child = node.children[i]
if child.children
walk child, options, fn
else if child isnt ''
... | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | caad64a82c27ed225852820e8e085827d4ab6fb5 | 2,082 | https://github.com/js2coffee/js2coffee/blob/caad64a82c27ed225852820e8e085827d4ab6fb5/lib/builder/base.coffee | 126 | 151 | ||
js2coffee/js2coffee:lib/builder/base.coffee:7:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
wreplace = (node, options = {}, fn) ->
walk = (node, options = {}, fn) ->
range = if options.reverse
[node.children.length-1..0]
else
[0...node.children.length]
for i in range
child = node.children[i]
if child.children
... | var wreplace;
wreplace = function(node, options = {}, fn) {
var e, walk;
walk = function(node, options = {}, fn) {
var child, e, i, j, len, output, range, ref, ref1;
range = options.reverse ? (function() {
var results = [];
for (var j = ref = node.children.length - 1; ref <= 0 ? j <= 0 : j >= 0... | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | caad64a82c27ed225852820e8e085827d4ab6fb5 | 2,082 | https://github.com/js2coffee/js2coffee/blob/caad64a82c27ed225852820e8e085827d4ab6fb5/lib/builder/base.coffee | 126 | 151 |
js2coffee/js2coffee:lib/builder/base.coffee:7:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var wreplace;
wreplace = function(node, options = {}, fn) {
var e, walk;
walk = function(node, options = {}, fn) {
var child, e, i, j, len, output, range, ref, ref1;
range = options.reverse ? (function() {
var results = [];
for (var j = ref... | wreplace = (node, options = {}, fn) ->
walk = (node, options = {}, fn) ->
range = if options.reverse
[node.children.length-1..0]
else
[0...node.children.length]
for i in range
child = node.children[i]
if child.children
walk child, options, fn
else if child isnt ''
... | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | caad64a82c27ed225852820e8e085827d4ab6fb5 | 2,082 | https://github.com/js2coffee/js2coffee/blob/caad64a82c27ed225852820e8e085827d4ab6fb5/lib/builder/base.coffee | 126 | 151 |
js2coffee/js2coffee:lib/builder/base.coffee:7:completion | completion | wreplace = (node, options = {}, fn) ->
walk = (node, options = {}, fn) ->
range = if options.reverse
[node.children.length-1..0]
else
[0...node.children.length]
for i in range
child = node.children[i]
if child.children
walk child, options, fn
else if child isnt ''
... | output = fn(child)
node.children[i] = output
catch e
throw e unless typeof e is 'string'
node.children[i] = e
throw {break: true}
node
try
walk node, options, fn
catch e
throw e unless e.break is true
node | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/builder/base.coffee | MIT | caad64a82c27ed225852820e8e085827d4ab6fb5 | 2,082 | https://github.com/js2coffee/js2coffee/blob/caad64a82c27ed225852820e8e085827d4ab6fb5/lib/builder/base.coffee | 126 | 151 |
jianliaoim/talk-os:talk-api2x/test/util/util.coffee:1:raw_corpus | raw_corpus | should = require 'should'
util = require '../../server/util'
describe 'Util#fetchUrlMetas', ->
@timeout 5000
it 'should fetch the meta infomation of talk.ai', (done) ->
util.fetchUrlMetas 'https://talk.ai/site'
.then (meta) ->
meta.should.have.properties 'title', 'text'
.nodeify done
it 's... | CoffeeScript | jianliaoim/talk-os | talk-api2x/test/util/util.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/util/util.coffee | 1 | 22 | ||
jianliaoim/talk-os:talk-api2x/test/util/util.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
should = require 'should'
util = require '../../server/util'
describe 'Util#fetchUrlMetas', ->
@timeout 5000
it 'should fetch the meta infomation of talk.ai', (done) ->
util.fetchUrlMetas 'https://talk.ai/site'
.then (meta) ->
meta.should.ha... | var should, util;
should = require('should');
util = require('../../server/util');
describe('Util#fetchUrlMetas', function() {
this.timeout(5000);
it('should fetch the meta infomation of talk.ai', function(done) {
return util.fetchUrlMetas('https://talk.ai/site').then(function(meta) {
return meta.shoul... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/test/util/util.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/util/util.coffee | 1 | 22 |
jianliaoim/talk-os:talk-api2x/test/util/util.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var should, util;
should = require('should');
util = require('../../server/util');
describe('Util#fetchUrlMetas', function() {
this.timeout(5000);
it('should fetch the meta infomation of talk.ai', function(done) {
return util.fetchUrlMetas('https://talk.... | should = require 'should'
util = require '../../server/util'
describe 'Util#fetchUrlMetas', ->
@timeout 5000
it 'should fetch the meta infomation of talk.ai', (done) ->
util.fetchUrlMetas 'https://talk.ai/site'
.then (meta) ->
meta.should.have.properties 'title', 'text'
.nodeify done
it 's... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/test/util/util.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/util/util.coffee | 1 | 22 |
jianliaoim/talk-os:talk-api2x/test/util/util.coffee:1:completion | completion | should = require 'should'
util = require '../../server/util'
describe 'Util#fetchUrlMetas', ->
@timeout 5000
it 'should fetch the meta infomation of talk.ai', (done) ->
util.fetchUrlMetas 'https://talk.ai/site'
.then (meta) -> | meta.should.have.properties 'title', 'text'
.nodeify done
it 'should fetch the infomation on the gbk site', (done) ->
util.fetchUrlMetas 'http://err.tmall.com/error1.html'
.then (meta) ->
meta.should.have.properties 'title'
.nodeify done | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/test/util/util.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/util/util.coffee | 1 | 22 |
gss/engine:src/commands/Assignment.coffee:1:raw_corpus | raw_corpus | Command = require('../Command')
class Assignment extends Command
type: 'Assignment'
signature: [
[object: ['Query', 'Selector']]
property: ['String']
value: ['Variable']
]
class Assignment.Unsafe extends Assignment
signature: [
[object: ['Query', 'Selector']]
property: ['String']
... | CoffeeScript | gss/engine | src/commands/Assignment.coffee | MIT | 13326bc09a304dcc434839b06f28601134e5f2c1 | 2,854 | https://github.com/gss/engine/blob/13326bc09a304dcc434839b06f28601134e5f2c1/src/commands/Assignment.coffee | 1 | 37 | ||
gss/engine:src/commands/Assignment.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Command = require('../Command')
class Assignment extends Command
type: 'Assignment'
signature: [
[object: ['Query', 'Selector']]
property: ['String']
value: ['Variable']
]
class Assignment.Unsafe extends Assignment
signature: [
[o... | var Assignment, Command;
Command = require('../Command');
Assignment = (function() {
class Assignment extends Command {};
Assignment.prototype.type = 'Assignment';
Assignment.prototype.signature = [
[
{
object: ['Query',
'Selector']
}
],
{
property: ['String'],
... | CoffeeScript | JavaScript | gss/engine | src/commands/Assignment.coffee | MIT | 13326bc09a304dcc434839b06f28601134e5f2c1 | 2,854 | https://github.com/gss/engine/blob/13326bc09a304dcc434839b06f28601134e5f2c1/src/commands/Assignment.coffee | 1 | 37 |
gss/engine:src/commands/Assignment.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Assignment, Command;
Command = require('../Command');
Assignment = (function() {
class Assignment extends Command {};
Assignment.prototype.type = 'Assignment';
Assignment.prototype.signature = [
[
{
object: ['Query',
'Selector'... | Command = require('../Command')
class Assignment extends Command
type: 'Assignment'
signature: [
[object: ['Query', 'Selector']]
property: ['String']
value: ['Variable']
]
class Assignment.Unsafe extends Assignment
signature: [
[object: ['Query', 'Selector']]
property: ['String']
... | JavaScript | CoffeeScript | gss/engine | src/commands/Assignment.coffee | MIT | 13326bc09a304dcc434839b06f28601134e5f2c1 | 2,854 | https://github.com/gss/engine/blob/13326bc09a304dcc434839b06f28601134e5f2c1/src/commands/Assignment.coffee | 1 | 37 |
gss/engine:src/commands/Assignment.coffee:1:completion | completion | Command = require('../Command')
class Assignment extends Command
type: 'Assignment'
signature: [
[object: ['Query', 'Selector']]
property: ['String']
value: ['Variable']
]
class Assignment.Unsafe extends Assignment
signature: [
[object: ['Query', 'Selector']]
property: ['String']
... | # Register assignment within parent rule
# by its auto-incremented property local to operation list
advices: [
(engine, operation, command) ->
parent = operation
rule = undefined
while parent.parent
if !rule && parent[0] == 'rule'
rule = parent
parent = parent.parent
... | CoffeeScript | CoffeeScript | gss/engine | src/commands/Assignment.coffee | MIT | 13326bc09a304dcc434839b06f28601134e5f2c1 | 2,854 | https://github.com/gss/engine/blob/13326bc09a304dcc434839b06f28601134e5f2c1/src/commands/Assignment.coffee | 1 | 37 |
gss/engine:src/commands/Assignment.coffee:1:raw_corpus | raw_corpus | Command = require('../Command')
class Assignment extends Command
type: 'Assignment'
signature: [
[object: ['Query', 'Selector']]
property: ['String']
value: ['Variable']
]
class Assignment.Unsafe extends Assignment
signature: [
[object: ['Query', 'Selector']]
property: ['String']
... | CoffeeScript | gss/engine | src/commands/Assignment.coffee | MIT | 31938f86e04f67ada173275db8f0e673655a12e9 | 2,854 | https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/commands/Assignment.coffee | 1 | 35 | ||
gss/engine:src/commands/Assignment.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Command = require('../Command')
class Assignment extends Command
type: 'Assignment'
signature: [
[object: ['Query', 'Selector']]
property: ['String']
value: ['Variable']
]
class Assignment.Unsafe extends Assignment
signature: [
[o... | var Assignment, Command;
Command = require('../Command');
Assignment = (function() {
class Assignment extends Command {};
Assignment.prototype.type = 'Assignment';
Assignment.prototype.signature = [
[
{
object: ['Query',
'Selector']
}
],
{
property: ['String'],
... | CoffeeScript | JavaScript | gss/engine | src/commands/Assignment.coffee | MIT | 31938f86e04f67ada173275db8f0e673655a12e9 | 2,854 | https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/commands/Assignment.coffee | 1 | 35 |
gss/engine:src/commands/Assignment.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Assignment, Command;
Command = require('../Command');
Assignment = (function() {
class Assignment extends Command {};
Assignment.prototype.type = 'Assignment';
Assignment.prototype.signature = [
[
{
object: ['Query',
'Selector'... | Command = require('../Command')
class Assignment extends Command
type: 'Assignment'
signature: [
[object: ['Query', 'Selector']]
property: ['String']
value: ['Variable']
]
class Assignment.Unsafe extends Assignment
signature: [
[object: ['Query', 'Selector']]
property: ['String']
... | JavaScript | CoffeeScript | gss/engine | src/commands/Assignment.coffee | MIT | 31938f86e04f67ada173275db8f0e673655a12e9 | 2,854 | https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/commands/Assignment.coffee | 1 | 35 |
gss/engine:src/commands/Assignment.coffee:1:completion | completion | Command = require('../Command')
class Assignment extends Command
type: 'Assignment'
signature: [
[object: ['Query', 'Selector']]
property: ['String']
value: ['Variable']
]
class Assignment.Unsafe extends Assignment
signature: [
[object: ['Query', 'Selector']]
property: ['String']
... | ]
advices: [
(engine, operation, command) ->
parent = operation
rule = undefined
while parent.parent
if !rule && parent[0] == 'rule'
rule = parent
parent = parent.parent
operation.index = parent.rules = (parent.rules || 0) + 1
if rule
(rule.propert... | CoffeeScript | CoffeeScript | gss/engine | src/commands/Assignment.coffee | MIT | 31938f86e04f67ada173275db8f0e673655a12e9 | 2,854 | https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/commands/Assignment.coffee | 1 | 35 |
gss/engine:src/commands/Assignment.coffee:1:raw_corpus | raw_corpus | Command = require('../concepts/Command')
class Assignment extends Command
type: 'Assignment'
signature: [
[object: ['Query', 'Selector']]
property: ['String']
value: ['Variable']
]
class Assignment.Unsafe extends Assignment
signature: [
[object: ['Query', 'Selector']]
property: ['... | CoffeeScript | gss/engine | src/commands/Assignment.coffee | MIT | 527308fd09ab6b18a30ad7b6194f0fd00f872647 | 2,854 | https://github.com/gss/engine/blob/527308fd09ab6b18a30ad7b6194f0fd00f872647/src/commands/Assignment.coffee | 1 | 35 | ||
gss/engine:src/commands/Assignment.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Command = require('../concepts/Command')
class Assignment extends Command
type: 'Assignment'
signature: [
[object: ['Query', 'Selector']]
property: ['String']
value: ['Variable']
]
class Assignment.Unsafe extends Assignment
signature:... | var Assignment, Command;
Command = require('../concepts/Command');
Assignment = (function() {
class Assignment extends Command {};
Assignment.prototype.type = 'Assignment';
Assignment.prototype.signature = [
[
{
object: ['Query',
'Selector']
}
],
{
property: ['Strin... | CoffeeScript | JavaScript | gss/engine | src/commands/Assignment.coffee | MIT | 527308fd09ab6b18a30ad7b6194f0fd00f872647 | 2,854 | https://github.com/gss/engine/blob/527308fd09ab6b18a30ad7b6194f0fd00f872647/src/commands/Assignment.coffee | 1 | 35 |
gss/engine:src/commands/Assignment.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Assignment, Command;
Command = require('../concepts/Command');
Assignment = (function() {
class Assignment extends Command {};
Assignment.prototype.type = 'Assignment';
Assignment.prototype.signature = [
[
{
object: ['Query',
'... | Command = require('../concepts/Command')
class Assignment extends Command
type: 'Assignment'
signature: [
[object: ['Query', 'Selector']]
property: ['String']
value: ['Variable']
]
class Assignment.Unsafe extends Assignment
signature: [
[object: ['Query', 'Selector']]
property: ['... | JavaScript | CoffeeScript | gss/engine | src/commands/Assignment.coffee | MIT | 527308fd09ab6b18a30ad7b6194f0fd00f872647 | 2,854 | https://github.com/gss/engine/blob/527308fd09ab6b18a30ad7b6194f0fd00f872647/src/commands/Assignment.coffee | 1 | 35 |
gss/engine:src/commands/Assignment.coffee:1:completion | completion | Command = require('../concepts/Command')
class Assignment extends Command
type: 'Assignment'
signature: [
[object: ['Query', 'Selector']]
property: ['String']
value: ['Variable']
]
class Assignment.Unsafe extends Assignment
signature: [
[object: ['Query', 'Selector']]
property: ['... | ]
advices: [
(engine, operation, command) ->
parent = operation
rule = undefined
while parent.parent
if !rule && parent[0] == 'rule'
rule = parent
parent = parent.parent
operation.index = parent.rules = (parent.rules || 0) + 1
if rule
(rule.propert... | CoffeeScript | CoffeeScript | gss/engine | src/commands/Assignment.coffee | MIT | 527308fd09ab6b18a30ad7b6194f0fd00f872647 | 2,854 | https://github.com/gss/engine/blob/527308fd09ab6b18a30ad7b6194f0fd00f872647/src/commands/Assignment.coffee | 1 | 35 |
gss/engine:src/commands/Assignment.coffee:1:raw_corpus | raw_corpus | Command = require('../concepts/Command')
class Assignment extends Command
type: 'Assignment'
signature: [
[object: ['Query', 'Selector']]
property: ['String']
value: ['Value']
]
class Assignment.Unsafe extends Assignment
signature: [
[object: ['Query', 'Selector']]
property: ['Str... | CoffeeScript | gss/engine | src/commands/Assignment.coffee | MIT | 5210cc5e2fa5c8f694ac7e6602a4bbac2eb6ff85 | 2,854 | https://github.com/gss/engine/blob/5210cc5e2fa5c8f694ac7e6602a4bbac2eb6ff85/src/commands/Assignment.coffee | 1 | 35 | ||
gss/engine:src/commands/Assignment.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Command = require('../concepts/Command')
class Assignment extends Command
type: 'Assignment'
signature: [
[object: ['Query', 'Selector']]
property: ['String']
value: ['Value']
]
class Assignment.Unsafe extends Assignment
signature: [
... | var Assignment, Command;
Command = require('../concepts/Command');
Assignment = (function() {
class Assignment extends Command {};
Assignment.prototype.type = 'Assignment';
Assignment.prototype.signature = [
[
{
object: ['Query',
'Selector']
}
],
{
property: ['Strin... | CoffeeScript | JavaScript | gss/engine | src/commands/Assignment.coffee | MIT | 5210cc5e2fa5c8f694ac7e6602a4bbac2eb6ff85 | 2,854 | https://github.com/gss/engine/blob/5210cc5e2fa5c8f694ac7e6602a4bbac2eb6ff85/src/commands/Assignment.coffee | 1 | 35 |
gss/engine:src/commands/Assignment.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Assignment, Command;
Command = require('../concepts/Command');
Assignment = (function() {
class Assignment extends Command {};
Assignment.prototype.type = 'Assignment';
Assignment.prototype.signature = [
[
{
object: ['Query',
'... | Command = require('../concepts/Command')
class Assignment extends Command
type: 'Assignment'
signature: [
[object: ['Query', 'Selector']]
property: ['String']
value: ['Value']
]
class Assignment.Unsafe extends Assignment
signature: [
[object: ['Query', 'Selector']]
property: ['Str... | JavaScript | CoffeeScript | gss/engine | src/commands/Assignment.coffee | MIT | 5210cc5e2fa5c8f694ac7e6602a4bbac2eb6ff85 | 2,854 | https://github.com/gss/engine/blob/5210cc5e2fa5c8f694ac7e6602a4bbac2eb6ff85/src/commands/Assignment.coffee | 1 | 35 |
gss/engine:src/commands/Assignment.coffee:1:completion | completion | Command = require('../concepts/Command')
class Assignment extends Command
type: 'Assignment'
signature: [
[object: ['Query', 'Selector']]
property: ['String']
value: ['Value']
]
class Assignment.Unsafe extends Assignment
signature: [
[object: ['Query', 'Selector']]
property: ['Str... | ]
advices: [
(engine, operation, command) ->
parent = operation
rule = undefined
while parent.parent
if !rule && parent[0] == 'rule'
rule = parent
parent = parent.parent
operation.index = parent.rules = (parent.rules || 0) + 1
if rule
(rule.propert... | CoffeeScript | CoffeeScript | gss/engine | src/commands/Assignment.coffee | MIT | 5210cc5e2fa5c8f694ac7e6602a4bbac2eb6ff85 | 2,854 | https://github.com/gss/engine/blob/5210cc5e2fa5c8f694ac7e6602a4bbac2eb6ff85/src/commands/Assignment.coffee | 1 | 35 |
dropbox/zxcvbn:init.coffee:1:raw_corpus | raw_corpus | Init = do ->
# on qwerty, 'g' has degree 6, being adjacent to 'ftyhbv'. '\' has degree 1.
# this calculates the average over all keys.
# TODO move this outside of init code.
calc_average_degree = (graph) ->
average = 0
for key, neighbors of graph
average += (n for n in neighbors when n).length
... | CoffeeScript | dropbox/zxcvbn | init.coffee | MIT | e1d0311992174019d7cd53197139f67482e55a6f | 15,961 | https://github.com/dropbox/zxcvbn/blob/e1d0311992174019d7cd53197139f67482e55a6f/init.coffee | 1 | 50 | ||
dropbox/zxcvbn:init.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Init = do ->
# on qwerty, 'g' has degree 6, being adjacent to 'ftyhbv'. '\' has degree 1.
# this calculates the average over all keys.
# TODO move this outside of init code.
calc_average_degree = (graph) ->
average = 0
for key, neighbors of graph... | var Init;
Init = (function() {
var calc_average_degree, dictionary_matchers, time, umd, zxcvbn;
// on qwerty, 'g' has degree 6, being adjacent to 'ftyhbv'. '\' has degree 1.
// this calculates the average over all keys.
// TODO move this outside of init code.
calc_average_degree = function(graph) {
var a... | CoffeeScript | JavaScript | dropbox/zxcvbn | init.coffee | MIT | e1d0311992174019d7cd53197139f67482e55a6f | 15,961 | https://github.com/dropbox/zxcvbn/blob/e1d0311992174019d7cd53197139f67482e55a6f/init.coffee | 1 | 50 |
dropbox/zxcvbn:init.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Init;
Init = (function() {
var calc_average_degree, dictionary_matchers, time, umd, zxcvbn;
// on qwerty, 'g' has degree 6, being adjacent to 'ftyhbv'. '\' has degree 1.
// this calculates the average over all keys.
// TODO move this outside of init co... | Init = do ->
# on qwerty, 'g' has degree 6, being adjacent to 'ftyhbv'. '\' has degree 1.
# this calculates the average over all keys.
# TODO move this outside of init code.
calc_average_degree = (graph) ->
average = 0
for key, neighbors of graph
average += (n for n in neighbors when n).length
... | JavaScript | CoffeeScript | dropbox/zxcvbn | init.coffee | MIT | e1d0311992174019d7cd53197139f67482e55a6f | 15,961 | https://github.com/dropbox/zxcvbn/blob/e1d0311992174019d7cd53197139f67482e55a6f/init.coffee | 1 | 50 |
dropbox/zxcvbn:init.coffee:1:completion | completion | Init = do ->
# on qwerty, 'g' has degree 6, being adjacent to 'ftyhbv'. '\' has degree 1.
# this calculates the average over all keys.
# TODO move this outside of init code.
calc_average_degree = (graph) ->
average = 0
for key, neighbors of graph
average += (n for n in neighbors when n).length
... | matches = Matching.omnimatch password, Init.MATCHERS.concat(user_inputs_matcher)
result = Scoring.minimum_entropy_match_sequence password, matches
result.calc_time = time() - start
result
dictionary_matchers = [
Matching.build_dict_matcher('passwords', Matching.build_ranked_dict(FrequencyLists.passw... | CoffeeScript | CoffeeScript | dropbox/zxcvbn | init.coffee | MIT | e1d0311992174019d7cd53197139f67482e55a6f | 15,961 | https://github.com/dropbox/zxcvbn/blob/e1d0311992174019d7cd53197139f67482e55a6f/init.coffee | 1 | 50 |
dropbox/zxcvbn:init.coffee:2:raw_corpus | raw_corpus | else if typeof module == 'object' and module.exports?
# works with CommonJS environments that support module.exports, like node
module.exports = factory()
else
# Add browser global
root.zxcvbn = factory()
root.zxcvbn_load_hook?() # DEPRICATED run load hook from user, if defined. TODO rem... | CoffeeScript | dropbox/zxcvbn | init.coffee | MIT | e1d0311992174019d7cd53197139f67482e55a6f | 15,961 | https://github.com/dropbox/zxcvbn/blob/e1d0311992174019d7cd53197139f67482e55a6f/init.coffee | 51 | 89 | ||
dropbox/zxcvbn:init.coffee:2:completion | completion | else if typeof module == 'object' and module.exports?
# works with CommonJS environments that support module.exports, like node
module.exports = factory()
else
# Add browser global
root.zxcvbn = factory()
root.zxcvbn_load_hook?() # DEPRICATED run load hook from user, if defined. TODO rem... | Matching.digits_match,
Matching.year_match,
Matching.date_match,
Matching.repeat_match,
Matching.sequence_match,
Matching.spatial_match
]
GRAPHS:
'qwerty': AdjacencyGraphs.qwerty
'dvorak': AdjacencyGraphs.dvorak
'keypad': AdjacencyGraphs.keypad
'mac_keypad': Adjacenc... | CoffeeScript | CoffeeScript | dropbox/zxcvbn | init.coffee | MIT | e1d0311992174019d7cd53197139f67482e55a6f | 15,961 | https://github.com/dropbox/zxcvbn/blob/e1d0311992174019d7cd53197139f67482e55a6f/init.coffee | 51 | 89 |
dropbox/zxcvbn:init.coffee:2:raw_corpus | raw_corpus | else if typeof module == 'object' and module.exports?
# works with CommonJS environments that support module.exports, like node
module.exports = factory()
else
# Add browser global
root.zxcvbn = factory()
root.zxcvbn_load_hook?() # DEPRICATED run load hook from user, if defined. TODO rem... | CoffeeScript | dropbox/zxcvbn | init.coffee | MIT | 76229ecc96793f6e9c7ed9a509d2db4031d6150b | 15,961 | https://github.com/dropbox/zxcvbn/blob/76229ecc96793f6e9c7ed9a509d2db4031d6150b/init.coffee | 51 | 88 | ||
dropbox/zxcvbn:init.coffee:2:completion | completion | else if typeof module == 'object' and module.exports?
# works with CommonJS environments that support module.exports, like node
module.exports = factory()
else
# Add browser global
root.zxcvbn = factory()
root.zxcvbn_load_hook?() # DEPRICATED run load hook from user, if defined. TODO rem... | Matching.digits_match,
Matching.year_match,
Matching.date_match,
Matching.repeat_match,
Matching.sequence_match,
Matching.spatial_match
]
GRAPHS:
'qwerty': AdjacencyGraphs.qwerty
'dvorak': AdjacencyGraphs.dvorak
'keypad': AdjacencyGraphs.keypad
'mac_keypad': Adjacenc... | CoffeeScript | CoffeeScript | dropbox/zxcvbn | init.coffee | MIT | 76229ecc96793f6e9c7ed9a509d2db4031d6150b | 15,961 | https://github.com/dropbox/zxcvbn/blob/76229ecc96793f6e9c7ed9a509d2db4031d6150b/init.coffee | 51 | 88 |
dropbox/zxcvbn:init.coffee:1:raw_corpus | raw_corpus | Init = do ->
# on qwerty, 'g' has degree 6, being adjacent to 'ftyhbv'. '\' has degree 1.
# this calculates the average over all keys.
# TODO move this outside of init code.
calc_average_degree = (graph) ->
average = 0
for key, neighbors of graph
average += (n for n in neighbors when n).length
... | CoffeeScript | dropbox/zxcvbn | init.coffee | MIT | 5a7f58cd246323ef6aac0c41803fa8f98142b953 | 15,961 | https://github.com/dropbox/zxcvbn/blob/5a7f58cd246323ef6aac0c41803fa8f98142b953/init.coffee | 1 | 50 | ||
dropbox/zxcvbn:init.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Init = do ->
# on qwerty, 'g' has degree 6, being adjacent to 'ftyhbv'. '\' has degree 1.
# this calculates the average over all keys.
# TODO move this outside of init code.
calc_average_degree = (graph) ->
average = 0
for key, neighbors of graph... | var Init;
Init = (function() {
var calc_average_degree, dictionary_matchers, time, umd, zxcvbn;
// on qwerty, 'g' has degree 6, being adjacent to 'ftyhbv'. '\' has degree 1.
// this calculates the average over all keys.
// TODO move this outside of init code.
calc_average_degree = function(graph) {
var a... | CoffeeScript | JavaScript | dropbox/zxcvbn | init.coffee | MIT | 5a7f58cd246323ef6aac0c41803fa8f98142b953 | 15,961 | https://github.com/dropbox/zxcvbn/blob/5a7f58cd246323ef6aac0c41803fa8f98142b953/init.coffee | 1 | 50 |
dropbox/zxcvbn:init.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Init;
Init = (function() {
var calc_average_degree, dictionary_matchers, time, umd, zxcvbn;
// on qwerty, 'g' has degree 6, being adjacent to 'ftyhbv'. '\' has degree 1.
// this calculates the average over all keys.
// TODO move this outside of init co... | Init = do ->
# on qwerty, 'g' has degree 6, being adjacent to 'ftyhbv'. '\' has degree 1.
# this calculates the average over all keys.
# TODO move this outside of init code.
calc_average_degree = (graph) ->
average = 0
for key, neighbors of graph
average += (n for n in neighbors when n).length
... | JavaScript | CoffeeScript | dropbox/zxcvbn | init.coffee | MIT | 5a7f58cd246323ef6aac0c41803fa8f98142b953 | 15,961 | https://github.com/dropbox/zxcvbn/blob/5a7f58cd246323ef6aac0c41803fa8f98142b953/init.coffee | 1 | 50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.