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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
xhan/qqbot:src/httpclient.coffee:3:raw_corpus | raw_corpus | handle_resp_body = (body , options , callback) ->
err = null
try
ret = JSON.parse body
catch error
console.log "解析出错", options.url, body
console.log error
err = error
ret = null
callback(ret,err)
# 2 ways to call it
# url, params, callback or
# url, callback
# | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/httpclient.coffee | 60 | 75 | ||
xhan/qqbot:src/httpclient.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
handle_resp_body = (body , options , callback) ->
err = null
try
ret = JSON.parse body
catch error
console.log "解析出错", options.url, body
console.log error
err = error
ret = null
callback(ret,err)
# 2 ways ... | var handle_resp_body;
handle_resp_body = function(body, options, callback) {
var err, error, ret;
err = null;
try {
ret = JSON.parse(body);
} catch (error1) {
error = error1;
console.log("解析出错", options.url, body);
console.log(error);
err = error;
ret = null;
}
return callback(ret, ... | CoffeeScript | JavaScript | xhan/qqbot | src/httpclient.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/httpclient.coffee | 60 | 75 |
xhan/qqbot:src/httpclient.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var handle_resp_body;
handle_resp_body = function(body, options, callback) {
var err, error, ret;
err = null;
try {
ret = JSON.parse(body);
} catch (error1) {
error = error1;
console.log("解析出错", options.url, body);
console.log(error);
e... | handle_resp_body = (body , options , callback) ->
err = null
try
ret = JSON.parse body
catch error
console.log "解析出错", options.url, body
console.log error
err = error
ret = null
callback(ret,err)
# 2 ways to call it
# url, params, callback or
# url, callback
# | JavaScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/httpclient.coffee | 60 | 75 |
xhan/qqbot:src/httpclient.coffee:3:completion | completion | handle_resp_body = (body , options , callback) ->
err = null
try
ret = JSON.parse body
catch error
console.log "解析出错", options.url, body
console.log error
err = error | ret = null
callback(ret,err)
# 2 ways to call it
# url, params, callback or
# url, callback
# | CoffeeScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/httpclient.coffee | 60 | 75 |
xhan/qqbot:src/httpclient.coffee:4:raw_corpus | raw_corpus | http_get = (args...) ->
[url,params,callback] = args
[params,callback] = [null,params] unless callback
options =
method : 'GET'
url : url
http_request( options , params , callback) | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/httpclient.coffee | 76 | 82 | ||
xhan/qqbot:src/httpclient.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
http_get = (args...) ->
[url,params,callback] = args
[params,callback] = [null,params] unless callback
options =
method : 'GET'
url : url
http_request( options , params , callback)
``` | var http_get;
http_get = function(...args) {
var callback, options, params, url;
[url, params, callback] = args;
if (!callback) {
[params, callback] = [null, params];
}
options = {
method: 'GET',
url: url
};
return http_request(options, params, callback);
}; | CoffeeScript | JavaScript | xhan/qqbot | src/httpclient.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/httpclient.coffee | 76 | 82 |
xhan/qqbot:src/httpclient.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var http_get;
http_get = function(...args) {
var callback, options, params, url;
[url, params, callback] = args;
if (!callback) {
[params, callback] = [null, params];
}
options = {
method: 'GET',
url: url
};
return http_request(options, p... | http_get = (args...) ->
[url,params,callback] = args
[params,callback] = [null,params] unless callback
options =
method : 'GET'
url : url
http_request( options , params , callback) | JavaScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/httpclient.coffee | 76 | 82 |
xhan/qqbot:src/httpclient.coffee:4:completion | completion | http_get = (args...) ->
[url,params,callback] = args
[params,callback] = [null,params] unless callback | options =
method : 'GET'
url : url
http_request( options , params , callback) | CoffeeScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/httpclient.coffee | 76 | 82 |
xhan/qqbot:src/httpclient.coffee:5:raw_corpus | raw_corpus | http_post = (options , body, callback) ->
options.method = 'POST'
http_request( options , body , callback)
# 导出方法 | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/httpclient.coffee | 84 | 88 | ||
xhan/qqbot:src/httpclient.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
http_post = (options , body, callback) ->
options.method = 'POST'
http_request( options , body , callback)
# 导出方法
``` | var http_post;
http_post = function(options, body, callback) {
options.method = 'POST';
return http_request(options, body, callback);
};
// 导出方法 | CoffeeScript | JavaScript | xhan/qqbot | src/httpclient.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/httpclient.coffee | 84 | 88 |
xhan/qqbot:src/httpclient.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var http_post;
http_post = function(options, body, callback) {
options.method = 'POST';
return http_request(options, body, callback);
};
// 导出方法
``` | http_post = (options , body, callback) ->
options.method = 'POST'
http_request( options , body , callback)
# 导出方法 | JavaScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/httpclient.coffee | 84 | 88 |
xhan/qqbot:src/httpclient.coffee:2:raw_corpus | raw_corpus | http_request = (options , params , callback) ->
aurl = URL.parse( options.url )
options.host = aurl.host
options.path = aurl.path
options.headers ||= {}
client = if aurl.protocol == 'https:' then https else http
body = ''
if params and options.method == 'POST'
data = querystring.stri... | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 6f15453e3e4b5f49659e7cc83121a87d6d227c13 | 1,435 | https://github.com/xhan/qqbot/blob/6f15453e3e4b5f49659e7cc83121a87d6d227c13/src/httpclient.coffee | 24 | 58 | ||
xhan/qqbot:src/httpclient.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
http_request = (options , params , callback) ->
aurl = URL.parse( options.url )
options.host = aurl.host
options.path = aurl.path
options.headers ||= {}
client = if aurl.protocol == 'https:' then https else http
body = ''
if params a... | var http_request;
http_request = function(options, params, callback) {
var append, aurl, body, client, data, query, req;
aurl = URL.parse(options.url);
options.host = aurl.host;
options.path = aurl.path;
options.headers || (options.headers = {});
client = aurl.protocol === 'https:' ? https : http;
body =... | CoffeeScript | JavaScript | xhan/qqbot | src/httpclient.coffee | MIT | 6f15453e3e4b5f49659e7cc83121a87d6d227c13 | 1,435 | https://github.com/xhan/qqbot/blob/6f15453e3e4b5f49659e7cc83121a87d6d227c13/src/httpclient.coffee | 24 | 58 |
xhan/qqbot:src/httpclient.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var http_request;
http_request = function(options, params, callback) {
var append, aurl, body, client, data, query, req;
aurl = URL.parse(options.url);
options.host = aurl.host;
options.path = aurl.path;
options.headers || (options.headers = {});
clien... | http_request = (options , params , callback) ->
aurl = URL.parse( options.url )
options.host = aurl.host
options.path = aurl.path
options.headers ||= {}
client = if aurl.protocol == 'https:' then https else http
body = ''
if params and options.method == 'POST'
data = querystring.stri... | JavaScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 6f15453e3e4b5f49659e7cc83121a87d6d227c13 | 1,435 | https://github.com/xhan/qqbot/blob/6f15453e3e4b5f49659e7cc83121a87d6d227c13/src/httpclient.coffee | 24 | 58 |
xhan/qqbot:src/httpclient.coffee:2:completion | completion | http_request = (options , params , callback) ->
aurl = URL.parse( options.url )
options.host = aurl.host
options.path = aurl.path
options.headers ||= {}
client = if aurl.protocol == 'https:' then https else http
body = ''
if params and options.method == 'POST'
data = querystring.stri... | options.headers['Cookie'] = all_cookies
options.headers['Referer'] = 'http://d.web2.qq.com/proxy.html?v=20110331002&callback=1&id=3'
req = client.request options, (resp) ->
if options.debug
console.log "response: #{resp.statusCode}"
console.log "cookie: #{resp.headers['set-cookie']}"
... | CoffeeScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 6f15453e3e4b5f49659e7cc83121a87d6d227c13 | 1,435 | https://github.com/xhan/qqbot/blob/6f15453e3e4b5f49659e7cc83121a87d6d227c13/src/httpclient.coffee | 24 | 58 |
xhan/qqbot:src/httpclient.coffee:3:raw_corpus | raw_corpus | handle_resp_body = (body , callback) ->
err = null
try
ret = JSON.parse body
catch error
console.log "解析出错",body
console.log error
err = error
ret = null
callback(ret,err)
# 2 ways to call it
# url, params, callback or
# url, callback
# | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 6f15453e3e4b5f49659e7cc83121a87d6d227c13 | 1,435 | https://github.com/xhan/qqbot/blob/6f15453e3e4b5f49659e7cc83121a87d6d227c13/src/httpclient.coffee | 60 | 75 | ||
xhan/qqbot:src/httpclient.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
handle_resp_body = (body , callback) ->
err = null
try
ret = JSON.parse body
catch error
console.log "解析出错",body
console.log error
err = error
ret = null
callback(ret,err)
# 2 ways to call it
# url, params... | var handle_resp_body;
handle_resp_body = function(body, callback) {
var err, error, ret;
err = null;
try {
ret = JSON.parse(body);
} catch (error1) {
error = error1;
console.log("解析出错", body);
console.log(error);
err = error;
ret = null;
}
return callback(ret, err);
};
// 2 ways to... | CoffeeScript | JavaScript | xhan/qqbot | src/httpclient.coffee | MIT | 6f15453e3e4b5f49659e7cc83121a87d6d227c13 | 1,435 | https://github.com/xhan/qqbot/blob/6f15453e3e4b5f49659e7cc83121a87d6d227c13/src/httpclient.coffee | 60 | 75 |
xhan/qqbot:src/httpclient.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var handle_resp_body;
handle_resp_body = function(body, callback) {
var err, error, ret;
err = null;
try {
ret = JSON.parse(body);
} catch (error1) {
error = error1;
console.log("解析出错", body);
console.log(error);
err = error;
ret = ... | handle_resp_body = (body , callback) ->
err = null
try
ret = JSON.parse body
catch error
console.log "解析出错",body
console.log error
err = error
ret = null
callback(ret,err)
# 2 ways to call it
# url, params, callback or
# url, callback
# | JavaScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 6f15453e3e4b5f49659e7cc83121a87d6d227c13 | 1,435 | https://github.com/xhan/qqbot/blob/6f15453e3e4b5f49659e7cc83121a87d6d227c13/src/httpclient.coffee | 60 | 75 |
xhan/qqbot:src/httpclient.coffee:3:completion | completion | handle_resp_body = (body , callback) ->
err = null
try
ret = JSON.parse body
catch error
console.log "解析出错",body
console.log error
err = error | ret = null
callback(ret,err)
# 2 ways to call it
# url, params, callback or
# url, callback
# | CoffeeScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 6f15453e3e4b5f49659e7cc83121a87d6d227c13 | 1,435 | https://github.com/xhan/qqbot/blob/6f15453e3e4b5f49659e7cc83121a87d6d227c13/src/httpclient.coffee | 60 | 75 |
xhan/qqbot:src/httpclient.coffee:1:raw_corpus | raw_corpus | global_cookies = (cookie)->
all_cookies = cookie if cookie
return all_cookies
# options url:url
# method: GET/POST
# @params 请求参数
# @callback( ret, error) ret为json序列对象 | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 6e4321ea345cd3f5866a98f399cfec24ba7ee3a0 | 1,435 | https://github.com/xhan/qqbot/blob/6e4321ea345cd3f5866a98f399cfec24ba7ee3a0/src/httpclient.coffee | 15 | 22 | ||
xhan/qqbot:src/httpclient.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
global_cookies = (cookie)->
all_cookies = cookie if cookie
return all_cookies
# options url:url
# method: GET/POST
# @params 请求参数
# @callback( ret, error) ret为json序列对象
``` | var global_cookies;
global_cookies = function(cookie) {
var all_cookies;
if (cookie) {
all_cookies = cookie;
}
return all_cookies;
};
// options url:url
// method: GET/POST
// @params 请求参数
// @callback( ret, error) ret为json序列对象 | CoffeeScript | JavaScript | xhan/qqbot | src/httpclient.coffee | MIT | 6e4321ea345cd3f5866a98f399cfec24ba7ee3a0 | 1,435 | https://github.com/xhan/qqbot/blob/6e4321ea345cd3f5866a98f399cfec24ba7ee3a0/src/httpclient.coffee | 15 | 22 |
xhan/qqbot:src/httpclient.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var global_cookies;
global_cookies = function(cookie) {
var all_cookies;
if (cookie) {
all_cookies = cookie;
}
return all_cookies;
};
// options url:url
// method: GET/POST
// @params 请求参数
// @callback( ret, error) ret为json序列对象
``` | global_cookies = (cookie)->
all_cookies = cookie if cookie
return all_cookies
# options url:url
# method: GET/POST
# @params 请求参数
# @callback( ret, error) ret为json序列对象 | JavaScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 6e4321ea345cd3f5866a98f399cfec24ba7ee3a0 | 1,435 | https://github.com/xhan/qqbot/blob/6e4321ea345cd3f5866a98f399cfec24ba7ee3a0/src/httpclient.coffee | 15 | 22 |
xhan/qqbot:src/httpclient.coffee:2:raw_corpus | raw_corpus | http_request = (options , params , callback) ->
aurl = URL.parse( options.url )
options.host = aurl.host
options.path = aurl.path
options.headers ||= {}
client = if aurl.protocol == 'https:' then https else http
body = ''
if params and options.method == 'POST'
data = querystring.stri... | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 6e4321ea345cd3f5866a98f399cfec24ba7ee3a0 | 1,435 | https://github.com/xhan/qqbot/blob/6e4321ea345cd3f5866a98f399cfec24ba7ee3a0/src/httpclient.coffee | 23 | 54 | ||
xhan/qqbot:src/httpclient.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
http_request = (options , params , callback) ->
aurl = URL.parse( options.url )
options.host = aurl.host
options.path = aurl.path
options.headers ||= {}
client = if aurl.protocol == 'https:' then https else http
body = ''
if params a... | var http_request;
http_request = function(options, params, callback) {
var append, aurl, body, client, data, query, req;
aurl = URL.parse(options.url);
options.host = aurl.host;
options.path = aurl.path;
options.headers || (options.headers = {});
client = aurl.protocol === 'https:' ? https : http;
body =... | CoffeeScript | JavaScript | xhan/qqbot | src/httpclient.coffee | MIT | 6e4321ea345cd3f5866a98f399cfec24ba7ee3a0 | 1,435 | https://github.com/xhan/qqbot/blob/6e4321ea345cd3f5866a98f399cfec24ba7ee3a0/src/httpclient.coffee | 23 | 54 |
xhan/qqbot:src/httpclient.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var http_request;
http_request = function(options, params, callback) {
var append, aurl, body, client, data, query, req;
aurl = URL.parse(options.url);
options.host = aurl.host;
options.path = aurl.path;
options.headers || (options.headers = {});
clien... | http_request = (options , params , callback) ->
aurl = URL.parse( options.url )
options.host = aurl.host
options.path = aurl.path
options.headers ||= {}
client = if aurl.protocol == 'https:' then https else http
body = ''
if params and options.method == 'POST'
data = querystring.stri... | JavaScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 6e4321ea345cd3f5866a98f399cfec24ba7ee3a0 | 1,435 | https://github.com/xhan/qqbot/blob/6e4321ea345cd3f5866a98f399cfec24ba7ee3a0/src/httpclient.coffee | 23 | 54 |
xhan/qqbot:src/httpclient.coffee:2:completion | completion | http_request = (options , params , callback) ->
aurl = URL.parse( options.url )
options.host = aurl.host
options.path = aurl.path
options.headers ||= {}
client = if aurl.protocol == 'https:' then https else http
body = ''
if params and options.method == 'POST'
data = querystring.stri... | options.headers['Cookie'] = all_cookies
options.headers['Referer'] = 'http://d.web2.qq.com/proxy.html?v=20110331002&callback=1&id=3'
req = client.request options, (resp) ->
# log "response: #{resp.statusCode}"
resp.on 'data', (chunk) ->
body += chunk
resp.on 'end', ->
... | CoffeeScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 6e4321ea345cd3f5866a98f399cfec24ba7ee3a0 | 1,435 | https://github.com/xhan/qqbot/blob/6e4321ea345cd3f5866a98f399cfec24ba7ee3a0/src/httpclient.coffee | 23 | 54 |
xhan/qqbot:src/httpclient.coffee:1:raw_corpus | raw_corpus | https = require "https"
http = require 'http'
querystring = require 'querystring'
URL = require('url')
jsons = JSON.stringify
# 剥离出来的 HttpClient ,目前仅适合 qqapi 使用
# 返回值:已经解析的json
# 设置全局cookie
all_cookies = []
global_cookies = (cookie)->
all_cookies = cookie if cookie
return all_cookies
# options url:url
# ... | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 63e669761b9785f237af145b420e468cc15ba27e | 1,435 | https://github.com/xhan/qqbot/blob/63e669761b9785f237af145b420e468cc15ba27e/src/httpclient.coffee | 1 | 50 | ||
xhan/qqbot:src/httpclient.coffee:1:completion | completion | https = require "https"
http = require 'http'
querystring = require 'querystring'
URL = require('url')
jsons = JSON.stringify
# 剥离出来的 HttpClient ,目前仅适合 qqapi 使用
# 返回值:已经解析的json
# 设置全局cookie
all_cookies = []
global_cookies = (cookie)->
all_cookies = cookie if cookie
return all_cookies
# options url:url
# ... | client = if aurl.protocol == 'https:' then https else http
body = ''
if params and options.method == 'POST'
data = querystring.stringify params
options.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
options.headers['Content-Length']= Buffer.byteLength(data)
i... | CoffeeScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 63e669761b9785f237af145b420e468cc15ba27e | 1,435 | https://github.com/xhan/qqbot/blob/63e669761b9785f237af145b420e468cc15ba27e/src/httpclient.coffee | 1 | 50 |
xhan/qqbot:src/httpclient.coffee:2:raw_corpus | raw_corpus | req.write(data);
req.end();
handle_resp_body = (body , callback) ->
err = null
try
ret = JSON.parse body
catch error
console.log "解析出错",body
console.log error
err = error
ret = null
callback(ret,err)
http_get = (options , callback) ->
options.method = ... | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 63e669761b9785f237af145b420e468cc15ba27e | 1,435 | https://github.com/xhan/qqbot/blob/63e669761b9785f237af145b420e468cc15ba27e/src/httpclient.coffee | 51 | 79 | ||
xhan/qqbot:src/httpclient.coffee:2:completion | completion | req.write(data);
req.end();
handle_resp_body = (body , callback) ->
err = null
try
ret = JSON.parse body
catch error
console.log "解析出错",body
console.log error
err = error
ret = null
callback(ret,err) | http_get = (options , callback) ->
options.method = 'GET'
http_request( options , null , callback)
http_post = (options , body, callback) ->
options.method = 'POST'
http_request( options , body , callback)
# 导出方法
module.exports =
global_cookies: global_cookies
request: http_request
get: ... | CoffeeScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 63e669761b9785f237af145b420e468cc15ba27e | 1,435 | https://github.com/xhan/qqbot/blob/63e669761b9785f237af145b420e468cc15ba27e/src/httpclient.coffee | 51 | 79 |
xhan/qqbot:src/httpclient.coffee:1:raw_corpus | raw_corpus | https = require "https"
http = require 'http'
querystring = require 'querystring'
URL = require('url')
jsons = JSON.stringify
# 剥离出来的 HttpClient ,目前仅适合 qqapi 使用
# 返回值:已经解析的json
# 设置全局cookie
all_cookies = []
global_cookies = (cookie)->
all_cookies = cookie if cookie
return all_cookies
http_request = (opti... | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 21396c36f0788942c3d40c560cfeac5e2ba3526a | 1,435 | https://github.com/xhan/qqbot/blob/21396c36f0788942c3d40c560cfeac5e2ba3526a/src/httpclient.coffee | 1 | 50 | ||
xhan/qqbot:src/httpclient.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
https = require "https"
http = require 'http'
querystring = require 'querystring'
URL = require('url')
jsons = JSON.stringify
# 剥离出来的 HttpClient ,目前仅适合 qqapi 使用
# 返回值:已经解析的json
# 设置全局cookie
all_cookies = []
global_cookies = (cookie)->
all_cookies = cook... | var URL, all_cookies, global_cookies, handle_resp_body, http, http_request, https, jsons, querystring;
https = require("https");
http = require('http');
querystring = require('querystring');
URL = require('url');
jsons = JSON.stringify;
// 剥离出来的 HttpClient ,目前仅适合 qqapi 使用
// 返回值:已经解析的json
// 设置全局cookie
all_cooki... | CoffeeScript | JavaScript | xhan/qqbot | src/httpclient.coffee | MIT | 21396c36f0788942c3d40c560cfeac5e2ba3526a | 1,435 | https://github.com/xhan/qqbot/blob/21396c36f0788942c3d40c560cfeac5e2ba3526a/src/httpclient.coffee | 1 | 50 |
xhan/qqbot:src/httpclient.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var URL, all_cookies, global_cookies, handle_resp_body, http, http_request, https, jsons, querystring;
https = require("https");
http = require('http');
querystring = require('querystring');
URL = require('url');
jsons = JSON.stringify;
// 剥离出来的 HttpClient ,目... | https = require "https"
http = require 'http'
querystring = require 'querystring'
URL = require('url')
jsons = JSON.stringify
# 剥离出来的 HttpClient ,目前仅适合 qqapi 使用
# 返回值:已经解析的json
# 设置全局cookie
all_cookies = []
global_cookies = (cookie)->
all_cookies = cookie if cookie
return all_cookies
http_request = (opti... | JavaScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 21396c36f0788942c3d40c560cfeac5e2ba3526a | 1,435 | https://github.com/xhan/qqbot/blob/21396c36f0788942c3d40c560cfeac5e2ba3526a/src/httpclient.coffee | 1 | 50 |
xhan/qqbot:src/httpclient.coffee:1:completion | completion | https = require "https"
http = require 'http'
querystring = require 'querystring'
URL = require('url')
jsons = JSON.stringify
# 剥离出来的 HttpClient ,目前仅适合 qqapi 使用
# 返回值:已经解析的json
# 设置全局cookie
all_cookies = []
global_cookies = (cookie)->
all_cookies = cookie if cookie
return all_cookies
http_request = (opti... | data = querystring.stringify params
options.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
options.headers['Content-Length']= Buffer.byteLength(data)
options.headers['Cookie'] = all_cookies
options.headers['Referer'] = 'http://d.web2.qq.com/proxy.html?v=20110331002... | CoffeeScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 21396c36f0788942c3d40c560cfeac5e2ba3526a | 1,435 | https://github.com/xhan/qqbot/blob/21396c36f0788942c3d40c560cfeac5e2ba3526a/src/httpclient.coffee | 1 | 50 |
xhan/qqbot:src/httpclient.coffee:2:raw_corpus | raw_corpus | console.log "解析出错",body
console.log error
err = error
ret = null
callback(ret,err)
http_get = (options , callback) ->
options.method = 'GET'
http_request( options , null , callback)
http_post = (options , body, callback) ->
options.method = 'POST'
http_request( options , ... | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 21396c36f0788942c3d40c560cfeac5e2ba3526a | 1,435 | https://github.com/xhan/qqbot/blob/21396c36f0788942c3d40c560cfeac5e2ba3526a/src/httpclient.coffee | 51 | 71 | ||
xhan/qqbot:src/httpclient.coffee:2:completion | completion | console.log "解析出错",body
console.log error
err = error
ret = null
callback(ret,err)
http_get = (options , callback) ->
options.method = 'GET'
http_request( options , null , callback) | http_post = (options , body, callback) ->
options.method = 'POST'
http_request( options , body , callback)
# 导出方法
module.exports =
global_cookies: global_cookies
request: http_request
get: http_get
post: http_post | CoffeeScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | 21396c36f0788942c3d40c560cfeac5e2ba3526a | 1,435 | https://github.com/xhan/qqbot/blob/21396c36f0788942c3d40c560cfeac5e2ba3526a/src/httpclient.coffee | 51 | 71 |
xhan/qqbot:src/httpclient.coffee:1:raw_corpus | raw_corpus | https = require "https"
http = require 'http'
querystring = require 'querystring'
URL = require('url')
# 设置全局cookie
all_cookies = []
global_cookies = (cookie)->
all_cookies = cookie if cookie
return all_cookies
http_request = (options , params , callback) ->
aurl = URL.parse( options.url )
options... | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | ddc24ad330df446025ce8df32390a7aa6d087533 | 1,435 | https://github.com/xhan/qqbot/blob/ddc24ad330df446025ce8df32390a7aa6d087533/src/httpclient.coffee | 1 | 50 | ||
xhan/qqbot:src/httpclient.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
https = require "https"
http = require 'http'
querystring = require 'querystring'
URL = require('url')
# 设置全局cookie
all_cookies = []
global_cookies = (cookie)->
all_cookies = cookie if cookie
return all_cookies
http_request = (options , params , cal... | var URL, all_cookies, global_cookies, http, http_get, http_post, http_request, https, querystring;
https = require("https");
http = require('http');
querystring = require('querystring');
URL = require('url');
// 设置全局cookie
all_cookies = [];
global_cookies = function(cookie) {
if (cookie) {
all_cookies = coo... | CoffeeScript | JavaScript | xhan/qqbot | src/httpclient.coffee | MIT | ddc24ad330df446025ce8df32390a7aa6d087533 | 1,435 | https://github.com/xhan/qqbot/blob/ddc24ad330df446025ce8df32390a7aa6d087533/src/httpclient.coffee | 1 | 50 |
xhan/qqbot:src/httpclient.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var URL, all_cookies, global_cookies, http, http_get, http_post, http_request, https, querystring;
https = require("https");
http = require('http');
querystring = require('querystring');
URL = require('url');
// 设置全局cookie
all_cookies = [];
global_cookies = f... | https = require "https"
http = require 'http'
querystring = require 'querystring'
URL = require('url')
# 设置全局cookie
all_cookies = []
global_cookies = (cookie)->
all_cookies = cookie if cookie
return all_cookies
http_request = (options , params , callback) ->
aurl = URL.parse( options.url )
options... | JavaScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | ddc24ad330df446025ce8df32390a7aa6d087533 | 1,435 | https://github.com/xhan/qqbot/blob/ddc24ad330df446025ce8df32390a7aa6d087533/src/httpclient.coffee | 1 | 50 |
xhan/qqbot:src/httpclient.coffee:1:completion | completion | https = require "https"
http = require 'http'
querystring = require 'querystring'
URL = require('url')
# 设置全局cookie
all_cookies = []
global_cookies = (cookie)->
all_cookies = cookie if cookie
return all_cookies
http_request = (options , params , callback) ->
aurl = URL.parse( options.url )
options... | options.headers['Cookie'] = all_cookies
options.headers['Referer'] = 'http://d.web2.qq.com/proxy.html?v=20110331002&callback=1&id=3'
req = client.request options, (resp) ->
# log "response: #{resp.statusCode}"
resp.on 'data', (chunk) ->
body += chunk
resp.on 'end', ->
... | CoffeeScript | CoffeeScript | xhan/qqbot | src/httpclient.coffee | MIT | ddc24ad330df446025ce8df32390a7aa6d087533 | 1,435 | https://github.com/xhan/qqbot/blob/ddc24ad330df446025ce8df32390a7aa6d087533/src/httpclient.coffee | 1 | 50 |
jianliaoim/talk-os:talk-account/test/apis/unions/union.coffee:1:raw_corpus | raw_corpus | should = require 'should'
request = require 'supertest'
async = require 'async'
Promise = require 'bluebird'
app = require '../../../server/server'
util = require '../../util'
limbo = require 'limbo'
{
UserModel
MobileModel
} = limbo.use 'account'
_createUser = (done) ->
phoneNumber = '18500000000'
user = ne... | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/union.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/union.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-account/test/apis/unions/union.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
should = require 'should'
request = require 'supertest'
async = require 'async'
Promise = require 'bluebird'
app = require '../../../server/server'
util = require '../../util'
limbo = require 'limbo'
{
UserModel
MobileModel
} = limbo.use 'account'
_createU... | var MobileModel, Promise, UserModel, _createUser, app, async, limbo, request, should, util;
should = require('should');
request = require('supertest');
async = require('async');
Promise = require('bluebird');
app = require('../../../server/server');
util = require('../../util');
limbo = require('limbo');
({User... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/test/apis/unions/union.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/union.coffee | 1 | 50 |
jianliaoim/talk-os:talk-account/test/apis/unions/union.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var MobileModel, Promise, UserModel, _createUser, app, async, limbo, request, should, util;
should = require('should');
request = require('supertest');
async = require('async');
Promise = require('bluebird');
app = require('../../../server/server');
util = re... | should = require 'should'
request = require 'supertest'
async = require 'async'
Promise = require 'bluebird'
app = require '../../../server/server'
util = require '../../util'
limbo = require 'limbo'
{
UserModel
MobileModel
} = limbo.use 'account'
_createUser = (done) ->
phoneNumber = '18500000000'
user = ne... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/union.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/union.coffee | 1 | 50 |
jianliaoim/talk-os:talk-account/test/apis/unions/union.coffee:1:completion | completion | should = require 'should'
request = require 'supertest'
async = require 'async'
Promise = require 'bluebird'
app = require '../../../server/server'
util = require '../../util'
limbo = require 'limbo'
{
UserModel
MobileModel
} = limbo.use 'account'
_createUser = (done) ->
phoneNumber = '18500000000'
user = ne... | done()
.catch done
describe 'Union#unionMain', ->
before _createUser
it 'should get all of the binding union accounts information', (done) ->
async.auto
bindGithub: (callback) ->
options =
method: 'POST'
url: '/union/bind/github'
body:
accountToken: ... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/union.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/union.coffee | 1 | 50 |
jianliaoim/talk-os:talk-account/test/apis/unions/union.coffee:2:raw_corpus | raw_corpus | code: 'xxx'
util.request options, (err, res) ->
callback err
getUnionInfo: ['bindGithub', 'bindWeibo', (callback) ->
request(app).get '/user/accounts'
.send {accountToken: util.user.accountToken}
.end (err, res) ->
data = res.text.match /<script>window\._initia... | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/union.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/union.coffee | 51 | 71 | ||
jianliaoim/talk-os:talk-account/test/apis/unions/union.coffee:2:completion | completion | code: 'xxx'
util.request options, (err, res) ->
callback err
getUnionInfo: ['bindGithub', 'bindWeibo', (callback) ->
request(app).get '/user/accounts'
.send {accountToken: util.user.accountToken}
.end (err, res) ->
data = res.text.match /<script>window\._initia... | account = JSON.parse(data[1]).page.accounts
account.should.have.properties 'phoneNumber'
account.unions.length.should.eql 2
account.unions.forEach (union) ->
union.should.have.properties 'openId', 'refer', 'showname'
callback err
]
, done
after util.clea... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/union.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/union.coffee | 51 | 71 |
soyjavi/QuoJS:spec/3_css.coffee:1:raw_corpus | raw_corpus | describe "CSS", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo"></section>"""
el = $$ "section"
it "add class to a given element", ->
el.addClass "new"
expect(el.hasClass("new")).toBeTruthy()
it "remove class to a given element", ->
el.removeClass "quo... | CoffeeScript | soyjavi/QuoJS | spec/3_css.coffee | MIT | 7296aa6bc321370c1b92de005c9b55b9e1365596 | 2,055 | https://github.com/soyjavi/QuoJS/blob/7296aa6bc321370c1b92de005c9b55b9e1365596/spec/3_css.coffee | 1 | 47 | ||
soyjavi/QuoJS:spec/3_css.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe "CSS", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo"></section>"""
el = $$ "section"
it "add class to a given element", ->
el.addClass "new"
expect(el.hasClass("new")).toBeTruthy()
it "rem... | describe("CSS", function() {
var el;
el = void 0;
beforeEach(function() {
document.body.innerHTML = `<section class="quo"></section>`;
return el = $$("section");
});
it("add class to a given element", function() {
el.addClass("new");
return expect(el.hasClass("new")).toBeTruthy();
});
it("... | CoffeeScript | JavaScript | soyjavi/QuoJS | spec/3_css.coffee | MIT | 7296aa6bc321370c1b92de005c9b55b9e1365596 | 2,055 | https://github.com/soyjavi/QuoJS/blob/7296aa6bc321370c1b92de005c9b55b9e1365596/spec/3_css.coffee | 1 | 47 |
soyjavi/QuoJS:spec/3_css.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe("CSS", function() {
var el;
el = void 0;
beforeEach(function() {
document.body.innerHTML = `<section class="quo"></section>`;
return el = $$("section");
});
it("add class to a given element", function() {
el.addClass("new");
retur... | describe "CSS", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo"></section>"""
el = $$ "section"
it "add class to a given element", ->
el.addClass "new"
expect(el.hasClass("new")).toBeTruthy()
it "remove class to a given element", ->
el.removeClass "quo... | JavaScript | CoffeeScript | soyjavi/QuoJS | spec/3_css.coffee | MIT | 7296aa6bc321370c1b92de005c9b55b9e1365596 | 2,055 | https://github.com/soyjavi/QuoJS/blob/7296aa6bc321370c1b92de005c9b55b9e1365596/spec/3_css.coffee | 1 | 47 |
soyjavi/QuoJS:spec/3_css.coffee:1:completion | completion | describe "CSS", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo"></section>"""
el = $$ "section"
it "add class to a given element", ->
el.addClass "new"
expect(el.hasClass("new")).toBeTruthy()
it "remove class to a given element", ->
el.removeClass "quo... | it "test if class exists in a given element", ->
expect(el.hasClass("quo")).toBeTruthy()
it "returns a list of class styles", ->
classList = '0': 'quo', length: 1
expect(el.listClass()["0"]).toEqual classList["0"]
it "set a stylesheet property in a given element", ->
color = "blue"
el.style ... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | spec/3_css.coffee | MIT | 7296aa6bc321370c1b92de005c9b55b9e1365596 | 2,055 | https://github.com/soyjavi/QuoJS/blob/7296aa6bc321370c1b92de005c9b55b9e1365596/spec/3_css.coffee | 1 | 47 |
oozcitak/xmlbuilder-js:test/basic/validatechar.coffee:1:raw_corpus | raw_corpus | suite 'Validate Input Chars:', ->
test 'Invalid chars in XML 1.0', ->
err () -> xml('test').txt('invalid char \u{0000}')
err () -> xml('test').txt('invalid char \u{0001}')
err () -> xml('test').txt('invalid char \u{0002}')
err () -> xml('test').txt('invalid char \u{0003}')
err () -> xml('test').t... | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/validatechar.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/validatechar.coffee | 1 | 50 | ||
oozcitak/xmlbuilder-js:test/basic/validatechar.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
suite 'Validate Input Chars:', ->
test 'Invalid chars in XML 1.0', ->
err () -> xml('test').txt('invalid char \u{0000}')
err () -> xml('test').txt('invalid char \u{0001}')
err () -> xml('test').txt('invalid char \u{0002}')
err () -> xml('test')... | suite('Validate Input Chars:', function() {
test('Invalid chars in XML 1.0', function() {
err(function() {
return xml('test').txt('invalid char \u{0000}');
});
err(function() {
return xml('test').txt('invalid char \u{0001}');
});
err(function() {
return xml('test').txt('invalid c... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | test/basic/validatechar.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/validatechar.coffee | 1 | 50 |
oozcitak/xmlbuilder-js:test/basic/validatechar.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
suite('Validate Input Chars:', function() {
test('Invalid chars in XML 1.0', function() {
err(function() {
return xml('test').txt('invalid char \u{0000}');
});
err(function() {
return xml('test').txt('invalid char \u{0001}');
});
e... | suite 'Validate Input Chars:', ->
test 'Invalid chars in XML 1.0', ->
err () -> xml('test').txt('invalid char \u{0000}')
err () -> xml('test').txt('invalid char \u{0001}')
err () -> xml('test').txt('invalid char \u{0002}')
err () -> xml('test').txt('invalid char \u{0003}')
err () -> xml('test').t... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/validatechar.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/validatechar.coffee | 1 | 50 |
oozcitak/xmlbuilder-js:test/basic/validatechar.coffee:1:completion | completion | suite 'Validate Input Chars:', ->
test 'Invalid chars in XML 1.0', ->
err () -> xml('test').txt('invalid char \u{0000}')
err () -> xml('test').txt('invalid char \u{0001}')
err () -> xml('test').txt('invalid char \u{0002}')
err () -> xml('test').txt('invalid char \u{0003}')
err () -> xml('test').t... | err () -> xml('test').txt('invalid char \u{001A}')
err () -> xml('test').txt('invalid char \u{001B}')
err () -> xml('test').txt('invalid char \u{001C}')
err () -> xml('test').txt('invalid char \u{001D}')
err () -> xml('test').txt('invalid char \u{001E}')
err () -> xml('test').txt('invalid char \u{00... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/validatechar.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/validatechar.coffee | 1 | 50 |
oozcitak/xmlbuilder-js:test/basic/validatechar.coffee:1:raw_corpus | raw_corpus | suite 'Validate Input Chars:', ->
test 'Invalid chars XML 1.0', ->
err () -> xml('test').node('node with invalid char \u{0000} in node name')
err () -> xml('test').node('node with invalid char \u{0001} in node name')
err () -> xml('test').node('node with invalid char \u{0002} in node name')
err () ->... | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/validatechar.coffee | MIT | 83b747fd14400a741510f32b640ec9183883400d | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/83b747fd14400a741510f32b640ec9183883400d/test/basic/validatechar.coffee | 1 | 46 | ||
oozcitak/xmlbuilder-js:test/basic/validatechar.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
suite 'Validate Input Chars:', ->
test 'Invalid chars XML 1.0', ->
err () -> xml('test').node('node with invalid char \u{0000} in node name')
err () -> xml('test').node('node with invalid char \u{0001} in node name')
err () -> xml('test').node('nod... | suite('Validate Input Chars:', function() {
test('Invalid chars XML 1.0', function() {
err(function() {
return xml('test').node('node with invalid char \u{0000} in node name');
});
err(function() {
return xml('test').node('node with invalid char \u{0001} in node name');
});
err(functio... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | test/basic/validatechar.coffee | MIT | 83b747fd14400a741510f32b640ec9183883400d | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/83b747fd14400a741510f32b640ec9183883400d/test/basic/validatechar.coffee | 1 | 46 |
oozcitak/xmlbuilder-js:test/basic/validatechar.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
suite('Validate Input Chars:', function() {
test('Invalid chars XML 1.0', function() {
err(function() {
return xml('test').node('node with invalid char \u{0000} in node name');
});
err(function() {
return xml('test').node('node with invali... | suite 'Validate Input Chars:', ->
test 'Invalid chars XML 1.0', ->
err () -> xml('test').node('node with invalid char \u{0000} in node name')
err () -> xml('test').node('node with invalid char \u{0001} in node name')
err () -> xml('test').node('node with invalid char \u{0002} in node name')
err () ->... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/validatechar.coffee | MIT | 83b747fd14400a741510f32b640ec9183883400d | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/83b747fd14400a741510f32b640ec9183883400d/test/basic/validatechar.coffee | 1 | 46 |
oozcitak/xmlbuilder-js:test/basic/validatechar.coffee:1:completion | completion | suite 'Validate Input Chars:', ->
test 'Invalid chars XML 1.0', ->
err () -> xml('test').node('node with invalid char \u{0000} in node name')
err () -> xml('test').node('node with invalid char \u{0001} in node name')
err () -> xml('test').node('node with invalid char \u{0002} in node name')
err () ->... | err () -> xml('test').node('node with invalid char \u{0017} in node name')
err () -> xml('test').node('node with invalid char \u{0018} in node name')
err () -> xml('test').node('node with invalid char \u{001A} in node name')
err () -> xml('test').node('node with invalid char \u{001B} in node name')
err ... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/validatechar.coffee | MIT | 83b747fd14400a741510f32b640ec9183883400d | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/83b747fd14400a741510f32b640ec9183883400d/test/basic/validatechar.coffee | 1 | 46 |
jianliaoim/talk-os:talk-web/client/app/attach-image.coffee:1:raw_corpus | raw_corpus | module.exports = React.createClass
displayName: 'message-form-image'
mixins: [ PureRenderMixin ]
propTypes:
# attachment = {
# data:
# thumbnailUrl: string
# imageHeight: number
# imageWidth: number
# isUploading: boolean
# progress: boolean
# }
attachment: ... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/attach-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/attach-image.coffee | 11 | 60 | ||
jianliaoim/talk-os:talk-web/client/app/attach-image.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = React.createClass
displayName: 'message-form-image'
mixins: [ PureRenderMixin ]
propTypes:
# attachment = {
# data:
# thumbnailUrl: string
# imageHeight: number
# imageWidth: number
# isUploading: b... | module.exports = React.createClass({
displayName: 'message-form-image',
mixins: [PureRenderMixin],
propTypes: {
// attachment = {
// data:
// thumbnailUrl: string
// imageHeight: number
// imageWidth: number
// isUploading: boolean
// progress: boolean
// }
at... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/attach-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/attach-image.coffee | 11 | 60 |
jianliaoim/talk-os:talk-web/client/app/attach-image.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = React.createClass({
displayName: 'message-form-image',
mixins: [PureRenderMixin],
propTypes: {
// attachment = {
// data:
// thumbnailUrl: string
// imageHeight: number
// imageWidth: number
// isUpload... | module.exports = React.createClass
displayName: 'message-form-image'
mixins: [ PureRenderMixin ]
propTypes:
# attachment = {
# data:
# thumbnailUrl: string
# imageHeight: number
# imageWidth: number
# isUploading: boolean
# progress: boolean
# }
attachment: ... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/attach-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/attach-image.coffee | 11 | 60 |
jianliaoim/talk-os:talk-web/client/app/attach-image.coffee:1:completion | completion | module.exports = React.createClass
displayName: 'message-form-image'
mixins: [ PureRenderMixin ]
propTypes:
# attachment = {
# data:
# thumbnailUrl: string
# imageHeight: number
# imageWidth: number
# isUploading: boolean
# progress: boolean
# }
attachment: ... | @props.onClick?()
onLoaded: ->
@props.onLoaded?()
renderPreview: ->
thumbnailUrl = @props.attachment.getIn ['data', 'thumbnailUrl']
imageHeight = @props.attachment.getIn ['data', 'imageHeight']
imageWidth = @props.attachment.getIn ['data', 'imageWidth']
insideX = imageWidth <= @props.widthBou... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/attach-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/attach-image.coffee | 11 | 60 |
jianliaoim/talk-os:talk-web/client/app/attach-image.coffee:2:raw_corpus | raw_corpus | previewHeight = Math.round(@props.widthBoundary / imageWidth * imageHeight)
src = # don't parse preview image if thumbnailUrl is a data uri generated from canvas.todataurl
if thumbnailUrl.substring(0, 4) is 'data'
thumbnailUrl
else
thumbnailUrl
.replace(/(\/h\/\d+)/g, "/h/#{pr... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/attach-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/attach-image.coffee | 61 | 87 | ||
jianliaoim/talk-os:talk-web/client/app/attach-image.coffee:2:completion | completion | previewHeight = Math.round(@props.widthBoundary / imageWidth * imageHeight)
src = # don't parse preview image if thumbnailUrl is a data uri generated from canvas.todataurl
if thumbnailUrl.substring(0, 4) is 'data'
thumbnailUrl
else
thumbnailUrl
.replace(/(\/h\/\d+)/g, "/h/#{pr... | image = LiteImage
src: src
onClick: @onClick
onLoaded: @onLoaded
width: previewWidth
height: previewHeight
div className: 'preview', style: style,
image
render: ->
div className: 'attachment-image',
@renderPreview() | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/attach-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/attach-image.coffee | 61 | 87 |
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 | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLStreamWriter.coffee | 6 | 55 | ||
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 | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLStreamWriter.coffee | 6 | 55 |
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 | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLStreamWriter.coffee | 6 | 55 |
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... | child.isLastRootNode = (i is doc.children.length - 1)
options = @filterOptions options
for child in doc.children
@writeChildNode child, options, 0
cdata: (node, options, level) ->
@stream.write super(node, options, level)
comment: (node, options, level) ->
@stream.write super(node, options... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLStreamWriter.coffee | 6 | 55 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2: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 + '"'
# internal subset
if node.children.length > 0
@stream.write ' ['
@stream.write @endline(node, options, level)
options.... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLStreamWriter.coffee | 56 | 105 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2: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 + '"'
# internal subset
if node.children.length > 0
@stream.write ' ['
@s... | var child, i, len1, ref,
hasProp = {}.hasOwnProperty;
if (node.pubID && node.sysID) {
this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
} else if (node.sysID) {
this.stream.write(' SYSTEM "' + node.sysID + '"');
}
// internal subset
if (node.children.length > 0) {
this.stream.write(' [')... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLStreamWriter.coffee | 56 | 105 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var child, i, len1, ref,
hasProp = {}.hasOwnProperty;
if (node.pubID && node.sysID) {
this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
} else if (node.sysID) {
this.stream.write(' SYSTEM "' + node.sysID + '"');
}
// internal subset
if... | 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.children.length > 0
@stream.write ' ['
@stream.write @endline(node, options, level)
options.... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLStreamWriter.coffee | 56 | 105 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:completion | completion | 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.children.length > 0
@stream.write ' ['
@stream.write @endline(node, options, level)
options.... | # open tag
@openNode(node, options, level)
options.state = WriterState.OpenTag
r = @indent(node, options, level) + '<' + node.name
# attributes
if options.pretty and options.width > 0
len = r.length
for own name, att of node.attribs
ratt = @attribute att, options, level
... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLStreamWriter.coffee | 56 | 105 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:raw_corpus | raw_corpus | childNodeCount = node.children.length
firstChildNode = if childNodeCount is 0 then null else node.children[0]
if childNodeCount == 0 or node.children.every((e) -> (e.type is NodeType.Text or e.type is NodeType.Raw or e.type is NodeType.CData) and e.value == '')
# empty element
if options.allowEmpty
... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLStreamWriter.coffee | 106 | 155 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:completion | completion | childNodeCount = node.children.length
firstChildNode = if childNodeCount is 0 then null else node.children[0]
if childNodeCount == 0 or node.children.every((e) -> (e.type is NodeType.Text or e.type is NodeType.Raw or e.type is NodeType.CData) and e.value == '')
# empty element
if options.allowEmpty
... | # inner tags
for child in node.children
@writeChildNode child, options, level + 1
# close tag
options.state = WriterState.CloseTag
@stream.write @indent(node, options, level) + '</' + node.name + '>'
@stream.write @endline(node, options, level)
options.state = WriterState.None
... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLStreamWriter.coffee | 106 | 155 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:raw_corpus | raw_corpus | 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 | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLStreamWriter.coffee | 156 | 161 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:4:completion | completion | 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 | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLStreamWriter.coffee | 156 | 161 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:raw_corpus | raw_corpus | childNodeCount = node.children.length
firstChildNode = if childNodeCount is 0 then null else node.children[0]
if childNodeCount == 0 or node.children.every((e) -> (e.type is NodeType.Text or e.type is NodeType.Raw) and e.value == '')
# empty element
if options.allowEmpty
@stream.write '>'
... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | c92ba3e6387ab305e9487b4bee546f249da33f4e | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/c92ba3e6387ab305e9487b4bee546f249da33f4e/src/XMLStreamWriter.coffee | 106 | 155 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:completion | completion | childNodeCount = node.children.length
firstChildNode = if childNodeCount is 0 then null else node.children[0]
if childNodeCount == 0 or node.children.every((e) -> (e.type is NodeType.Text or e.type is NodeType.Raw) and e.value == '')
# empty element
if options.allowEmpty
@stream.write '>'
... | # inner tags
for child in node.children
@writeChildNode child, options, level + 1
# close tag
options.state = WriterState.CloseTag
@stream.write @indent(node, options, level) + '</' + node.name + '>'
@stream.write @endline(node, options, level)
options.state = WriterState.None
... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | c92ba3e6387ab305e9487b4bee546f249da33f4e | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/c92ba3e6387ab305e9487b4bee546f249da33f4e/src/XMLStreamWriter.coffee | 106 | 155 |
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 | e89afa28c7d8b7154225931b62572edd95db2857 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/e89afa28c7d8b7154225931b62572edd95db2857/src/XMLStreamWriter.coffee | 6 | 55 | ||
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 | e89afa28c7d8b7154225931b62572edd95db2857 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/e89afa28c7d8b7154225931b62572edd95db2857/src/XMLStreamWriter.coffee | 6 | 55 |
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 | e89afa28c7d8b7154225931b62572edd95db2857 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/e89afa28c7d8b7154225931b62572edd95db2857/src/XMLStreamWriter.coffee | 6 | 55 |
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... | child.isLastRootNode = (i is doc.children.length - 1)
options = @filterOptions options
for child in doc.children
@writeChildNode child, options, 0
attribute: (att, options, level) ->
@stream.write super(att, options, level)
cdata: (node, options, level) ->
@stream.write super(node, options... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | e89afa28c7d8b7154225931b62572edd95db2857 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/e89afa28c7d8b7154225931b62572edd95db2857/src/XMLStreamWriter.coffee | 6 | 55 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:raw_corpus | raw_corpus | @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.children.length > 0
@stream... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | e89afa28c7d8b7154225931b62572edd95db2857 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/e89afa28c7d8b7154225931b62572edd95db2857/src/XMLStreamWriter.coffee | 56 | 105 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:completion | completion | @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.children.length > 0
@stream... | element: (node, options, level) ->
level or= 0
# open tag
@openNode(node, options, level)
options.state = WriterState.OpenTag
@stream.write @indent(node, options, level) + '<' + node.name
# attributes
for own name, att of node.attribs
@attribute att, options, level
childNodeCoun... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | e89afa28c7d8b7154225931b62572edd95db2857 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/e89afa28c7d8b7154225931b62572edd95db2857/src/XMLStreamWriter.coffee | 56 | 105 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:raw_corpus | raw_corpus | @stream.write '>'
options.state = WriterState.InsideTag
options.suppressPrettyCount++
prettySuppressed = true
@writeChildNode firstChildNode, options, level + 1
options.suppressPrettyCount--
prettySuppressed = false
options.state = WriterState.CloseTag
@stream.write '</' ... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | e89afa28c7d8b7154225931b62572edd95db2857 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/e89afa28c7d8b7154225931b62572edd95db2857/src/XMLStreamWriter.coffee | 106 | 148 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:completion | completion | @stream.write '>'
options.state = WriterState.InsideTag
options.suppressPrettyCount++
prettySuppressed = true
@writeChildNode firstChildNode, options, level + 1
options.suppressPrettyCount--
prettySuppressed = false
options.state = WriterState.CloseTag
@stream.write '</' ... | @closeNode(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: (node, option... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | e89afa28c7d8b7154225931b62572edd95db2857 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/e89afa28c7d8b7154225931b62572edd95db2857/src/XMLStreamWriter.coffee | 106 | 148 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:raw_corpus | raw_corpus | @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.children.length > 0
@stream... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 15582b28513b6e5d26451f0eecfc3ab91a69d1ac | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/15582b28513b6e5d26451f0eecfc3ab91a69d1ac/src/XMLStreamWriter.coffee | 56 | 105 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:completion | completion | @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.children.length > 0
@stream... | element: (node, options, level) ->
level or= 0
# open tag
@openNode(node, options, level)
options.state = WriterState.OpenTag
@stream.write @indent(node, options, level) + '<' + node.name
# attributes
for own name, att of node.attributes
@attribute att, options, level
childNodeC... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 15582b28513b6e5d26451f0eecfc3ab91a69d1ac | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/15582b28513b6e5d26451f0eecfc3ab91a69d1ac/src/XMLStreamWriter.coffee | 56 | 105 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:raw_corpus | raw_corpus | @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.countNonDummy() > 0
@stream... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | c82ecdf27a636f7a0d2882fd51560d99211b0037 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/c82ecdf27a636f7a0d2882fd51560d99211b0037/src/XMLStreamWriter.coffee | 56 | 105 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:completion | completion | @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.countNonDummy() > 0
@stream... | element: (node, options, level) ->
level or= 0
# open tag
@openNode(node, options, level)
options.state = WriterState.OpenTag
@stream.write @indent(node, options, level) + '<' + node.name
# attributes
for own name, att of node.attributes
@attribute att, options, level
childNodeC... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | c82ecdf27a636f7a0d2882fd51560d99211b0037 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/c82ecdf27a636f7a0d2882fd51560d99211b0037/src/XMLStreamWriter.coffee | 56 | 105 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:raw_corpus | raw_corpus | @stream.write '>'
options.state = WriterState.InsideTag
options.suppressPrettyCount++
prettySuppressed = true
@writeChildNode firstNonDummyChildNode, options, level + 1
options.suppressPrettyCount--
prettySuppressed = false
options.state = WriterState.CloseTag
@stream.wri... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | c82ecdf27a636f7a0d2882fd51560d99211b0037 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/c82ecdf27a636f7a0d2882fd51560d99211b0037/src/XMLStreamWriter.coffee | 106 | 148 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:completion | completion | @stream.write '>'
options.state = WriterState.InsideTag
options.suppressPrettyCount++
prettySuppressed = true
@writeChildNode firstNonDummyChildNode, options, level + 1
options.suppressPrettyCount--
prettySuppressed = false
options.state = WriterState.CloseTag
@stream.wri... | @closeNode(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: (node, option... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | c82ecdf27a636f7a0d2882fd51560d99211b0037 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/c82ecdf27a636f7a0d2882fd51560d99211b0037/src/XMLStreamWriter.coffee | 106 | 148 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:raw_corpus | raw_corpus | @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.countNonDummy() > 0
@stream... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 51829ccef13737993177b0e19e1b7117b85dd544 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/51829ccef13737993177b0e19e1b7117b85dd544/src/XMLStreamWriter.coffee | 55 | 104 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:completion | completion | @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.countNonDummy() > 0
@stream... | element: (node, options, level) ->
level or= 0
# open tag
@openNode(node, options, level)
options.state = WriterState.OpenTag
@stream.write @indent(node, options, level) + '<' + node.name
# attributes
for own name, att of node.attributes
@attribute att, options, level
childNodeC... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 51829ccef13737993177b0e19e1b7117b85dd544 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/51829ccef13737993177b0e19e1b7117b85dd544/src/XMLStreamWriter.coffee | 55 | 104 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:raw_corpus | raw_corpus | @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.children.length > 0
@stream... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 5eec933eaa56c450b60a7215f93aed6383d2431d | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/5eec933eaa56c450b60a7215f93aed6383d2431d/src/XMLStreamWriter.coffee | 55 | 104 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:2:completion | completion | @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.children.length > 0
@stream... | element: (node, options, level) ->
level or= 0
# open tag
@openNode(node, options, level)
options.state = WriterState.OpenTag
@stream.write @indent(node, options, level) + '<' + node.name
# attributes
for own name, att of node.attributes
@attribute att, options, level
if node.ch... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 5eec933eaa56c450b60a7215f93aed6383d2431d | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/5eec933eaa56c450b60a7215f93aed6383d2431d/src/XMLStreamWriter.coffee | 55 | 104 |
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:raw_corpus | raw_corpus | options.suppressPrettyCount++
prettySuppressed = true
@writeChildNode node.children[0], options, level + 1
options.suppressPrettyCount--
prettySuppressed = false
options.state = WriterState.CloseTag
@stream.write '</' + node.name + '>'
else
@stream.write '>' + @endline(node... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 5eec933eaa56c450b60a7215f93aed6383d2431d | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/5eec933eaa56c450b60a7215f93aed6383d2431d/src/XMLStreamWriter.coffee | 105 | 145 | ||
oozcitak/xmlbuilder-js:src/XMLStreamWriter.coffee:3:completion | completion | options.suppressPrettyCount++
prettySuppressed = true
@writeChildNode node.children[0], options, level + 1
options.suppressPrettyCount--
prettySuppressed = false
options.state = WriterState.CloseTag
@stream.write '</' + node.name + '>'
else
@stream.write '>' + @endline(node... | 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: (node, options, level) ->
@stream.write super... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLStreamWriter.coffee | MIT | 5eec933eaa56c450b60a7215f93aed6383d2431d | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/5eec933eaa56c450b60a7215f93aed6383d2431d/src/XMLStreamWriter.coffee | 105 | 145 |
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 | 71fc9cbc188ae1e726a7df21d91c1b265fbdb78b | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/71fc9cbc188ae1e726a7df21d91c1b265fbdb78b/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 | 71fc9cbc188ae1e726a7df21d91c1b265fbdb78b | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/71fc9cbc188ae1e726a7df21d91c1b265fbdb78b/src/XMLStreamWriter.coffee | 21 | 70 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.