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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var XMLStreamWriter;
module.exports = XMLStreamWriter = class XMLStreamWriter extends XMLWriterBase {
// Initializes a new instance of `XMLStreamWriter`
// `stream` output stream
// `options.pretty` pretty prints the result
// `options.indent` indentation... | module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline sequence
# `options.offset` a fixed number of indentatio... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 71fc9cbc188ae1e726a7df21d91c1b265fbdb78b | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/71fc9cbc188ae1e726a7df21d91c1b265fbdb78b/src/XMLStreamWriter.coffee | 21 | 70 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:completion | completion | module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline sequence
# `options.offset` a fixed number of indentatio... | for child in doc.children
# skip dummy nodes
if child instanceof XMLDummy then continue
switch
when child instanceof XMLDeclaration then @declaration child, options, 0
when child instanceof XMLDocType then @docType child, options, 0
when child instanceof XMLComment ... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 71fc9cbc188ae1e726a7df21d91c1b265fbdb78b | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/71fc9cbc188ae1e726a7df21d91c1b265fbdb78b/src/XMLStreamWriter.coffee | 21 | 70 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:raw_corpus | raw_corpus | level or= 0
@openNode(node, options, level)
options.state = WriterState.OpenTag
@stream.write @indent(node, options, level)
@stream.write '<!DOCTYPE ' + node.root().name
# external identifier
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 71fc9cbc188ae1e726a7df21d91c1b265fbdb78b | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/71fc9cbc188ae1e726a7df21d91c1b265fbdb78b/src/XMLStreamWriter.coffee | 71 | 120 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:completion | completion | level or= 0
@openNode(node, options, level)
options.state = WriterState.OpenTag
@stream.write @indent(node, options, level)
@stream.write '<!DOCTYPE ' + node.root().name
# external identifier
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
... | when child instanceof XMLCData then @cdata child, options, level + 1
when child instanceof XMLComment then @comment child, options, level + 1
when child instanceof XMLProcessingInstruction then @processingInstruction child, options, level + 1
else throw new Error "Unkno... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 71fc9cbc188ae1e726a7df21d91c1b265fbdb78b | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/71fc9cbc188ae1e726a7df21d91c1b265fbdb78b/src/XMLStreamWriter.coffee | 71 | 120 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:raw_corpus | raw_corpus | if node.children.length == 0 or node.children.every((e) -> e.value == '')
# empty element
if options.allowEmpty
@stream.write '>'
options.state = WriterState.CloseTag
@stream.write '</' + node.name + '>'
else
options.state = WriterState.CloseTag
@stream.write op... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 71fc9cbc188ae1e726a7df21d91c1b265fbdb78b | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/71fc9cbc188ae1e726a7df21d91c1b265fbdb78b/src/XMLStreamWriter.coffee | 121 | 170 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:completion | completion | if node.children.length == 0 or node.children.every((e) -> e.value == '')
# empty element
if options.allowEmpty
@stream.write '>'
options.state = WriterState.CloseTag
@stream.write '</' + node.name + '>'
else
options.state = WriterState.CloseTag
@stream.write op... | when child instanceof XMLElement then @element child, options, level + 1
when child instanceof XMLRaw then @raw child, options, level + 1
when child instanceof XMLText then @text child, options, level + 1
when child instanceof XMLProcessingInstruction then @processingInstruct... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 71fc9cbc188ae1e726a7df21d91c1b265fbdb78b | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/71fc9cbc188ae1e726a7df21d91c1b265fbdb78b/src/XMLStreamWriter.coffee | 121 | 170 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:raw_corpus | raw_corpus | dtdElement: (node, options, level) ->
@stream.write super(node, options, level)
dtdEntity: (node, options, level) ->
@stream.write super(node, options, level)
dtdNotation: (node, options, level) ->
@stream.write super(node, options, level) | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 71fc9cbc188ae1e726a7df21d91c1b265fbdb78b | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/71fc9cbc188ae1e726a7df21d91c1b265fbdb78b/src/XMLStreamWriter.coffee | 171 | 178 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:completion | completion | dtdElement: (node, options, level) ->
@stream.write super(node, options, level)
dtdEntity: (node, options, level) -> | @stream.write super(node, options, level)
dtdNotation: (node, options, level) ->
@stream.write super(node, options, level) | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 71fc9cbc188ae1e726a7df21d91c1b265fbdb78b | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/71fc9cbc188ae1e726a7df21d91c1b265fbdb78b/src/XMLStreamWriter.coffee | 171 | 178 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:raw_corpus | raw_corpus | level or= 0
options.state = WriterState.OpenTag
@stream.write @space(node, options, level)
@stream.write '<!DOCTYPE ' + node.root().name
# external identifier
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.w... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 1425618ffc75bc33472e604ffb328182601116f3 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/1425618ffc75bc33472e604ffb328182601116f3/src/XMLStreamWriter.coffee | 71 | 120 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:completion | completion | level or= 0
options.state = WriterState.OpenTag
@stream.write @space(node, options, level)
@stream.write '<!DOCTYPE ' + node.root().name
# external identifier
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.w... | when child instanceof XMLProcessingInstruction then @processingInstruction child, options, level + 1
else throw new Error "Unknown DTD node type: " + child.constructor.name
options.state = WriterState.CloseTag
@stream.write ']'
# close tag
options.state = WriterState.CloseTag
@stream.... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 1425618ffc75bc33472e604ffb328182601116f3 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/1425618ffc75bc33472e604ffb328182601116f3/src/XMLStreamWriter.coffee | 71 | 120 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:raw_corpus | raw_corpus | @stream.write '>'
options.state = WriterState.CloseTag
@stream.write '</' + node.name + '>'
else
options.state = WriterState.CloseTag
@stream.write options.spaceBeforeSlash + '/>'
else if options.pretty and node.children.length == 1 and node.children[0].value?
# do not in... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 1425618ffc75bc33472e604ffb328182601116f3 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/1425618ffc75bc33472e604ffb328182601116f3/src/XMLStreamWriter.coffee | 121 | 170 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:completion | completion | @stream.write '>'
options.state = WriterState.CloseTag
@stream.write '</' + node.name + '>'
else
options.state = WriterState.CloseTag
@stream.write options.spaceBeforeSlash + '/>'
else if options.pretty and node.children.length == 1 and node.children[0].value?
# do not in... | when child instanceof XMLDummy then ''
else throw new Error "Unknown XML node type: " + child.constructor.name
# close tag
options.state = WriterState.CloseTag
@stream.write @space(node, options, level) + '</' + node.name + '>'
@stream.write @endline(node, options, level)
options.... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 1425618ffc75bc33472e604ffb328182601116f3 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/1425618ffc75bc33472e604ffb328182601116f3/src/XMLStreamWriter.coffee | 121 | 170 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:raw_corpus | raw_corpus | @stream.write super(node, options, level)
dtdNotation: (node, options, level) ->
@stream.write super(node, options, level) | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 1425618ffc75bc33472e604ffb328182601116f3 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/1425618ffc75bc33472e604ffb328182601116f3/src/XMLStreamWriter.coffee | 171 | 174 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:completion | completion | @stream.write super(node, options, level) | dtdNotation: (node, options, level) ->
@stream.write super(node, options, level) | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 1425618ffc75bc33472e604ffb328182601116f3 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/1425618ffc75bc33472e604ffb328182601116f3/src/XMLStreamWriter.coffee | 171 | 174 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:raw_corpus | raw_corpus | module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline sequence
# `options.offset` a fixed number of indentatio... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 1c8ced424fd8b8fc89fea7525e9c984adea19bf1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/1c8ced424fd8b8fc89fea7525e9c984adea19bf1/src/XMLStreamWriter.coffee | 21 | 70 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline s... | var XMLStreamWriter;
module.exports = XMLStreamWriter = class XMLStreamWriter extends XMLWriterBase {
// Initializes a new instance of `XMLStreamWriter`
// `stream` output stream
// `options.pretty` pretty prints the result
// `options.indent` indentation string
// `options.newline` newline sequence
// `o... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 1c8ced424fd8b8fc89fea7525e9c984adea19bf1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/1c8ced424fd8b8fc89fea7525e9c984adea19bf1/src/XMLStreamWriter.coffee | 21 | 70 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var XMLStreamWriter;
module.exports = XMLStreamWriter = class XMLStreamWriter extends XMLWriterBase {
// Initializes a new instance of `XMLStreamWriter`
// `stream` output stream
// `options.pretty` pretty prints the result
// `options.indent` indentation... | module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline sequence
# `options.offset` a fixed number of indentatio... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 1c8ced424fd8b8fc89fea7525e9c984adea19bf1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/1c8ced424fd8b8fc89fea7525e9c984adea19bf1/src/XMLStreamWriter.coffee | 21 | 70 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:completion | completion | module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline sequence
# `options.offset` a fixed number of indentatio... | for child in doc.children
# skip dummy nodes
if child instanceof XMLDummy then continue
switch
when child instanceof XMLDeclaration then @declaration child, options, 0
when child instanceof XMLDocType then @docType child, options, 0
when child instanceof XMLComment ... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 1c8ced424fd8b8fc89fea7525e9c984adea19bf1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/1c8ced424fd8b8fc89fea7525e9c984adea19bf1/src/XMLStreamWriter.coffee | 21 | 70 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:raw_corpus | raw_corpus | level or= 0
options.State = WriterState.OpenTag
@stream.write @space(node, options, level)
@stream.write '<!DOCTYPE ' + node.root().name
# external identifier
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.w... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 1c8ced424fd8b8fc89fea7525e9c984adea19bf1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/1c8ced424fd8b8fc89fea7525e9c984adea19bf1/src/XMLStreamWriter.coffee | 71 | 120 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:completion | completion | level or= 0
options.State = WriterState.OpenTag
@stream.write @space(node, options, level)
@stream.write '<!DOCTYPE ' + node.root().name
# external identifier
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.w... | when child instanceof XMLProcessingInstruction then @processingInstruction child, options, level + 1
else throw new Error "Unknown DTD node type: " + child.constructor.name
options.State = WriterState.CloseTag
@stream.write ']'
# close tag
options.State = WriterState.CloseTag
@stream.... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 1c8ced424fd8b8fc89fea7525e9c984adea19bf1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/1c8ced424fd8b8fc89fea7525e9c984adea19bf1/src/XMLStreamWriter.coffee | 71 | 120 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:raw_corpus | raw_corpus | @stream.write '>'
options.State = WriterState.CloseTag
@stream.write '</' + node.name + '>'
else
options.State = WriterState.CloseTag
@stream.write options.spaceBeforeSlash + '/>'
else if options.pretty and node.children.length == 1 and node.children[0].value?
# do not in... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 1c8ced424fd8b8fc89fea7525e9c984adea19bf1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/1c8ced424fd8b8fc89fea7525e9c984adea19bf1/src/XMLStreamWriter.coffee | 121 | 170 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:completion | completion | @stream.write '>'
options.State = WriterState.CloseTag
@stream.write '</' + node.name + '>'
else
options.State = WriterState.CloseTag
@stream.write options.spaceBeforeSlash + '/>'
else if options.pretty and node.children.length == 1 and node.children[0].value?
# do not in... | when child instanceof XMLDummy then ''
else throw new Error "Unknown XML node type: " + child.constructor.name
# close tag
options.State = WriterState.CloseTag
@stream.write @space(node, options, level) + '</' + node.name + '>'
@stream.write @endline(node, options, level)
options.... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 1c8ced424fd8b8fc89fea7525e9c984adea19bf1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/1c8ced424fd8b8fc89fea7525e9c984adea19bf1/src/XMLStreamWriter.coffee | 121 | 170 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:raw_corpus | raw_corpus | module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline sequence
# `options.offset` a fixed number of indentatio... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 334fb0954039c73163d22d27c2641ff74f2a63d7 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/334fb0954039c73163d22d27c2641ff74f2a63d7/src/XMLStreamWriter.coffee | 20 | 69 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline s... | var XMLStreamWriter;
module.exports = XMLStreamWriter = class XMLStreamWriter extends XMLWriterBase {
// Initializes a new instance of `XMLStreamWriter`
// `stream` output stream
// `options.pretty` pretty prints the result
// `options.indent` indentation string
// `options.newline` newline sequence
// `o... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 334fb0954039c73163d22d27c2641ff74f2a63d7 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/334fb0954039c73163d22d27c2641ff74f2a63d7/src/XMLStreamWriter.coffee | 20 | 69 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var XMLStreamWriter;
module.exports = XMLStreamWriter = class XMLStreamWriter extends XMLWriterBase {
// Initializes a new instance of `XMLStreamWriter`
// `stream` output stream
// `options.pretty` pretty prints the result
// `options.indent` indentation... | module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline sequence
# `options.offset` a fixed number of indentatio... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 334fb0954039c73163d22d27c2641ff74f2a63d7 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/334fb0954039c73163d22d27c2641ff74f2a63d7/src/XMLStreamWriter.coffee | 20 | 69 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:completion | completion | module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline sequence
# `options.offset` a fixed number of indentatio... | options = @filterOptions options
options.textispresent = false
for child in doc.children
# skip dummy nodes
if child instanceof XMLDummy then continue
switch
when child instanceof XMLDeclaration then @declaration child, options, 0
when child instanceof XMLDocType then @do... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 334fb0954039c73163d22d27c2641ff74f2a63d7 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/334fb0954039c73163d22d27c2641ff74f2a63d7/src/XMLStreamWriter.coffee | 20 | 69 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:raw_corpus | raw_corpus | docType: (node, options, level) ->
level or= 0
@stream.write @space(node, options, level)
@stream.write '<!DOCTYPE ' + node.root().name
# external identifier
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.wr... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 334fb0954039c73163d22d27c2641ff74f2a63d7 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/334fb0954039c73163d22d27c2641ff74f2a63d7/src/XMLStreamWriter.coffee | 70 | 119 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
docType: (node, options, level) ->
level or= 0
@stream.write @space(node, options, level)
@stream.write '<!DOCTYPE ' + node.root().name
# external identifier
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' +... | var hasProp = {}.hasOwnProperty;
({
docType: function(node, options, level) {
var child, i, len, ref;
level || (level = 0);
this.stream.write(this.space(node, options, level));
this.stream.write('<!DOCTYPE ' + node.root().name);
// external identifier
if (node.pubID && node.sysID) {
thi... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 334fb0954039c73163d22d27c2641ff74f2a63d7 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/334fb0954039c73163d22d27c2641ff74f2a63d7/src/XMLStreamWriter.coffee | 70 | 119 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var hasProp = {}.hasOwnProperty;
({
docType: function(node, options, level) {
var child, i, len, ref;
level || (level = 0);
this.stream.write(this.space(node, options, level));
this.stream.write('<!DOCTYPE ' + node.root().name);
// external i... | docType: (node, options, level) ->
level or= 0
@stream.write @space(node, options, level)
@stream.write '<!DOCTYPE ' + node.root().name
# external identifier
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.wr... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 334fb0954039c73163d22d27c2641ff74f2a63d7 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/334fb0954039c73163d22d27c2641ff74f2a63d7/src/XMLStreamWriter.coffee | 70 | 119 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:completion | completion | docType: (node, options, level) ->
level or= 0
@stream.write @space(node, options, level)
@stream.write '<!DOCTYPE ' + node.root().name
# external identifier
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.wr... | else throw new Error "Unknown DTD node type: " + child.constructor.name
@stream.write ']'
# close tag
@stream.write options.spaceBeforeSlash + '>'
@stream.write @endline(node, options, level)
element: (node, options, level) ->
level or= 0
space = @space(node, options, level)
# open t... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 334fb0954039c73163d22d27c2641ff74f2a63d7 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/334fb0954039c73163d22d27c2641ff74f2a63d7/src/XMLStreamWriter.coffee | 70 | 119 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:raw_corpus | raw_corpus | else if options.pretty and node.children.length == 1 and node.children[0].value?
# do not indent text-only nodes
@stream.write '>'
@stream.write node.children[0].value
@stream.write '</' + node.name + '>'
else
@stream.write '>' + options.newline
# inner tags
for child in no... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 334fb0954039c73163d22d27c2641ff74f2a63d7 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/334fb0954039c73163d22d27c2641ff74f2a63d7/src/XMLStreamWriter.coffee | 120 | 162 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:completion | completion | else if options.pretty and node.children.length == 1 and node.children[0].value?
# do not indent text-only nodes
@stream.write '>'
@stream.write node.children[0].value
@stream.write '</' + node.name + '>'
else
@stream.write '>' + options.newline
# inner tags
for child in no... | @stream.write @endline(node, options, level)
processingInstruction: (node, options, level) ->
@stream.write super(node, options, level)
raw: (node, options, level) ->
@stream.write super(node, options, level)
text: (node, options, level) ->
@stream.write super(node, options, level)
dtdAttList: (... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 334fb0954039c73163d22d27c2641ff74f2a63d7 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/334fb0954039c73163d22d27c2641ff74f2a63d7/src/XMLStreamWriter.coffee | 120 | 162 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:raw_corpus | raw_corpus | module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline sequence
# `options.offset` a fixed number of indentatio... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | b6c2503daa774b02579fb8c98c31877ea24861a1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLStreamWriter.coffee | 20 | 69 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline s... | var XMLStreamWriter;
module.exports = XMLStreamWriter = class XMLStreamWriter extends XMLWriterBase {
// Initializes a new instance of `XMLStreamWriter`
// `stream` output stream
// `options.pretty` pretty prints the result
// `options.indent` indentation string
// `options.newline` newline sequence
// `o... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | b6c2503daa774b02579fb8c98c31877ea24861a1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLStreamWriter.coffee | 20 | 69 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var XMLStreamWriter;
module.exports = XMLStreamWriter = class XMLStreamWriter extends XMLWriterBase {
// Initializes a new instance of `XMLStreamWriter`
// `stream` output stream
// `options.pretty` pretty prints the result
// `options.indent` indentation... | module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline sequence
# `options.offset` a fixed number of indentatio... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | b6c2503daa774b02579fb8c98c31877ea24861a1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLStreamWriter.coffee | 20 | 69 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:completion | completion | module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline sequence
# `options.offset` a fixed number of indentatio... | switch
when child instanceof XMLDeclaration then @declaration child, options, 0
when child instanceof XMLDocType then @docType child, options, 0
when child instanceof XMLComment then @comment child, options, 0
when child instanceof XMLProcessingInstruction then @processin... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | b6c2503daa774b02579fb8c98c31877ea24861a1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLStreamWriter.coffee | 20 | 69 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:raw_corpus | raw_corpus | level or= 0
@stream.write @space(node, options, level)
@stream.write '<!DOCTYPE ' + node.root().name
# external identifier
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | b6c2503daa774b02579fb8c98c31877ea24861a1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLStreamWriter.coffee | 70 | 119 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:completion | completion | level or= 0
@stream.write @space(node, options, level)
@stream.write '<!DOCTYPE ' + node.root().name
# external identifier
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
... | @stream.write ']'
# close tag
@stream.write options.spaceBeforeSlash + '>'
@stream.write @endline(node, options, level)
element: (node, options, level) ->
level or= 0
space = @space(node, options, level)
# open tag
@stream.write space + '<' + node.name
# attributes
for own nam... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | b6c2503daa774b02579fb8c98c31877ea24861a1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLStreamWriter.coffee | 70 | 119 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:raw_corpus | raw_corpus | # do not indent text-only nodes
@stream.write '>'
@stream.write node.children[0].value
@stream.write '</' + node.name + '>'
else
@stream.write '>' + options.newline
# inner tags
for child in node.children
switch
when child instanceof XMLCData then @cdata chi... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | b6c2503daa774b02579fb8c98c31877ea24861a1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLStreamWriter.coffee | 120 | 169 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:completion | completion | # do not indent text-only nodes
@stream.write '>'
@stream.write node.children[0].value
@stream.write '</' + node.name + '>'
else
@stream.write '>' + options.newline
# inner tags
for child in node.children
switch
when child instanceof XMLCData then @cdata chi... | @stream.write options.spaceBeforeSlash + '?>' + @endline(node, options, level)
raw: (node, options, level) ->
@stream.write @space(node, options, level) + node.value + @endline(node, options, level)
text: (node, options, level) ->
@stream.write @space(node, options, level) + node.value + @endline(node, op... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | b6c2503daa774b02579fb8c98c31877ea24861a1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLStreamWriter.coffee | 120 | 169 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:raw_corpus | raw_corpus | if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
@stream.write ' NDATA ' + node.nData if node.nData
@stream.write options.spaceBeforeSlash + '>' + @endline(node, options, level)
... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | b6c2503daa774b02579fb8c98c31877ea24861a1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLStreamWriter.coffee | 170 | 188 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
@stream.write ' NDATA ' + node.nData if node.nData
@stream.write options... | if (node.pubID && node.sysID) {
this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
} else if (node.sysID) {
this.stream.write(' SYSTEM "' + node.sysID + '"');
}
if (node.nData) {
this.stream.write(' NDATA ' + node.nData);
}
this.stream.write(options.spaceBeforeSlash + '>' + this.endline(nod... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | b6c2503daa774b02579fb8c98c31877ea24861a1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLStreamWriter.coffee | 170 | 188 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (node.pubID && node.sysID) {
this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
} else if (node.sysID) {
this.stream.write(' SYSTEM "' + node.sysID + '"');
}
if (node.nData) {
this.stream.write(' NDATA ' + node.nData);
}
this.stream.... | if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
@stream.write ' NDATA ' + node.nData if node.nData
@stream.write options.spaceBeforeSlash + '>' + @endline(node, options, level)
... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | b6c2503daa774b02579fb8c98c31877ea24861a1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLStreamWriter.coffee | 170 | 188 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:completion | completion | if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
@stream.write ' NDATA ' + node.nData if node.nData
@stream.write options.spaceBeforeSlash + '>' + @endline(node, options, level)
... | if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.pubID
@stream.write ' PUBLIC "' + node.pubID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
@stream.write options.spaceBeforeSlash + '>' + @endline(node, optio... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | b6c2503daa774b02579fb8c98c31877ea24861a1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLStreamWriter.coffee | 170 | 188 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:raw_corpus | raw_corpus | module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` the writable output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline sequence
# `options.offset` a fixed number ... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 61c7428475fe9ffc02b63662b59f87749fe3125f | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/61c7428475fe9ffc02b63662b59f87749fe3125f/src/XMLStreamWriter.coffee | 20 | 69 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` the writable output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newli... | var XMLStreamWriter;
module.exports = XMLStreamWriter = class XMLStreamWriter extends XMLWriterBase {
// Initializes a new instance of `XMLStreamWriter`
// `stream` the writable output stream
// `options.pretty` pretty prints the result
// `options.indent` indentation string
// `options.newline` newline seq... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 61c7428475fe9ffc02b63662b59f87749fe3125f | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/61c7428475fe9ffc02b63662b59f87749fe3125f/src/XMLStreamWriter.coffee | 20 | 69 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var XMLStreamWriter;
module.exports = XMLStreamWriter = class XMLStreamWriter extends XMLWriterBase {
// Initializes a new instance of `XMLStreamWriter`
// `stream` the writable output stream
// `options.pretty` pretty prints the result
// `options.indent... | module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` the writable output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline sequence
# `options.offset` a fixed number ... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 61c7428475fe9ffc02b63662b59f87749fe3125f | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/61c7428475fe9ffc02b63662b59f87749fe3125f/src/XMLStreamWriter.coffee | 20 | 69 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:completion | completion | module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` the writable output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline sequence
# `options.offset` a fixed number ... | switch
when child instanceof XMLDeclaration then @declaration child
when child instanceof XMLDocType then @docType child
when child instanceof XMLComment then @comment child
when child instanceof XMLProcessingInstruction then @processingInstruction child
else @ele... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 61c7428475fe9ffc02b63662b59f87749fe3125f | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/61c7428475fe9ffc02b63662b59f87749fe3125f/src/XMLStreamWriter.coffee | 20 | 69 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:raw_corpus | raw_corpus | level or= 0
@stream.write @space(level)
@stream.write '<!DOCTYPE ' + node.root().name
# external identifier
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
# internal sub... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 61c7428475fe9ffc02b63662b59f87749fe3125f | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/61c7428475fe9ffc02b63662b59f87749fe3125f/src/XMLStreamWriter.coffee | 70 | 119 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:completion | completion | level or= 0
@stream.write @space(level)
@stream.write '<!DOCTYPE ' + node.root().name
# external identifier
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
# internal sub... | @stream.write ']'
# close tag
@stream.write @spacebeforeslash + '>'
@stream.write @endline(node)
element: (node, level) ->
level or= 0
space = @space(level)
# open tag
@stream.write space + '<' + node.name
# attributes
for own name, att of node.attributes
@attribute att
... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 61c7428475fe9ffc02b63662b59f87749fe3125f | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/61c7428475fe9ffc02b63662b59f87749fe3125f/src/XMLStreamWriter.coffee | 70 | 119 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:raw_corpus | raw_corpus | # do not indent text-only nodes
@stream.write '>'
@stream.write node.children[0].value
@stream.write '</' + node.name + '>'
else
@stream.write '>' + @newline
# inner tags
for child in node.children
switch
when child instanceof XMLCData then @cdata child, lev... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 61c7428475fe9ffc02b63662b59f87749fe3125f | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/61c7428475fe9ffc02b63662b59f87749fe3125f/src/XMLStreamWriter.coffee | 120 | 169 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:completion | completion | # do not indent text-only nodes
@stream.write '>'
@stream.write node.children[0].value
@stream.write '</' + node.name + '>'
else
@stream.write '>' + @newline
# inner tags
for child in node.children
switch
when child instanceof XMLCData then @cdata child, lev... | @stream.write @spacebeforeslash + '?>' + @endline(node)
raw: (node, level) ->
@stream.write @space(level) + node.value + @endline(node)
text: (node, level) ->
@stream.write @space(level) + node.value + @endline(node)
dtdAttList: (node, level) ->
@stream.write @space(level) + '<!ATTLIST ' + node.ele... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 61c7428475fe9ffc02b63662b59f87749fe3125f | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/61c7428475fe9ffc02b63662b59f87749fe3125f/src/XMLStreamWriter.coffee | 120 | 169 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:raw_corpus | raw_corpus | if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
@stream.write ' NDATA ' + node.nData if node.nData
@stream.write @spacebeforeslash + '>' + @endline(node)
dtdNotation: (node, ... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 61c7428475fe9ffc02b63662b59f87749fe3125f | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/61c7428475fe9ffc02b63662b59f87749fe3125f/src/XMLStreamWriter.coffee | 170 | 191 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
@stream.write ' NDATA ' + node.nData if node.nData
@stream.write @spaceb... | if (node.pubID && node.sysID) {
this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
} else if (node.sysID) {
this.stream.write(' SYSTEM "' + node.sysID + '"');
}
if (node.nData) {
this.stream.write(' NDATA ' + node.nData);
}
this.stream.write(this.spacebeforeslash + '>' + this.endline(node))... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 61c7428475fe9ffc02b63662b59f87749fe3125f | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/61c7428475fe9ffc02b63662b59f87749fe3125f/src/XMLStreamWriter.coffee | 170 | 191 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (node.pubID && node.sysID) {
this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
} else if (node.sysID) {
this.stream.write(' SYSTEM "' + node.sysID + '"');
}
if (node.nData) {
this.stream.write(' NDATA ' + node.nData);
}
this.stream.... | if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
@stream.write ' NDATA ' + node.nData if node.nData
@stream.write @spacebeforeslash + '>' + @endline(node)
dtdNotation: (node, ... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 61c7428475fe9ffc02b63662b59f87749fe3125f | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/61c7428475fe9ffc02b63662b59f87749fe3125f/src/XMLStreamWriter.coffee | 170 | 191 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:completion | completion | if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
@stream.write ' NDATA ' + node.nData if node.nData
@stream.write @spacebeforeslash + '>' + @endline(node)
dtdNotation: (node, ... | else if node.pubID
@stream.write ' PUBLIC "' + node.pubID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
@stream.write @spacebeforeslash + '>' + @endline(node)
endline: (node) ->
unless node.isLastRootNode
@newline
else
'' | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 61c7428475fe9ffc02b63662b59f87749fe3125f | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/61c7428475fe9ffc02b63662b59f87749fe3125f/src/XMLStreamWriter.coffee | 170 | 191 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:raw_corpus | raw_corpus | # do not indent text-only nodes
@stream.write '>'
@stream.write node.children[0].value
@stream.write '</' + node.name + '>'
else
@stream.write '>' + @newline
# inner tags
for child in node.children
switch
when child instanceof XMLCData then @cdata child, lev... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | e524ae2b8e2279a299bb518439698f0646098b3b | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/e524ae2b8e2279a299bb518439698f0646098b3b/src/XMLStreamWriter.coffee | 119 | 168 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:completion | completion | # do not indent text-only nodes
@stream.write '>'
@stream.write node.children[0].value
@stream.write '</' + node.name + '>'
else
@stream.write '>' + @newline
# inner tags
for child in node.children
switch
when child instanceof XMLCData then @cdata child, lev... | raw: (node, level) ->
@stream.write @space(level) + node.value + @endline(node)
text: (node, level) ->
@stream.write @space(level) + node.value + @endline(node)
dtdAttList: (node, level) ->
@stream.write @space(level) + '<!ATTLIST ' + node.elementName + ' ' + node.attributeName + ' ' + node.attributeT... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | e524ae2b8e2279a299bb518439698f0646098b3b | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/e524ae2b8e2279a299bb518439698f0646098b3b/src/XMLStreamWriter.coffee | 119 | 168 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:raw_corpus | raw_corpus | @stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
@stream.write ' NDATA ' + node.nData if node.nData
@stream.write @spacebeforeslash + '>' + @endline(node)
dtdNotation: (node, level) ->
@stream.write @space(le... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | e524ae2b8e2279a299bb518439698f0646098b3b | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/e524ae2b8e2279a299bb518439698f0646098b3b/src/XMLStreamWriter.coffee | 169 | 189 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:completion | completion | @stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
@stream.write ' NDATA ' + node.nData if node.nData
@stream.write @spacebeforeslash + '>' + @endline(node)
dtdNotation: (node, level) ->
@stream.write @space(le... | else if node.pubID
@stream.write ' PUBLIC "' + node.pubID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
@stream.write @spacebeforeslash + '>' + @endline(node)
endline: (node) ->
unless node.isLastRootNode
@newline
else
'' | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | e524ae2b8e2279a299bb518439698f0646098b3b | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/e524ae2b8e2279a299bb518439698f0646098b3b/src/XMLStreamWriter.coffee | 169 | 189 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:raw_corpus | raw_corpus | module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` the writable output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline sequence
# `options.offset` a fixed number ... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | d50956674dbbf940149f9a8386b2fbe8780daab4 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/d50956674dbbf940149f9a8386b2fbe8780daab4/src/XMLStreamWriter.coffee | 19 | 68 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:1:completion | completion | module.exports = class XMLStreamWriter extends XMLWriterBase
# Initializes a new instance of `XMLStreamWriter`
#
# `stream` the writable output stream
# `options.pretty` pretty prints the result
# `options.indent` indentation string
# `options.newline` newline sequence
# `options.offset` a fixed number ... | when child instanceof XMLDeclaration then @declaration child
when child instanceof XMLDocType then @docType child
when child instanceof XMLComment then @comment child
when child instanceof XMLProcessingInstruction then @processingInstruction child
else @element child
a... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | d50956674dbbf940149f9a8386b2fbe8780daab4 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/d50956674dbbf940149f9a8386b2fbe8780daab4/src/XMLStreamWriter.coffee | 19 | 68 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:raw_corpus | raw_corpus | @stream.write @space(level)
@stream.write '<!DOCTYPE ' + node.root().name
# external identifier
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
# internal subset
if node.c... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | d50956674dbbf940149f9a8386b2fbe8780daab4 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/d50956674dbbf940149f9a8386b2fbe8780daab4/src/XMLStreamWriter.coffee | 69 | 118 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:completion | completion | @stream.write @space(level)
@stream.write '<!DOCTYPE ' + node.root().name
# external identifier
if node.pubID and node.sysID
@stream.write ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
# internal subset
if node.c... | # close tag
@stream.write @spacebeforeslash + '>'
@stream.write @endline(node)
element: (node, level) ->
level or= 0
space = @space(level)
# open tag
@stream.write space + '<' + node.name
# attributes
for own name, att of node.attributes
@attribute att
if node.children.l... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | d50956674dbbf940149f9a8386b2fbe8780daab4 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/d50956674dbbf940149f9a8386b2fbe8780daab4/src/XMLStreamWriter.coffee | 69 | 118 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:raw_corpus | raw_corpus | @stream.write '>'
@stream.write node.children[0].value
@stream.write '</' + node.name + '>'
else
@stream.write '>' + @newline
# inner tags
for child in node.children
switch
when child instanceof XMLCData then @cdata child, level + 1
when child instanceof... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | d50956674dbbf940149f9a8386b2fbe8780daab4 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/d50956674dbbf940149f9a8386b2fbe8780daab4/src/XMLStreamWriter.coffee | 119 | 168 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:completion | completion | @stream.write '>'
@stream.write node.children[0].value
@stream.write '</' + node.name + '>'
else
@stream.write '>' + @newline
# inner tags
for child in node.children
switch
when child instanceof XMLCData then @cdata child, level + 1
when child instanceof... | raw: (node, level) ->
@stream.write @space(level) + node.value + @endline(node)
text: (node, level) ->
@stream.write @space(level) + node.value + @endline(node)
dtdAttList: (node, level) ->
@stream.write @space(level) + '<!ATTLIST ' + node.elementName + ' ' + node.attributeName + ' ' + node.attributeT... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | d50956674dbbf940149f9a8386b2fbe8780daab4 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/d50956674dbbf940149f9a8386b2fbe8780daab4/src/XMLStreamWriter.coffee | 119 | 168 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:raw_corpus | raw_corpus | else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
@stream.write ' NDATA ' + node.nData if node.nData
@stream.write @spacebeforeslash + '>' + @endline(node)
dtdNotation: (node, level) ->
@stream.write @space(level) + '<!NOTATION ' + node.name
if node.pubID and node.sysID
... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | d50956674dbbf940149f9a8386b2fbe8780daab4 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/d50956674dbbf940149f9a8386b2fbe8780daab4/src/XMLStreamWriter.coffee | 169 | 188 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:completion | completion | else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
@stream.write ' NDATA ' + node.nData if node.nData
@stream.write @spacebeforeslash + '>' + @endline(node)
dtdNotation: (node, level) ->
@stream.write @space(level) + '<!NOTATION ' + node.name
if node.pubID and node.sysID
... | @stream.write ' PUBLIC "' + node.pubID + '"'
else if node.sysID
@stream.write ' SYSTEM "' + node.sysID + '"'
@stream.write @spacebeforeslash + '>' + @endline(node)
endline: (node) ->
unless node.isLastRootNode
@newline
else
'' | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | d50956674dbbf940149f9a8386b2fbe8780daab4 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/d50956674dbbf940149f9a8386b2fbe8780daab4/src/XMLStreamWriter.coffee | 169 | 188 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/fat_arrow.coffee:1:raw_corpus | raw_corpus | Account: (customer, cart) ->
@customer: customer
@cart: cart
$('.shopping_cart').bind 'click', (event) =>
@customer.purchase @cart | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/documentation/coffee/fat_arrow.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/fat_arrow.coffee | 1 | 6 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/fat_arrow.coffee:1:completion | completion | Account: (customer, cart) ->
@customer: customer
@cart: cart | $('.shopping_cart').bind 'click', (event) =>
@customer.purchase @cart | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/documentation/coffee/fat_arrow.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/fat_arrow.coffee | 1 | 6 |
soulwire/Coffee-Physics:source/math/Random.coffee:1:raw_corpus | raw_corpus | ### Random ###
Random = (min, max) ->
if not max?
max = min
min = 0
min + Math.random() * (max - min)
Random.int = (min, max) ->
if not max?
max = min
min = 0
Math.floor min + Math.random() * (max - min)
Random.sign = (prob = 0.5) ->
if do Math.random < prob then 1 else -1
Random.bool = (prob ... | CoffeeScript | soulwire/Coffee-Physics | source/math/Random.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/math/Random.coffee | 1 | 29 | ||
soulwire/Coffee-Physics:source/math/Random.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
### Random ###
Random = (min, max) ->
if not max?
max = min
min = 0
min + Math.random() * (max - min)
Random.int = (min, max) ->
if not max?
max = min
min = 0
Math.floor min + Math.random() * (max - min)
Random.sign = (prob = 0.5) ->
if d... | /* Random */
var Random;
Random = function(min, max) {
if (max == null) {
max = min;
min = 0;
}
return min + Math.random() * (max - min);
};
Random.int = function(min, max) {
if (max == null) {
max = min;
min = 0;
}
return Math.floor(min + Math.random() * (max - min));
};
Random.sign = fu... | CoffeeScript | JavaScript | soulwire/Coffee-Physics | source/math/Random.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/math/Random.coffee | 1 | 29 |
soulwire/Coffee-Physics:source/math/Random.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/* Random */
var Random;
Random = function(min, max) {
if (max == null) {
max = min;
min = 0;
}
return min + Math.random() * (max - min);
};
Random.int = function(min, max) {
if (max == null) {
max = min;
min = 0;
}
return Math.floor(m... | ### Random ###
Random = (min, max) ->
if not max?
max = min
min = 0
min + Math.random() * (max - min)
Random.int = (min, max) ->
if not max?
max = min
min = 0
Math.floor min + Math.random() * (max - min)
Random.sign = (prob = 0.5) ->
if do Math.random < prob then 1 else -1
Random.bool = (prob ... | JavaScript | CoffeeScript | soulwire/Coffee-Physics | source/math/Random.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/math/Random.coffee | 1 | 29 |
soulwire/Coffee-Physics:source/math/Random.coffee:1:completion | completion | ### Random ###
Random = (min, max) ->
if not max?
max = min
min = 0
min + Math.random() * (max - min)
Random.int = (min, max) ->
if not max?
max = min | min = 0
Math.floor min + Math.random() * (max - min)
Random.sign = (prob = 0.5) ->
if do Math.random < prob then 1 else -1
Random.bool = (prob = 0.5) ->
do Math.random < prob
Random.item = (list) ->
list[ Math.floor Math.random() * list.length ] | CoffeeScript | CoffeeScript | soulwire/Coffee-Physics | source/math/Random.coffee | MIT | df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d | 1,053 | https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/math/Random.coffee | 1 | 29 |
iizukanao/node-rtsp-rtmp-server:codec_utils.coffee:1:raw_corpus | raw_corpus | crypto = require 'crypto'
module.exports =
# Calculate the digest of data and return a buffer
calcHmac: (data, key) ->
hmac = crypto.createHmac 'sha256', key
hmac.update data
return hmac.digest() | CoffeeScript | iizukanao/node-rtsp-rtmp-server | codec_utils.coffee | MIT | 7c2256a1a95a8332acdd153c2e82a9cfe5d3a180 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7c2256a1a95a8332acdd153c2e82a9cfe5d3a180/codec_utils.coffee | 1 | 8 | ||
iizukanao/node-rtsp-rtmp-server:codec_utils.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
crypto = require 'crypto'
module.exports =
# Calculate the digest of data and return a buffer
calcHmac: (data, key) ->
hmac = crypto.createHmac 'sha256', key
hmac.update data
return hmac.digest()
``` | var crypto;
crypto = require('crypto');
module.exports = {
// Calculate the digest of data and return a buffer
calcHmac: function(data, key) {
var hmac;
hmac = crypto.createHmac('sha256', key);
hmac.update(data);
return hmac.digest();
}
}; | CoffeeScript | JavaScript | iizukanao/node-rtsp-rtmp-server | codec_utils.coffee | MIT | 7c2256a1a95a8332acdd153c2e82a9cfe5d3a180 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7c2256a1a95a8332acdd153c2e82a9cfe5d3a180/codec_utils.coffee | 1 | 8 |
iizukanao/node-rtsp-rtmp-server:codec_utils.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var crypto;
crypto = require('crypto');
module.exports = {
// Calculate the digest of data and return a buffer
calcHmac: function(data, key) {
var hmac;
hmac = crypto.createHmac('sha256', key);
hmac.update(data);
return hmac.digest();
}
};
`... | crypto = require 'crypto'
module.exports =
# Calculate the digest of data and return a buffer
calcHmac: (data, key) ->
hmac = crypto.createHmac 'sha256', key
hmac.update data
return hmac.digest() | JavaScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | codec_utils.coffee | MIT | 7c2256a1a95a8332acdd153c2e82a9cfe5d3a180 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7c2256a1a95a8332acdd153c2e82a9cfe5d3a180/codec_utils.coffee | 1 | 8 |
iizukanao/node-rtsp-rtmp-server:codec_utils.coffee:1:completion | completion | crypto = require 'crypto'
module.exports =
# Calculate the digest of data and return a buffer | calcHmac: (data, key) ->
hmac = crypto.createHmac 'sha256', key
hmac.update data
return hmac.digest() | CoffeeScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | codec_utils.coffee | MIT | 7c2256a1a95a8332acdd153c2e82a9cfe5d3a180 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7c2256a1a95a8332acdd153c2e82a9cfe5d3a180/codec_utils.coffee | 1 | 8 |
iizukanao/node-rtsp-rtmp-server:codec_utils.coffee:1:raw_corpus | raw_corpus | crypto = require 'crypto'
module.exports =
# Calculate the digest of data and return a buffer
calcHmac: (data, key) ->
hmac = crypto.createHmac 'sha256', key
hmac.update data
return hmac.digest()
getSampleRateFromFreqIndex: (freqIndex) ->
switch freqIndex
when 0x0 then 96000
when 0x1... | CoffeeScript | iizukanao/node-rtsp-rtmp-server | codec_utils.coffee | MIT | 75f6e58a453d0cc633c02b92b4cd2f78021312d7 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/75f6e58a453d0cc633c02b92b4cd2f78021312d7/codec_utils.coffee | 1 | 45 | ||
iizukanao/node-rtsp-rtmp-server:codec_utils.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
crypto = require 'crypto'
module.exports =
# Calculate the digest of data and return a buffer
calcHmac: (data, key) ->
hmac = crypto.createHmac 'sha256', key
hmac.update data
return hmac.digest()
getSampleRateFromFreqIndex: (freqIndex) ->
... | var crypto;
crypto = require('crypto');
module.exports = {
// Calculate the digest of data and return a buffer
calcHmac: function(data, key) {
var hmac;
hmac = crypto.createHmac('sha256', key);
hmac.update(data);
return hmac.digest();
},
getSampleRateFromFreqIndex: function(freqIndex) {
sw... | CoffeeScript | JavaScript | iizukanao/node-rtsp-rtmp-server | codec_utils.coffee | MIT | 75f6e58a453d0cc633c02b92b4cd2f78021312d7 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/75f6e58a453d0cc633c02b92b4cd2f78021312d7/codec_utils.coffee | 1 | 45 |
iizukanao/node-rtsp-rtmp-server:codec_utils.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var crypto;
crypto = require('crypto');
module.exports = {
// Calculate the digest of data and return a buffer
calcHmac: function(data, key) {
var hmac;
hmac = crypto.createHmac('sha256', key);
hmac.update(data);
return hmac.digest();
},
g... | crypto = require 'crypto'
module.exports =
# Calculate the digest of data and return a buffer
calcHmac: (data, key) ->
hmac = crypto.createHmac 'sha256', key
hmac.update data
return hmac.digest()
getSampleRateFromFreqIndex: (freqIndex) ->
switch freqIndex
when 0x0 then 96000
when 0x1... | JavaScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | codec_utils.coffee | MIT | 75f6e58a453d0cc633c02b92b4cd2f78021312d7 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/75f6e58a453d0cc633c02b92b4cd2f78021312d7/codec_utils.coffee | 1 | 45 |
iizukanao/node-rtsp-rtmp-server:codec_utils.coffee:1:completion | completion | crypto = require 'crypto'
module.exports =
# Calculate the digest of data and return a buffer
calcHmac: (data, key) ->
hmac = crypto.createHmac 'sha256', key
hmac.update data
return hmac.digest()
getSampleRateFromFreqIndex: (freqIndex) ->
switch freqIndex
when 0x0 then 96000
when 0x1... | when 0xb then 8000
when 0xc then 7350
else
throw new Error "Unknown sampling_frequency_index: #{freqIndex}"
# ISO 14496-3 - Table 1.16
getSamplingFreqIndex: (sampleRate) ->
switch sampleRate
when 96000 then 0x0
when 88200 then 0x1
when 64000 then 0x2
when 48000 the... | CoffeeScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | codec_utils.coffee | MIT | 75f6e58a453d0cc633c02b92b4cd2f78021312d7 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/75f6e58a453d0cc633c02b92b4cd2f78021312d7/codec_utils.coffee | 1 | 45 |
iizukanao/node-rtsp-rtmp-server:codec_utils.coffee:1:raw_corpus | raw_corpus | crypto = require 'crypto'
module.exports =
# Calculate the digest of data and return a buffer
calcHmac: (data, key) ->
hmac = crypto.createHmac 'sha256', key
hmac.update data
return hmac.digest()
# ISO 14496-3 - Table 1.16
getSamplingFreqIndex: (sampleRate) ->
switch sampleRate
when 9600... | CoffeeScript | iizukanao/node-rtsp-rtmp-server | codec_utils.coffee | MIT | 7091d488381b2e03ae36bec553572b61cae0d7c5 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7091d488381b2e03ae36bec553572b61cae0d7c5/codec_utils.coffee | 1 | 27 | ||
iizukanao/node-rtsp-rtmp-server:codec_utils.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
crypto = require 'crypto'
module.exports =
# Calculate the digest of data and return a buffer
calcHmac: (data, key) ->
hmac = crypto.createHmac 'sha256', key
hmac.update data
return hmac.digest()
# ISO 14496-3 - Table 1.16
getSamplingFreqInd... | var crypto;
crypto = require('crypto');
module.exports = {
// Calculate the digest of data and return a buffer
calcHmac: function(data, key) {
var hmac;
hmac = crypto.createHmac('sha256', key);
hmac.update(data);
return hmac.digest();
},
// ISO 14496-3 - Table 1.16
getSamplingFreqIndex: func... | CoffeeScript | JavaScript | iizukanao/node-rtsp-rtmp-server | codec_utils.coffee | MIT | 7091d488381b2e03ae36bec553572b61cae0d7c5 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7091d488381b2e03ae36bec553572b61cae0d7c5/codec_utils.coffee | 1 | 27 |
iizukanao/node-rtsp-rtmp-server:codec_utils.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var crypto;
crypto = require('crypto');
module.exports = {
// Calculate the digest of data and return a buffer
calcHmac: function(data, key) {
var hmac;
hmac = crypto.createHmac('sha256', key);
hmac.update(data);
return hmac.digest();
},
/... | crypto = require 'crypto'
module.exports =
# Calculate the digest of data and return a buffer
calcHmac: (data, key) ->
hmac = crypto.createHmac 'sha256', key
hmac.update data
return hmac.digest()
# ISO 14496-3 - Table 1.16
getSamplingFreqIndex: (sampleRate) ->
switch sampleRate
when 9600... | JavaScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | codec_utils.coffee | MIT | 7091d488381b2e03ae36bec553572b61cae0d7c5 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7091d488381b2e03ae36bec553572b61cae0d7c5/codec_utils.coffee | 1 | 27 |
iizukanao/node-rtsp-rtmp-server:codec_utils.coffee:1:raw_corpus | raw_corpus | module.exports =
# ISO 14496-3 - Table 1.16
getSamplingFreqIndex: (sampleRate) ->
switch sampleRate
when 96000 then 0x0
when 88200 then 0x1
when 64000 then 0x2
when 48000 then 0x3
when 44100 then 0x4
when 32000 then 0x5
when 24000 then 0x6
when 22050 then 0x7
... | CoffeeScript | iizukanao/node-rtsp-rtmp-server | codec_utils.coffee | MIT | ac3e9745d7469e457f31115803fcdfbf5d36cbdb | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/ac3e9745d7469e457f31115803fcdfbf5d36cbdb/codec_utils.coffee | 1 | 19 | ||
iizukanao/node-rtsp-rtmp-server:codec_utils.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
# ISO 14496-3 - Table 1.16
getSamplingFreqIndex: (sampleRate) ->
switch sampleRate
when 96000 then 0x0
when 88200 then 0x1
when 64000 then 0x2
when 48000 then 0x3
when 44100 then 0x4
when 32000 then 0x5... | module.exports = {
// ISO 14496-3 - Table 1.16
getSamplingFreqIndex: function(sampleRate) {
switch (sampleRate) {
case 96000:
return 0x0;
case 88200:
return 0x1;
case 64000:
return 0x2;
case 48000:
return 0x3;
case 44100:
return 0x4;
ca... | CoffeeScript | JavaScript | iizukanao/node-rtsp-rtmp-server | codec_utils.coffee | MIT | ac3e9745d7469e457f31115803fcdfbf5d36cbdb | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/ac3e9745d7469e457f31115803fcdfbf5d36cbdb/codec_utils.coffee | 1 | 19 |
iizukanao/node-rtsp-rtmp-server:codec_utils.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
// ISO 14496-3 - Table 1.16
getSamplingFreqIndex: function(sampleRate) {
switch (sampleRate) {
case 96000:
return 0x0;
case 88200:
return 0x1;
case 64000:
return 0x2;
case 48000:
ret... | module.exports =
# ISO 14496-3 - Table 1.16
getSamplingFreqIndex: (sampleRate) ->
switch sampleRate
when 96000 then 0x0
when 88200 then 0x1
when 64000 then 0x2
when 48000 then 0x3
when 44100 then 0x4
when 32000 then 0x5
when 24000 then 0x6
when 22050 then 0x7
... | JavaScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | codec_utils.coffee | MIT | ac3e9745d7469e457f31115803fcdfbf5d36cbdb | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/ac3e9745d7469e457f31115803fcdfbf5d36cbdb/codec_utils.coffee | 1 | 19 |
oozcitak/xmlbuilder-js:perf/perf.coffee:1:raw_corpus | raw_corpus | elapsed = () ->
ms = new Date() - start
start = new Date()
ms
startForTotal = new Date() | CoffeeScript | oozcitak/xmlbuilder-js | perf/perf.coffee | MIT | 666585260655be54935df804c3fb841fd39e8498 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/666585260655be54935df804c3fb841fd39e8498/perf/perf.coffee | 8 | 13 | ||
oozcitak/xmlbuilder-js:perf/perf.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
elapsed = () ->
ms = new Date() - start
start = new Date()
ms
startForTotal = new Date()
``` | var elapsed, startForTotal;
elapsed = function() {
var ms, start;
ms = new Date() - start;
start = new Date();
return ms;
};
startForTotal = new Date(); | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | perf/perf.coffee | MIT | 666585260655be54935df804c3fb841fd39e8498 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/666585260655be54935df804c3fb841fd39e8498/perf/perf.coffee | 8 | 13 |
oozcitak/xmlbuilder-js:perf/perf.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var elapsed, startForTotal;
elapsed = function() {
var ms, start;
ms = new Date() - start;
start = new Date();
return ms;
};
startForTotal = new Date();
``` | elapsed = () ->
ms = new Date() - start
start = new Date()
ms
startForTotal = new Date() | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | perf/perf.coffee | MIT | 666585260655be54935df804c3fb841fd39e8498 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/666585260655be54935df804c3fb841fd39e8498/perf/perf.coffee | 8 | 13 |
oozcitak/xmlbuilder-js:perf/perf.coffee:1:completion | completion | elapsed = () ->
ms = new Date() - start
start = new Date() | ms
startForTotal = new Date() | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | perf/perf.coffee | MIT | 666585260655be54935df804c3fb841fd39e8498 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/666585260655be54935df804c3fb841fd39e8498/perf/perf.coffee | 8 | 13 |
oozcitak/xmlbuilder-js:perf/perf.coffee:3:raw_corpus | raw_corpus | fmtTime = (ms) ->
if ms < 1000
ms + ' ms'
else
(ms / 1000).toFixed(2) + ' s' | CoffeeScript | oozcitak/xmlbuilder-js | perf/perf.coffee | MIT | 666585260655be54935df804c3fb841fd39e8498 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/666585260655be54935df804c3fb841fd39e8498/perf/perf.coffee | 17 | 21 | ||
oozcitak/xmlbuilder-js:perf/perf.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
fmtTime = (ms) ->
if ms < 1000
ms + ' ms'
else
(ms / 1000).toFixed(2) + ' s'
``` | var fmtTime;
fmtTime = function(ms) {
if (ms < 1000) {
return ms + ' ms';
} else {
return (ms / 1000).toFixed(2) + ' s';
}
}; | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | perf/perf.coffee | MIT | 666585260655be54935df804c3fb841fd39e8498 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/666585260655be54935df804c3fb841fd39e8498/perf/perf.coffee | 17 | 21 |
oozcitak/xmlbuilder-js:perf/perf.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var fmtTime;
fmtTime = function(ms) {
if (ms < 1000) {
return ms + ' ms';
} else {
return (ms / 1000).toFixed(2) + ' s';
}
};
``` | fmtTime = (ms) ->
if ms < 1000
ms + ' ms'
else
(ms / 1000).toFixed(2) + ' s' | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | perf/perf.coffee | MIT | 666585260655be54935df804c3fb841fd39e8498 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/666585260655be54935df804c3fb841fd39e8498/perf/perf.coffee | 17 | 21 |
oozcitak/xmlbuilder-js:perf/perf.coffee:3:completion | completion | fmtTime = (ms) ->
if ms < 1000 | ms + ' ms'
else
(ms / 1000).toFixed(2) + ' s' | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | perf/perf.coffee | MIT | 666585260655be54935df804c3fb841fd39e8498 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/666585260655be54935df804c3fb841fd39e8498/perf/perf.coffee | 17 | 21 |
oozcitak/xmlbuilder-js:perf/perf.coffee:4:raw_corpus | raw_corpus | fmtSize = (size, delta) ->
sign = if delta and size > 0 then '+' else ''
if size < 1024
sign + size + ' bytes'
else if size < 1024 * 1024
sign + (size / 1024).toFixed(2) + ' kB'
else if size < 1024 * 1024 * 1024
sign + (size / (1024 * 1024)).toFixed(2) + ' MB'
else
si... | CoffeeScript | oozcitak/xmlbuilder-js | perf/perf.coffee | MIT | 666585260655be54935df804c3fb841fd39e8498 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/666585260655be54935df804c3fb841fd39e8498/perf/perf.coffee | 23 | 32 | ||
oozcitak/xmlbuilder-js:perf/perf.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
fmtSize = (size, delta) ->
sign = if delta and size > 0 then '+' else ''
if size < 1024
sign + size + ' bytes'
else if size < 1024 * 1024
sign + (size / 1024).toFixed(2) + ' kB'
else if size < 1024 * 1024 * 1024
sign + (siz... | var fmtSize;
fmtSize = function(size, delta) {
var sign;
sign = delta && size > 0 ? '+' : '';
if (size < 1024) {
return sign + size + ' bytes';
} else if (size < 1024 * 1024) {
return sign + (size / 1024).toFixed(2) + ' kB';
} else if (size < 1024 * 1024 * 1024) {
return sign + (size / (1024 * 10... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | perf/perf.coffee | MIT | 666585260655be54935df804c3fb841fd39e8498 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/666585260655be54935df804c3fb841fd39e8498/perf/perf.coffee | 23 | 32 |
oozcitak/xmlbuilder-js:perf/perf.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var fmtSize;
fmtSize = function(size, delta) {
var sign;
sign = delta && size > 0 ? '+' : '';
if (size < 1024) {
return sign + size + ' bytes';
} else if (size < 1024 * 1024) {
return sign + (size / 1024).toFixed(2) + ' kB';
} else if (size < 102... | fmtSize = (size, delta) ->
sign = if delta and size > 0 then '+' else ''
if size < 1024
sign + size + ' bytes'
else if size < 1024 * 1024
sign + (size / 1024).toFixed(2) + ' kB'
else if size < 1024 * 1024 * 1024
sign + (size / (1024 * 1024)).toFixed(2) + ' MB'
else
si... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | perf/perf.coffee | MIT | 666585260655be54935df804c3fb841fd39e8498 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/666585260655be54935df804c3fb841fd39e8498/perf/perf.coffee | 23 | 32 |
oozcitak/xmlbuilder-js:perf/perf.coffee:4:completion | completion | fmtSize = (size, delta) ->
sign = if delta and size > 0 then '+' else ''
if size < 1024
sign + size + ' bytes'
else if size < 1024 * 1024 | sign + (size / 1024).toFixed(2) + ' kB'
else if size < 1024 * 1024 * 1024
sign + (size / (1024 * 1024)).toFixed(2) + ' MB'
else
sign + (size / (1024 * 1024 * 1024)).toFixed(2) + ' GB' | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | perf/perf.coffee | MIT | 666585260655be54935df804c3fb841fd39e8498 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/666585260655be54935df804c3fb841fd39e8498/perf/perf.coffee | 23 | 32 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.