id stringlengths 34 124 | type stringclasses 4
values | prompt stringlengths 0 4.95k | response stringlengths 21 4.89k | source_lang stringclasses 3
values | target_lang stringclasses 2
values | repo stringclasses 75
values | path stringlengths 10 88 | license stringclasses 1
value | commit stringlengths 40 40 | stars int64 431 18.7k | source_url stringlengths 86 176 | line_start int64 1 214 | line_end int64 3 253 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jianliaoim/talk-os:talk-account/server/schemas/user.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
UserSchema.methods.genAccountToken = function(payload = {}) {
return jwt.sign(_.assign({}, payload, {
_id: this._id
}), config.accountCookieSecret, {
expiresIn: config.accountCookieExpires,
noTimestamp: true
});
};
``` | UserSchema.methods.genAccountToken = (payload = {}) ->
jwt.sign _.assign({}, payload, _id: @_id),
config.accountCookieSecret
,
expiresIn: config.accountCookieExpires
noTimestamp: true | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/user.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/user.coffee | 69 | 74 |
jianliaoim/talk-os:talk-account/server/schemas/user.coffee:3:completion | completion | UserSchema.methods.genAccountToken = (payload = {}) ->
jwt.sign _.assign({}, payload, _id: @_id),
config.accountCookieSecret | ,
expiresIn: config.accountCookieExpires
noTimestamp: true | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/user.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/user.coffee | 69 | 74 |
jianliaoim/talk-os:talk-account/server/schemas/user.coffee:5:raw_corpus | raw_corpus | UserSchema.methods.verifyPassword = (rawPassword, callback) ->
user = this
return callback(new Err('LOGIN_VERIFY_FAILED')) unless user.password?.length
bcrypt.compare rawPassword, user.password, (err, matched) ->
return callback(new Err('LOGIN_VERIFY_FAILED')) unless matched
callback err, user
##########... | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/user.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/user.coffee | 79 | 86 | ||
jianliaoim/talk-os:talk-account/server/schemas/user.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
UserSchema.methods.verifyPassword = (rawPassword, callback) ->
user = this
return callback(new Err('LOGIN_VERIFY_FAILED')) unless user.password?.length
bcrypt.compare rawPassword, user.password, (err, matched) ->
return callback(new Err('LOGIN_VERIFY_FA... | UserSchema.methods.verifyPassword = function(rawPassword, callback) {
var ref, user;
user = this;
if (!((ref = user.password) != null ? ref.length : void 0)) {
return callback(new Err('LOGIN_VERIFY_FAILED'));
}
return bcrypt.compare(rawPassword, user.password, function(err, matched) {
if (!matched) {
... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/server/schemas/user.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/user.coffee | 79 | 86 |
jianliaoim/talk-os:talk-account/server/schemas/user.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
UserSchema.methods.verifyPassword = function(rawPassword, callback) {
var ref, user;
user = this;
if (!((ref = user.password) != null ? ref.length : void 0)) {
return callback(new Err('LOGIN_VERIFY_FAILED'));
}
return bcrypt.compare(rawPassword, user.... | UserSchema.methods.verifyPassword = (rawPassword, callback) ->
user = this
return callback(new Err('LOGIN_VERIFY_FAILED')) unless user.password?.length
bcrypt.compare rawPassword, user.password, (err, matched) ->
return callback(new Err('LOGIN_VERIFY_FAILED')) unless matched
callback err, user
##########... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/user.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/user.coffee | 79 | 86 |
jianliaoim/talk-os:talk-account/server/schemas/user.coffee:5:completion | completion | UserSchema.methods.verifyPassword = (rawPassword, callback) ->
user = this
return callback(new Err('LOGIN_VERIFY_FAILED')) unless user.password?.length
bcrypt.compare rawPassword, user.password, (err, matched) -> | return callback(new Err('LOGIN_VERIFY_FAILED')) unless matched
callback err, user
##################### STATICS ##################### | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/user.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/user.coffee | 79 | 86 |
jianliaoim/talk-os:talk-account/server/schemas/user.coffee:6:raw_corpus | raw_corpus | UserSchema.statics.verifyAccountToken = (accountToken, callback) ->
try
accountObj = jwt.verify accountToken, config.accountCookieSecret
catch err
return callback(new Err('ACCESS_FAILED')) unless accountObj?._id
UserModel = this
UserModel.findOne _id: accountObj?._id, (err, user) ->
return callback(n... | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/user.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/user.coffee | 88 | 103 | ||
jianliaoim/talk-os:talk-account/server/schemas/user.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
UserSchema.statics.verifyAccountToken = (accountToken, callback) ->
try
accountObj = jwt.verify accountToken, config.accountCookieSecret
catch err
return callback(new Err('ACCESS_FAILED')) unless accountObj?._id
UserModel = this
UserModel.findOne _... | UserSchema.statics.verifyAccountToken = function(accountToken, callback) {
var UserModel, accountObj, err;
try {
accountObj = jwt.verify(accountToken, config.accountCookieSecret);
} catch (error) {
err = error;
}
if (!(accountObj != null ? accountObj._id : void 0)) {
return callback(new Err('ACCES... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/server/schemas/user.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/user.coffee | 88 | 103 |
jianliaoim/talk-os:talk-account/server/schemas/user.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
UserSchema.statics.verifyAccountToken = function(accountToken, callback) {
var UserModel, accountObj, err;
try {
accountObj = jwt.verify(accountToken, config.accountCookieSecret);
} catch (error) {
err = error;
}
if (!(accountObj != null ? account... | UserSchema.statics.verifyAccountToken = (accountToken, callback) ->
try
accountObj = jwt.verify accountToken, config.accountCookieSecret
catch err
return callback(new Err('ACCESS_FAILED')) unless accountObj?._id
UserModel = this
UserModel.findOne _id: accountObj?._id, (err, user) ->
return callback(n... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/user.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/user.coffee | 88 | 103 |
jianliaoim/talk-os:talk-account/server/schemas/user.coffee:6:completion | completion | UserSchema.statics.verifyAccountToken = (accountToken, callback) ->
try
accountObj = jwt.verify accountToken, config.accountCookieSecret
catch err
return callback(new Err('ACCESS_FAILED')) unless accountObj?._id
UserModel = this
UserModel.findOne _id: accountObj?._id, (err, user) -> | return callback(new Err('OBJECT_MISSING', "user #{accountObj._id}")) unless user
user.login = accountObj.login
callback err, user
UserSchema.pre 'save', (next) ->
# 标识用户是否为新注册
@wasNew = true if @isNew
next() | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/user.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/user.coffee | 88 | 103 |
jianliaoim/talk-os:talk-web/client/app/message-attachment-slim.coffee:1:raw_corpus | raw_corpus | React = require 'react'
Immutable = require 'immutable'
mixinMessageContent = require '../mixin/message-content'
div = React.createFactory 'div'
strong = React.createFactory 'strong'
T = React.PropTypes
module.exports = React.createClass
displayName: 'message-attachment-slim'
mixins: [mixinMessageContent]
... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/message-attachment-slim.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/message-attachment-slim.coffee | 1 | 25 | ||
jianliaoim/talk-os:talk-web/client/app/message-attachment-slim.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
React = require 'react'
Immutable = require 'immutable'
mixinMessageContent = require '../mixin/message-content'
div = React.createFactory 'div'
strong = React.createFactory 'strong'
T = React.PropTypes
module.exports = React.createClass
displayName: 'mes... | var Immutable, React, T, div, mixinMessageContent, strong;
React = require('react');
Immutable = require('immutable');
mixinMessageContent = require('../mixin/message-content');
div = React.createFactory('div');
strong = React.createFactory('strong');
T = React.PropTypes;
module.exports = React.createClass({
d... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/message-attachment-slim.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/message-attachment-slim.coffee | 1 | 25 |
jianliaoim/talk-os:talk-web/client/app/message-attachment-slim.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Immutable, React, T, div, mixinMessageContent, strong;
React = require('react');
Immutable = require('immutable');
mixinMessageContent = require('../mixin/message-content');
div = React.createFactory('div');
strong = React.createFactory('strong');
T = Rea... | React = require 'react'
Immutable = require 'immutable'
mixinMessageContent = require '../mixin/message-content'
div = React.createFactory 'div'
strong = React.createFactory 'strong'
T = React.PropTypes
module.exports = React.createClass
displayName: 'message-attachment-slim'
mixins: [mixinMessageContent]
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/message-attachment-slim.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/message-attachment-slim.coffee | 1 | 25 |
jianliaoim/talk-os:talk-web/client/app/message-attachment-slim.coffee:1:completion | completion | React = require 'react'
Immutable = require 'immutable'
mixinMessageContent = require '../mixin/message-content'
div = React.createFactory 'div'
strong = React.createFactory 'strong'
T = React.PropTypes
module.exports = React.createClass
displayName: 'message-attachment-slim'
mixins: [mixinMessageContent] | propTypes:
message: T.instanceOf(Immutable.Map)
onClick: T.func
renderTitle: ->
strong {},
@props.message.getIn(['creator', 'name'])
render: ->
div className: 'message-attachment-slim', onClick: @props.onClick,
@renderTitle()
@renderContent() | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/message-attachment-slim.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/message-attachment-slim.coffee | 1 | 25 |
jashkenas/coffeescript:test/soaks.coffee:1:raw_corpus | raw_corpus | # Soaks
# -----
# * Soaked Property Access
# * Soaked Method Invocation
# * Soaked Function Invocation
# Soaked Property Access
test "soaked property access", ->
nonce = {}
obj = a: b: nonce
eq nonce , obj?.a.b
eq nonce , obj?['a'].b
eq nonce , obj.a?.b
eq nonce , obj?.a?['b']
eq undefined... | CoffeeScript | jashkenas/coffeescript | test/soaks.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/soaks.coffee | 1 | 43 | ||
jashkenas/coffeescript:test/soaks.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Soaks
# -----
# * Soaked Property Access
# * Soaked Method Invocation
# * Soaked Function Invocation
# Soaked Property Access
test "soaked property access", ->
nonce = {}
obj = a: b: nonce
eq nonce , obj?.a.b
eq nonce , obj?['a'].b
eq nonce ... | // Soaks
// -----
// * Soaked Property Access
// * Soaked Method Invocation
// * Soaked Function Invocation
// Soaked Property Access
test("soaked property access", function() {
var nonce, obj, ref, ref1, ref2, ref3, ref4;
nonce = {};
obj = {
a: {
b: nonce
}
};
eq(nonce, obj != null ? obj.a.b ... | CoffeeScript | JavaScript | jashkenas/coffeescript | test/soaks.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/soaks.coffee | 1 | 43 |
jashkenas/coffeescript:test/soaks.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Soaks
// -----
// * Soaked Property Access
// * Soaked Method Invocation
// * Soaked Function Invocation
// Soaked Property Access
test("soaked property access", function() {
var nonce, obj, ref, ref1, ref2, ref3, ref4;
nonce = {};
obj = {
a: {
... | # Soaks
# -----
# * Soaked Property Access
# * Soaked Method Invocation
# * Soaked Function Invocation
# Soaked Property Access
test "soaked property access", ->
nonce = {}
obj = a: b: nonce
eq nonce , obj?.a.b
eq nonce , obj?['a'].b
eq nonce , obj.a?.b
eq nonce , obj?.a?['b']
eq undefined... | JavaScript | CoffeeScript | jashkenas/coffeescript | test/soaks.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/soaks.coffee | 1 | 43 |
jashkenas/coffeescript:test/soaks.coffee:1:completion | completion | # Soaks
# -----
# * Soaked Property Access
# * Soaked Method Invocation
# * Soaked Function Invocation
# Soaked Property Access
test "soaked property access", ->
nonce = {}
obj = a: b: nonce
eq nonce , obj?.a.b
eq nonce , obj?['a'].b
eq nonce , obj.a?.b
eq nonce , obj?.a?['b']
eq undefined... | obj = fn: -> a: nonce
eq nonce , obj.fn()?.a
eq undefined, obj.fn()?.b
test "soaked property access caching", ->
nonce = {}
counter = 0
fn = ->
counter++
'self'
obj =
self: -> @
prop: nonce
eq nonce, obj[fn()]()[fn()]()[fn()]()?.prop
eq 3, counter
test "method calls on soaked method... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/soaks.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/soaks.coffee | 1 | 43 |
jashkenas/coffeescript:test/soaks.coffee:2:raw_corpus | raw_corpus | test "postfix existential operator mixes well with soaked property accesses", ->
eq false, nonexistent?.property?
test "function invocation with soaked property access", ->
id = (_) -> _
eq undefined, id nonexistent?.method()
test "if-to-ternary should safely parenthesize soaked property accesses", ->
ok (if ... | CoffeeScript | jashkenas/coffeescript | test/soaks.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/soaks.coffee | 45 | 88 | ||
jashkenas/coffeescript:test/soaks.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
test "postfix existential operator mixes well with soaked property accesses", ->
eq false, nonexistent?.property?
test "function invocation with soaked property access", ->
id = (_) -> _
eq undefined, id nonexistent?.method()
test "if-to-ternary should sa... | test("postfix existential operator mixes well with soaked property accesses", function() {
return eq(false, (typeof nonexistent !== "undefined" && nonexistent !== null ? nonexistent.property : void 0) != null);
});
test("function invocation with soaked property access", function() {
var id;
id = function(_) {
... | CoffeeScript | JavaScript | jashkenas/coffeescript | test/soaks.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/soaks.coffee | 45 | 88 |
jashkenas/coffeescript:test/soaks.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
test("postfix existential operator mixes well with soaked property accesses", function() {
return eq(false, (typeof nonexistent !== "undefined" && nonexistent !== null ? nonexistent.property : void 0) != null);
});
test("function invocation with soaked property ... | test "postfix existential operator mixes well with soaked property accesses", ->
eq false, nonexistent?.property?
test "function invocation with soaked property access", ->
id = (_) -> _
eq undefined, id nonexistent?.method()
test "if-to-ternary should safely parenthesize soaked property accesses", ->
ok (if ... | JavaScript | CoffeeScript | jashkenas/coffeescript | test/soaks.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/soaks.coffee | 45 | 88 |
jashkenas/coffeescript:test/soaks.coffee:2:completion | completion | test "postfix existential operator mixes well with soaked property accesses", ->
eq false, nonexistent?.property?
test "function invocation with soaked property access", ->
id = (_) -> _
eq undefined, id nonexistent?.method()
test "if-to-ternary should safely parenthesize soaked property accesses", ->
ok (if ... | # TODO: improve this test
a = b: {c: 0}
eq 1, a?.b.c + 1
eq 1, a?.b.c += 1
eq 2, ++a?.b.c
eq yes, delete a?.b.c
# Soaked Method Invocation
test "soaked method invocation", ->
nonce = {}
counter = 0
obj =
self: -> @
increment: -> counter++; @
eq obj , obj.self?()
eq undefined, ... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/soaks.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/soaks.coffee | 45 | 88 |
jashkenas/coffeescript:test/soaks.coffee:3:raw_corpus | raw_corpus | test "#733: conditional assignments", ->
a = b: {c: null}
eq a.b?.c?(), undefined
a.b?.c or= (it) -> it
eq a.b?.c?(1), 1
eq a.b?.c?([2, 3]...), 2
# Soaked Function Invocation
test "soaked function invocation", ->
nonce = {}
id = (_) -> _
eq nonce , id?(nonce)
eq nonce , (id? nonce)
eq undef... | CoffeeScript | jashkenas/coffeescript | test/soaks.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/soaks.coffee | 90 | 129 | ||
jashkenas/coffeescript:test/soaks.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
test "#733: conditional assignments", ->
a = b: {c: null}
eq a.b?.c?(), undefined
a.b?.c or= (it) -> it
eq a.b?.c?(1), 1
eq a.b?.c?([2, 3]...), 2
# Soaked Function Invocation
test "soaked function invocation", ->
nonce = {}
id = (_) -> _
eq non... | test("#733: conditional assignments", function() {
var a, ref, ref1, ref2, ref3;
a = {
b: {
c: null
}
};
eq((ref = a.b) != null ? typeof ref.c === "function" ? ref.c() : void 0 : void 0, void 0);
if ((ref1 = a.b) != null) {
ref1.c || (ref1.c = function(it) {
return it;
});
}
eq... | CoffeeScript | JavaScript | jashkenas/coffeescript | test/soaks.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/soaks.coffee | 90 | 129 |
jashkenas/coffeescript:test/soaks.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
test("#733: conditional assignments", function() {
var a, ref, ref1, ref2, ref3;
a = {
b: {
c: null
}
};
eq((ref = a.b) != null ? typeof ref.c === "function" ? ref.c() : void 0 : void 0, void 0);
if ((ref1 = a.b) != null) {
ref1.c || (re... | test "#733: conditional assignments", ->
a = b: {c: null}
eq a.b?.c?(), undefined
a.b?.c or= (it) -> it
eq a.b?.c?(1), 1
eq a.b?.c?([2, 3]...), 2
# Soaked Function Invocation
test "soaked function invocation", ->
nonce = {}
id = (_) -> _
eq nonce , id?(nonce)
eq nonce , (id? nonce)
eq undef... | JavaScript | CoffeeScript | jashkenas/coffeescript | test/soaks.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/soaks.coffee | 90 | 129 |
jashkenas/coffeescript:test/soaks.coffee:3:completion | completion | test "#733: conditional assignments", ->
a = b: {c: null}
eq a.b?.c?(), undefined
a.b?.c or= (it) -> it
eq a.b?.c?(1), 1
eq a.b?.c?([2, 3]...), 2
# Soaked Function Invocation
test "soaked function invocation", ->
nonce = {}
id = (_) -> _
eq nonce , id?(nonce)
eq nonce , (id? nonce)
eq undef... | id = (_) -> _
maybe = (fn, arg) -> if typeof fn is 'function' then () -> fn(arg)
eq maybe(id, nonce)?(), nonce
eq (maybe id, nonce)?(), nonce
eq (maybe false, nonce)?(), undefined
test "soaked constructor invocation", ->
eq 42 , +new Number? 42
eq undefined, new Other? 42
test "soaked constructor ... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/soaks.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/soaks.coffee | 90 | 129 |
jashkenas/coffeescript:test/soaks.coffee:4:raw_corpus | raw_corpus | test "soaked function invocation safe on non-functions", ->
eq undefined, (0)?(1)
eq undefined, (0)? 1, 2 | CoffeeScript | jashkenas/coffeescript | test/soaks.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/soaks.coffee | 131 | 133 | ||
jashkenas/coffeescript:test/soaks.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
test "soaked function invocation safe on non-functions", ->
eq undefined, (0)?(1)
eq undefined, (0)? 1, 2
``` | test("soaked function invocation safe on non-functions", function() {
var base, base1;
eq(void 0, typeof (base = 0) === "function" ? base(1) : void 0);
return eq(void 0, typeof (base1 = 0) === "function" ? base1(1, 2) : void 0);
}); | CoffeeScript | JavaScript | jashkenas/coffeescript | test/soaks.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/soaks.coffee | 131 | 133 |
jashkenas/coffeescript:test/soaks.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
test("soaked function invocation safe on non-functions", function() {
var base, base1;
eq(void 0, typeof (base = 0) === "function" ? base(1) : void 0);
return eq(void 0, typeof (base1 = 0) === "function" ? base1(1, 2) : void 0);
});
``` | test "soaked function invocation safe on non-functions", ->
eq undefined, (0)?(1)
eq undefined, (0)? 1, 2 | JavaScript | CoffeeScript | jashkenas/coffeescript | test/soaks.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/soaks.coffee | 131 | 133 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:1:raw_corpus | raw_corpus | describe 'The Bucky Object', ->
it 'should be defined', ->
expect(Bucky).toBeDefined()
it 'should itself be a client', ->
expect(Bucky.send).toBeDefined()
expect(Bucky.timer).toBeDefined()
expect(Bucky.count).toBeDefined()
expect(Bucky.requests).toBeDefined()
it 'should create clients when c... | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | 646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3/spec/bucky.spec.coffee | 1 | 41 | ||
HubSpot/BuckyClient:spec/bucky.spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'The Bucky Object', ->
it 'should be defined', ->
expect(Bucky).toBeDefined()
it 'should itself be a client', ->
expect(Bucky.send).toBeDefined()
expect(Bucky.timer).toBeDefined()
expect(Bucky.count).toBeDefined()
expect(Bucky.re... | describe('The Bucky Object', function() {
it('should be defined', function() {
return expect(Bucky).toBeDefined();
});
it('should itself be a client', function() {
expect(Bucky.send).toBeDefined();
expect(Bucky.timer).toBeDefined();
expect(Bucky.count).toBeDefined();
return expect(Bucky.reques... | CoffeeScript | JavaScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | 646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3/spec/bucky.spec.coffee | 1 | 41 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('The Bucky Object', function() {
it('should be defined', function() {
return expect(Bucky).toBeDefined();
});
it('should itself be a client', function() {
expect(Bucky.send).toBeDefined();
expect(Bucky.timer).toBeDefined();
expect(Buc... | describe 'The Bucky Object', ->
it 'should be defined', ->
expect(Bucky).toBeDefined()
it 'should itself be a client', ->
expect(Bucky.send).toBeDefined()
expect(Bucky.timer).toBeDefined()
expect(Bucky.count).toBeDefined()
expect(Bucky.requests).toBeDefined()
it 'should create clients when c... | JavaScript | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | 646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3/spec/bucky.spec.coffee | 1 | 41 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:1:completion | completion | describe 'The Bucky Object', ->
it 'should be defined', ->
expect(Bucky).toBeDefined()
it 'should itself be a client', ->
expect(Bucky.send).toBeDefined()
expect(Bucky.timer).toBeDefined()
expect(Bucky.count).toBeDefined()
expect(Bucky.requests).toBeDefined()
it 'should create clients when c... | expect(client.send).toBeDefined()
describe 'setOptions', ->
it 'should set options', ->
Bucky.setOptions
host: '/test'
expect(Bucky.options.host).toBe('/test')
describe 'getFullUrl', ->
it 'should add the hostname if the url starts with slash', ->
expect(Bucky.requests.getFullUrl('/test', {host... | CoffeeScript | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | 646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3/spec/bucky.spec.coffee | 1 | 41 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:2:raw_corpus | raw_corpus | it 'should strip leading and trailing slashes', ->
expect(utk('/a/b/c/')).toBe('a.b.c')
it 'should strip get parameters', ->
url = '/contacts/53/lists/ajax/list/all/detail?properties=%5B%22firstname%22%2C%22lastname%22%2C%22photo%22%2C%22twitterhandle%22%2C%22twitterprofilephoto%22%2C%22website%22%2C%22compa... | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | 646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3/spec/bucky.spec.coffee | 43 | 82 | ||
HubSpot/BuckyClient:spec/bucky.spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should strip leading and trailing slashes', ->
expect(utk('/a/b/c/')).toBe('a.b.c')
it 'should strip get parameters', ->
url = '/contacts/53/lists/ajax/list/all/detail?properties=%5B%22firstname%22%2C%22lastname%22%2C%22photo%22%2C%22twitterhandle%... | it('should strip leading and trailing slashes', function() {
return expect(utk('/a/b/c/')).toBe('a.b.c');
});
it('should strip get parameters', function() {
var res, url;
url = '/contacts/53/lists/ajax/list/all/detail?properties=%5B%22firstname%22%2C%22lastname%22%2C%22photo%22%2C%22twitterhandle%22%2C%22twitter... | CoffeeScript | JavaScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | 646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3/spec/bucky.spec.coffee | 43 | 82 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should strip leading and trailing slashes', function() {
return expect(utk('/a/b/c/')).toBe('a.b.c');
});
it('should strip get parameters', function() {
var res, url;
url = '/contacts/53/lists/ajax/list/all/detail?properties=%5B%22firstname%22%2C%22lastn... | it 'should strip leading and trailing slashes', ->
expect(utk('/a/b/c/')).toBe('a.b.c')
it 'should strip get parameters', ->
url = '/contacts/53/lists/ajax/list/all/detail?properties=%5B%22firstname%22%2C%22lastname%22%2C%22photo%22%2C%22twitterhandle%22%2C%22twitterprofilephoto%22%2C%22website%22%2C%22compa... | JavaScript | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | 646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3/spec/bucky.spec.coffee | 43 | 82 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:2:completion | completion | it 'should strip leading and trailing slashes', ->
expect(utk('/a/b/c/')).toBe('a.b.c')
it 'should strip get parameters', ->
url = '/contacts/53/lists/ajax/list/all/detail?properties=%5B%22firstname%22%2C%22lastname%22%2C%22photo%22%2C%22twitterhandle%22%2C%22twitterprofilephoto%22%2C%22website%22%2C%22compa... | expect(utk('http://www.google.com/test/site')).toBe('google.test.site')
it 'should add the passed in root', ->
expect(utk('test/as', null, 'root')).toBe('root.test.as')
it 'should strip email addresses', ->
expect(utk('test/page/zack@comnet.org/me')).toBe('test.page.me')
it 'should strip domain names i... | CoffeeScript | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | 646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3/spec/bucky.spec.coffee | 43 | 82 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:3:raw_corpus | raw_corpus | it 'should decode uri entities', ->
expect(utk('test/it%20expect/it/to/work')).toBe('test.it.expect.it.to.work')
it 'should convert colons to underscores', ->
expect(utk('test/path:with:colons/yea')).toBe('test.path_with_colons.yea')
describe 'send', ->
server = null
beforeEach ->
server = sinon.fa... | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | 646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3/spec/bucky.spec.coffee | 84 | 114 | ||
HubSpot/BuckyClient:spec/bucky.spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should decode uri entities', ->
expect(utk('test/it%20expect/it/to/work')).toBe('test.it.expect.it.to.work')
it 'should convert colons to underscores', ->
expect(utk('test/path:with:colons/yea')).toBe('test.path_with_colons.yea')
describe 'send', ... | it('should decode uri entities', function() {
return expect(utk('test/it%20expect/it/to/work')).toBe('test.it.expect.it.to.work');
});
it('should convert colons to underscores', function() {
return expect(utk('test/path:with:colons/yea')).toBe('test.path_with_colons.yea');
});
describe('send', function() {
var ... | CoffeeScript | JavaScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | 646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3/spec/bucky.spec.coffee | 84 | 114 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should decode uri entities', function() {
return expect(utk('test/it%20expect/it/to/work')).toBe('test.it.expect.it.to.work');
});
it('should convert colons to underscores', function() {
return expect(utk('test/path:with:colons/yea')).toBe('test.path_with_... | it 'should decode uri entities', ->
expect(utk('test/it%20expect/it/to/work')).toBe('test.it.expect.it.to.work')
it 'should convert colons to underscores', ->
expect(utk('test/path:with:colons/yea')).toBe('test.path_with_colons.yea')
describe 'send', ->
server = null
beforeEach ->
server = sinon.fa... | JavaScript | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | 646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3/spec/bucky.spec.coffee | 84 | 114 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:3:completion | completion | it 'should decode uri entities', ->
expect(utk('test/it%20expect/it/to/work')).toBe('test.it.expect.it.to.work')
it 'should convert colons to underscores', ->
expect(utk('test/path:with:colons/yea')).toBe('test.path_with_colons.yea')
describe 'send', ->
server = null
beforeEach ->
server = sinon.fa... | it 'should send a datapoint', ->
Bucky.send 'data.point', 4
Bucky.flush()
expect(server.requests.length).toBe(1)
expect(server.requests[0].requestBody).toBe("data.point:4|g\n")
it 'should send timers', ->
Bucky.send 'data.1', 5, 'timer'
Bucky.send 'data.2', 3, 'timer'
Bucky.flush()
... | CoffeeScript | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | 646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3/spec/bucky.spec.coffee | 84 | 114 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:3:raw_corpus | raw_corpus | it 'should decode uri entities', ->
expect(utk('test/it%20expect/it/to/work')).toBe('test.it.expect.it.to.work')
it 'should convert colons to underscores', ->
expect(utk('test/path:with:colons/yea')).toBe('test.path_with_colons.yea')
describe 'send', ->
server = null
beforeEach ->
server = sinon.fa... | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | 7afa10acec99b9a6a07edcecb7245bfeb043bdbc | 1,725 | https://github.com/HubSpot/BuckyClient/blob/7afa10acec99b9a6a07edcecb7245bfeb043bdbc/spec/bucky.spec.coffee | 84 | 116 | ||
HubSpot/BuckyClient:spec/bucky.spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should decode uri entities', ->
expect(utk('test/it%20expect/it/to/work')).toBe('test.it.expect.it.to.work')
it 'should convert colons to underscores', ->
expect(utk('test/path:with:colons/yea')).toBe('test.path_with_colons.yea')
describe 'send', ... | it('should decode uri entities', function() {
return expect(utk('test/it%20expect/it/to/work')).toBe('test.it.expect.it.to.work');
});
it('should convert colons to underscores', function() {
return expect(utk('test/path:with:colons/yea')).toBe('test.path_with_colons.yea');
});
describe('send', function() {
var ... | CoffeeScript | JavaScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | 7afa10acec99b9a6a07edcecb7245bfeb043bdbc | 1,725 | https://github.com/HubSpot/BuckyClient/blob/7afa10acec99b9a6a07edcecb7245bfeb043bdbc/spec/bucky.spec.coffee | 84 | 116 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should decode uri entities', function() {
return expect(utk('test/it%20expect/it/to/work')).toBe('test.it.expect.it.to.work');
});
it('should convert colons to underscores', function() {
return expect(utk('test/path:with:colons/yea')).toBe('test.path_with_... | it 'should decode uri entities', ->
expect(utk('test/it%20expect/it/to/work')).toBe('test.it.expect.it.to.work')
it 'should convert colons to underscores', ->
expect(utk('test/path:with:colons/yea')).toBe('test.path_with_colons.yea')
describe 'send', ->
server = null
beforeEach ->
server = sinon.fa... | JavaScript | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | 7afa10acec99b9a6a07edcecb7245bfeb043bdbc | 1,725 | https://github.com/HubSpot/BuckyClient/blob/7afa10acec99b9a6a07edcecb7245bfeb043bdbc/spec/bucky.spec.coffee | 84 | 116 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:3:completion | completion | it 'should decode uri entities', ->
expect(utk('test/it%20expect/it/to/work')).toBe('test.it.expect.it.to.work')
it 'should convert colons to underscores', ->
expect(utk('test/path:with:colons/yea')).toBe('test.path_with_colons.yea')
describe 'send', ->
server = null
beforeEach ->
server = sinon.fa... | it 'should send a datapoint', ->
Bucky.send 'data.point', 4
Bucky.flush()
expect(server.requests.length).toBe(1)
expect(JSON.parse(server.requests[0].requestBody)['data.point']).toBe("4.000|g")
it 'should send timers', ->
Bucky.send 'data.1', 5, 'timer'
Bucky.send 'data.2', 3, 'timer'
Bu... | CoffeeScript | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | 7afa10acec99b9a6a07edcecb7245bfeb043bdbc | 1,725 | https://github.com/HubSpot/BuckyClient/blob/7afa10acec99b9a6a07edcecb7245bfeb043bdbc/spec/bucky.spec.coffee | 84 | 116 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:1:raw_corpus | raw_corpus | describe 'The Bucky Object', ->
it 'should be defined', ->
expect(Bucky).toBeDefined()
it 'should itself be a client', ->
expect(Bucky.send).toBeDefined()
expect(Bucky.timer).toBeDefined()
expect(Bucky.count).toBeDefined()
expect(Bucky.requests).toBeDefined()
it 'should create clients when c... | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | df60a219ba8a5d3d6a92601f28128d05f552b1e9 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/df60a219ba8a5d3d6a92601f28128d05f552b1e9/spec/bucky.spec.coffee | 1 | 41 | ||
HubSpot/BuckyClient:spec/bucky.spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'The Bucky Object', ->
it 'should be defined', ->
expect(Bucky).toBeDefined()
it 'should itself be a client', ->
expect(Bucky.send).toBeDefined()
expect(Bucky.timer).toBeDefined()
expect(Bucky.count).toBeDefined()
expect(Bucky.re... | describe('The Bucky Object', function() {
it('should be defined', function() {
return expect(Bucky).toBeDefined();
});
it('should itself be a client', function() {
expect(Bucky.send).toBeDefined();
expect(Bucky.timer).toBeDefined();
expect(Bucky.count).toBeDefined();
return expect(Bucky.reques... | CoffeeScript | JavaScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | df60a219ba8a5d3d6a92601f28128d05f552b1e9 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/df60a219ba8a5d3d6a92601f28128d05f552b1e9/spec/bucky.spec.coffee | 1 | 41 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('The Bucky Object', function() {
it('should be defined', function() {
return expect(Bucky).toBeDefined();
});
it('should itself be a client', function() {
expect(Bucky.send).toBeDefined();
expect(Bucky.timer).toBeDefined();
expect(Buc... | describe 'The Bucky Object', ->
it 'should be defined', ->
expect(Bucky).toBeDefined()
it 'should itself be a client', ->
expect(Bucky.send).toBeDefined()
expect(Bucky.timer).toBeDefined()
expect(Bucky.count).toBeDefined()
expect(Bucky.requests).toBeDefined()
it 'should create clients when c... | JavaScript | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | df60a219ba8a5d3d6a92601f28128d05f552b1e9 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/df60a219ba8a5d3d6a92601f28128d05f552b1e9/spec/bucky.spec.coffee | 1 | 41 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:1:completion | completion | describe 'The Bucky Object', ->
it 'should be defined', ->
expect(Bucky).toBeDefined()
it 'should itself be a client', ->
expect(Bucky.send).toBeDefined()
expect(Bucky.timer).toBeDefined()
expect(Bucky.count).toBeDefined()
expect(Bucky.requests).toBeDefined()
it 'should create clients when c... | expect(client.send).toBeDefined()
describe 'getFullUrl', ->
it 'should add the hostname if the url starts with slash', ->
expect(Bucky.requests.getFullUrl('/test', {hostname: 'host'})).toBe('host/test')
describe 'urlToKey', ->
utk = Bucky.requests.urlToKey
it 'should convert slashes to dots', ->
expect... | CoffeeScript | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | df60a219ba8a5d3d6a92601f28128d05f552b1e9 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/df60a219ba8a5d3d6a92601f28128d05f552b1e9/spec/bucky.spec.coffee | 1 | 41 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:2:raw_corpus | raw_corpus | expect(utk(url)).toBe(res)
it 'should strip url hashes', ->
expect(utk('/test/abc#page')).toBe('test.abc')
expect(utk('http://app.hubspot.com/analyze/landing-pages/#range=custom&frequency=weekly&start=03&end=06events')).toBe('app.hubspot.analyze.landing-pages')
it 'should strip ids', ->
expect(utk('te... | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | df60a219ba8a5d3d6a92601f28128d05f552b1e9 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/df60a219ba8a5d3d6a92601f28128d05f552b1e9/spec/bucky.spec.coffee | 43 | 81 | ||
HubSpot/BuckyClient:spec/bucky.spec.coffee:2:completion | completion | expect(utk(url)).toBe(res)
it 'should strip url hashes', ->
expect(utk('/test/abc#page')).toBe('test.abc')
expect(utk('http://app.hubspot.com/analyze/landing-pages/#range=custom&frequency=weekly&start=03&end=06events')).toBe('app.hubspot.analyze.landing-pages')
it 'should strip ids', ->
expect(utk('te... | expect(utk('test/page/zack@comnet.org/me')).toBe('test.page.me')
it 'should strip domain names in the path', ->
expect(utk('test/page/hubspot.com/me')).toBe('test.page.me')
it 'should strip port numbers in the host', ->
expect(utk('http://www.awesome.com:1337/test/page')).toBe('awesome.test.page')
it '... | CoffeeScript | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | df60a219ba8a5d3d6a92601f28128d05f552b1e9 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/df60a219ba8a5d3d6a92601f28128d05f552b1e9/spec/bucky.spec.coffee | 43 | 81 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:3:raw_corpus | raw_corpus | describe 'send', ->
server = null
beforeEach ->
server = sinon.fakeServer.create()
server.autoRespond = true
Bucky.setOptions
host: 'http://www.google.com'
afterEach ->
server.restore()
it 'should send a datapoint', ->
Bucky.send 'data.point', 4
Bucky.flush()
expect(server... | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | df60a219ba8a5d3d6a92601f28128d05f552b1e9 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/df60a219ba8a5d3d6a92601f28128d05f552b1e9/spec/bucky.spec.coffee | 83 | 112 | ||
HubSpot/BuckyClient:spec/bucky.spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'send', ->
server = null
beforeEach ->
server = sinon.fakeServer.create()
server.autoRespond = true
Bucky.setOptions
host: 'http://www.google.com'
afterEach ->
server.restore()
it 'should send a datapoint', ->
Bucky.... | describe('send', function() {
var server;
server = null;
beforeEach(function() {
server = sinon.fakeServer.create();
server.autoRespond = true;
return Bucky.setOptions({
host: 'http://www.google.com'
});
});
afterEach(function() {
return server.restore();
});
it('should send a da... | CoffeeScript | JavaScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | df60a219ba8a5d3d6a92601f28128d05f552b1e9 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/df60a219ba8a5d3d6a92601f28128d05f552b1e9/spec/bucky.spec.coffee | 83 | 112 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('send', function() {
var server;
server = null;
beforeEach(function() {
server = sinon.fakeServer.create();
server.autoRespond = true;
return Bucky.setOptions({
host: 'http://www.google.com'
});
});
afterEach(function() {
... | describe 'send', ->
server = null
beforeEach ->
server = sinon.fakeServer.create()
server.autoRespond = true
Bucky.setOptions
host: 'http://www.google.com'
afterEach ->
server.restore()
it 'should send a datapoint', ->
Bucky.send 'data.point', 4
Bucky.flush()
expect(server... | JavaScript | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | df60a219ba8a5d3d6a92601f28128d05f552b1e9 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/df60a219ba8a5d3d6a92601f28128d05f552b1e9/spec/bucky.spec.coffee | 83 | 112 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:3:completion | completion | describe 'send', ->
server = null
beforeEach ->
server = sinon.fakeServer.create()
server.autoRespond = true
Bucky.setOptions
host: 'http://www.google.com'
afterEach ->
server.restore()
it 'should send a datapoint', ->
Bucky.send 'data.point', 4 | Bucky.flush()
expect(server.requests.length).toBe(1)
expect(JSON.parse(server.requests[0].requestBody)['data.point']).toBe("4.000|g")
it 'should send timers', ->
Bucky.send 'data.1', 5, 'timer'
Bucky.send 'data.2', 3, 'timer'
Bucky.flush()
body = JSON.parse server.requests[0].requestBody
... | CoffeeScript | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | df60a219ba8a5d3d6a92601f28128d05f552b1e9 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/df60a219ba8a5d3d6a92601f28128d05f552b1e9/spec/bucky.spec.coffee | 83 | 112 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:2:raw_corpus | raw_corpus | expect(utk(url)).toBe(res)
it 'should strip url hashes', ->
expect(utk('/test/abc#page')).toBe('test.abc')
expect(utk('http://app.hubspot.com/analyze/landing-pages/#range=custom&frequency=weekly&start=03&end=06events')).toBe('app.hubspot.analyze.landing-pages')
it 'should strip events', ->
expect(utk(... | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | fc0ce8ff207c517964aba7aa5a397e9cb76429e5 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/fc0ce8ff207c517964aba7aa5a397e9cb76429e5/spec/bucky.spec.coffee | 43 | 81 | ||
HubSpot/BuckyClient:spec/bucky.spec.coffee:2:completion | completion | expect(utk(url)).toBe(res)
it 'should strip url hashes', ->
expect(utk('/test/abc#page')).toBe('test.abc')
expect(utk('http://app.hubspot.com/analyze/landing-pages/#range=custom&frequency=weekly&start=03&end=06events')).toBe('app.hubspot.analyze.landing-pages')
it 'should strip events', ->
expect(utk(... | it 'should add the passed in root', ->
expect(utk('test/as', null, 'root')).toBe('root.test.as')
it 'should strip secure ids', ->
expect(utk('https://app.hubspot.com/contacts/53/lists/ajax/contact/_AO_T-mNtu9TBKIkc1lTfjBFOMBYFx1B4TzhLV6gYdIpsP-AUbHrAzFUQ7-M5bkRdvdYHQ5ro9LqVxmc4nzeNZ7D2V0aqoaQXCg/detail?inclu... | CoffeeScript | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | fc0ce8ff207c517964aba7aa5a397e9cb76429e5 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/fc0ce8ff207c517964aba7aa5a397e9cb76429e5/spec/bucky.spec.coffee | 43 | 81 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:3:raw_corpus | raw_corpus | it 'should strip hashes', ->
expect(utk('https://app.hubspot.com/analyze/53/api/pages/v3/pages/bd61568a93fc45637b8dceca1a34551b46627d26?errorsDismissed=1')).toBe('app.hubspot.analyze.api.pages.v3.pages')
expect(utk('https://app.hubspot.com/analyze/53/api/pages/v3/pages/098F6BCD4621D373CADE4E832627B4F6')).toBe('... | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | fc0ce8ff207c517964aba7aa5a397e9cb76429e5 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/fc0ce8ff207c517964aba7aa5a397e9cb76429e5/spec/bucky.spec.coffee | 83 | 122 | ||
HubSpot/BuckyClient:spec/bucky.spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should strip hashes', ->
expect(utk('https://app.hubspot.com/analyze/53/api/pages/v3/pages/bd61568a93fc45637b8dceca1a34551b46627d26?errorsDismissed=1')).toBe('app.hubspot.analyze.api.pages.v3.pages')
expect(utk('https://app.hubspot.com/analyze/53/api/... | it('should strip hashes', function() {
expect(utk('https://app.hubspot.com/analyze/53/api/pages/v3/pages/bd61568a93fc45637b8dceca1a34551b46627d26?errorsDismissed=1')).toBe('app.hubspot.analyze.api.pages.v3.pages');
return expect(utk('https://app.hubspot.com/analyze/53/api/pages/v3/pages/098F6BCD4621D373CADE4E832627... | CoffeeScript | JavaScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | fc0ce8ff207c517964aba7aa5a397e9cb76429e5 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/fc0ce8ff207c517964aba7aa5a397e9cb76429e5/spec/bucky.spec.coffee | 83 | 122 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should strip hashes', function() {
expect(utk('https://app.hubspot.com/analyze/53/api/pages/v3/pages/bd61568a93fc45637b8dceca1a34551b46627d26?errorsDismissed=1')).toBe('app.hubspot.analyze.api.pages.v3.pages');
return expect(utk('https://app.hubspot.com/ana... | it 'should strip hashes', ->
expect(utk('https://app.hubspot.com/analyze/53/api/pages/v3/pages/bd61568a93fc45637b8dceca1a34551b46627d26?errorsDismissed=1')).toBe('app.hubspot.analyze.api.pages.v3.pages')
expect(utk('https://app.hubspot.com/analyze/53/api/pages/v3/pages/098F6BCD4621D373CADE4E832627B4F6')).toBe('... | JavaScript | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | fc0ce8ff207c517964aba7aa5a397e9cb76429e5 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/fc0ce8ff207c517964aba7aa5a397e9cb76429e5/spec/bucky.spec.coffee | 83 | 122 |
HubSpot/BuckyClient:spec/bucky.spec.coffee:3:completion | completion | it 'should strip hashes', ->
expect(utk('https://app.hubspot.com/analyze/53/api/pages/v3/pages/bd61568a93fc45637b8dceca1a34551b46627d26?errorsDismissed=1')).toBe('app.hubspot.analyze.api.pages.v3.pages')
expect(utk('https://app.hubspot.com/analyze/53/api/pages/v3/pages/098F6BCD4621D373CADE4E832627B4F6')).toBe('... | window.BUCKY_DEPLOYED = true
afterEach ->
server.restore()
it 'should send a datapoint', ->
Bucky.send 'data.point', 4
Bucky.flush()
expect(server.requests.length).toBe(1)
expect(JSON.parse(server.requests[0].requestBody)['data.point']).toBe("4.000|g")
it 'should send timers', ->
Bucky... | CoffeeScript | CoffeeScript | HubSpot/BuckyClient | spec/bucky.spec.coffee | MIT | fc0ce8ff207c517964aba7aa5a397e9cb76429e5 | 1,725 | https://github.com/HubSpot/BuckyClient/blob/fc0ce8ff207c517964aba7aa5a397e9cb76429e5/spec/bucky.spec.coffee | 83 | 122 |
js2coffee/js2coffee:js2coffee.coffee:2:raw_corpus | raw_corpus | js2coffee.build = (source, options = {}) ->
options.filename ?= 'input.js'
options.indent ?= 2
options.source = source
ast = js2coffee.parseJS(source, options)
{ast, warnings} = js2coffee.transform(ast, options)
{code, map} = js2coffee.generate(ast, options)
{code, ast, map, warnings}
###*
# parseJS() :... | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/js2coffee.coffee | 37 | 56 | ||
js2coffee/js2coffee:js2coffee.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
js2coffee.build = (source, options = {}) ->
options.filename ?= 'input.js'
options.indent ?= 2
options.source = source
ast = js2coffee.parseJS(source, options)
{ast, warnings} = js2coffee.transform(ast, options)
{code, map} = js2coffee.generate(ast, ... | js2coffee.build = function(source, options = {}) {
var ast, code, map, warnings;
if (options.filename == null) {
options.filename = 'input.js';
}
if (options.indent == null) {
options.indent = 2;
}
options.source = source;
ast = js2coffee.parseJS(source, options);
({ast, warnings} = js2coffee.tr... | CoffeeScript | JavaScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/js2coffee.coffee | 37 | 56 |
js2coffee/js2coffee:js2coffee.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
js2coffee.build = function(source, options = {}) {
var ast, code, map, warnings;
if (options.filename == null) {
options.filename = 'input.js';
}
if (options.indent == null) {
options.indent = 2;
}
options.source = source;
ast = js2coffee.pars... | js2coffee.build = (source, options = {}) ->
options.filename ?= 'input.js'
options.indent ?= 2
options.source = source
ast = js2coffee.parseJS(source, options)
{ast, warnings} = js2coffee.transform(ast, options)
{code, map} = js2coffee.generate(ast, options)
{code, ast, map, warnings}
###*
# parseJS() :... | JavaScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/js2coffee.coffee | 37 | 56 |
js2coffee/js2coffee:js2coffee.coffee:4:raw_corpus | raw_corpus | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/js2coffee.coffee | 83 | 132 | ||
js2coffee/js2coffee:js2coffee.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require... | js2coffee.transform = function(ast, options = {}) {
var comments, ctx, run;
ctx = {};
run = function(classes) {
return TransformerBase.run(ast, options, classes, ctx);
};
comments = !(options.comments === false);
if (comments) {
// Injects comments into the AST as BlockComment and LineComment nodes.... | CoffeeScript | JavaScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/js2coffee.coffee | 83 | 132 |
js2coffee/js2coffee:js2coffee.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
js2coffee.transform = function(ast, options = {}) {
var comments, ctx, run;
ctx = {};
run = function(classes) {
return TransformerBase.run(ast, options, classes, ctx);
};
comments = !(options.comments === false);
if (comments) {
// Injects comme... | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | JavaScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/js2coffee.coffee | 83 | 132 |
js2coffee/js2coffee:js2coffee.coffee:4:completion | completion | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | require('./lib/transforms/empty_statements')
require('./lib/transforms/others')
require('./lib/transforms/precedence')
require('./lib/transforms/returns')
require('./lib/transforms/switches')
require('./lib/transforms/unsupported')
]
# Consolidate nested blocks -- block nesting can be a side ef... | CoffeeScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/js2coffee.coffee | 83 | 132 |
js2coffee/js2coffee:js2coffee.coffee:5:raw_corpus | raw_corpus | js2coffee.generate = (ast, options = {}) ->
new Builder(ast, options).get()
###*
# version : js2coffee.version
# The version number
###
js2coffee.version = require('./package.json').version | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/js2coffee.coffee | 134 | 142 | ||
js2coffee/js2coffee:js2coffee.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
js2coffee.generate = (ast, options = {}) ->
new Builder(ast, options).get()
###*
# version : js2coffee.version
# The version number
###
js2coffee.version = require('./package.json').version
``` | js2coffee.generate = function(ast, options = {}) {
return new Builder(ast, options).get();
};
/**
* version : js2coffee.version
* The version number
*/
js2coffee.version = require('./package.json').version; | CoffeeScript | JavaScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/js2coffee.coffee | 134 | 142 |
js2coffee/js2coffee:js2coffee.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
js2coffee.generate = function(ast, options = {}) {
return new Builder(ast, options).get();
};
/**
* version : js2coffee.version
* The version number
*/
js2coffee.version = require('./package.json').version;
``` | js2coffee.generate = (ast, options = {}) ->
new Builder(ast, options).get()
###*
# version : js2coffee.version
# The version number
###
js2coffee.version = require('./package.json').version | JavaScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/js2coffee.coffee | 134 | 142 |
js2coffee/js2coffee:js2coffee.coffee:5:completion | completion | js2coffee.generate = (ast, options = {}) ->
new Builder(ast, options).get()
###* | # version : js2coffee.version
# The version number
###
js2coffee.version = require('./package.json').version | CoffeeScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/js2coffee.coffee | 134 | 142 |
js2coffee/js2coffee:js2coffee.coffee:2:raw_corpus | raw_corpus | js2coffee.build = (source, options = {}) ->
options.filename ?= 'input.js'
options.source = source
ast = js2coffee.parseJS(source, options)
{ast, warnings} = js2coffee.transform(ast, options)
{code, map} = js2coffee.generate(ast, options)
{code, ast, map, warnings}
###*
# parseJS() : js2coffee.parseJS(sou... | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | f9cd0cdf01624264b84c7ea03cc41813226fbd70 | 2,082 | https://github.com/js2coffee/js2coffee/blob/f9cd0cdf01624264b84c7ea03cc41813226fbd70/js2coffee.coffee | 37 | 55 | ||
js2coffee/js2coffee:js2coffee.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
js2coffee.build = (source, options = {}) ->
options.filename ?= 'input.js'
options.source = source
ast = js2coffee.parseJS(source, options)
{ast, warnings} = js2coffee.transform(ast, options)
{code, map} = js2coffee.generate(ast, options)
{code, ast,... | js2coffee.build = function(source, options = {}) {
var ast, code, map, warnings;
if (options.filename == null) {
options.filename = 'input.js';
}
options.source = source;
ast = js2coffee.parseJS(source, options);
({ast, warnings} = js2coffee.transform(ast, options));
({code, map} = js2coffee.generate(... | CoffeeScript | JavaScript | js2coffee/js2coffee | js2coffee.coffee | MIT | f9cd0cdf01624264b84c7ea03cc41813226fbd70 | 2,082 | https://github.com/js2coffee/js2coffee/blob/f9cd0cdf01624264b84c7ea03cc41813226fbd70/js2coffee.coffee | 37 | 55 |
js2coffee/js2coffee:js2coffee.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
js2coffee.build = function(source, options = {}) {
var ast, code, map, warnings;
if (options.filename == null) {
options.filename = 'input.js';
}
options.source = source;
ast = js2coffee.parseJS(source, options);
({ast, warnings} = js2coffee.transfo... | js2coffee.build = (source, options = {}) ->
options.filename ?= 'input.js'
options.source = source
ast = js2coffee.parseJS(source, options)
{ast, warnings} = js2coffee.transform(ast, options)
{code, map} = js2coffee.generate(ast, options)
{code, ast, map, warnings}
###*
# parseJS() : js2coffee.parseJS(sou... | JavaScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | f9cd0cdf01624264b84c7ea03cc41813226fbd70 | 2,082 | https://github.com/js2coffee/js2coffee/blob/f9cd0cdf01624264b84c7ea03cc41813226fbd70/js2coffee.coffee | 37 | 55 |
js2coffee/js2coffee:js2coffee.coffee:4:raw_corpus | raw_corpus | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | fdc619624224f7e7116509784cb993bbf72b50d2 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fdc619624224f7e7116509784cb993bbf72b50d2/js2coffee.coffee | 82 | 130 | ||
js2coffee/js2coffee:js2coffee.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require... | js2coffee.transform = function(ast, options = {}) {
var comments, ctx, run;
ctx = {};
run = function(classes) {
return TransformerBase.run(ast, options, classes, ctx);
};
comments = !(options.comments === false);
if (comments) {
// Injects comments into the AST as BlockComment and LineComment nodes.... | CoffeeScript | JavaScript | js2coffee/js2coffee | js2coffee.coffee | MIT | fdc619624224f7e7116509784cb993bbf72b50d2 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fdc619624224f7e7116509784cb993bbf72b50d2/js2coffee.coffee | 82 | 130 |
js2coffee/js2coffee:js2coffee.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
js2coffee.transform = function(ast, options = {}) {
var comments, ctx, run;
ctx = {};
run = function(classes) {
return TransformerBase.run(ast, options, classes, ctx);
};
comments = !(options.comments === false);
if (comments) {
// Injects comme... | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | JavaScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | fdc619624224f7e7116509784cb993bbf72b50d2 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fdc619624224f7e7116509784cb993bbf72b50d2/js2coffee.coffee | 82 | 130 |
js2coffee/js2coffee:js2coffee.coffee:4:completion | completion | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | require('./lib/transforms/binary')
require('./lib/transforms/empty_statements')
require('./lib/transforms/others')
require('./lib/transforms/precedence')
require('./lib/transforms/returns')
require('./lib/transforms/switches')
]
# Consolidate nested blocks -- block nesting can be a side effect ... | CoffeeScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | fdc619624224f7e7116509784cb993bbf72b50d2 | 2,082 | https://github.com/js2coffee/js2coffee/blob/fdc619624224f7e7116509784cb993bbf72b50d2/js2coffee.coffee | 82 | 130 |
js2coffee/js2coffee:js2coffee.coffee:4:raw_corpus | raw_corpus | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | eb538dbd6163a3c74fc056afb160bd7616cd70c6 | 2,082 | https://github.com/js2coffee/js2coffee/blob/eb538dbd6163a3c74fc056afb160bd7616cd70c6/js2coffee.coffee | 82 | 129 | ||
js2coffee/js2coffee:js2coffee.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require... | js2coffee.transform = function(ast, options = {}) {
var comments, ctx, run;
ctx = {};
run = function(classes) {
return TransformerBase.run(ast, options, classes, ctx);
};
comments = !(options.comments === false);
if (comments) {
// Injects comments into the AST as BlockComment and LineComment nodes.... | CoffeeScript | JavaScript | js2coffee/js2coffee | js2coffee.coffee | MIT | eb538dbd6163a3c74fc056afb160bd7616cd70c6 | 2,082 | https://github.com/js2coffee/js2coffee/blob/eb538dbd6163a3c74fc056afb160bd7616cd70c6/js2coffee.coffee | 82 | 129 |
js2coffee/js2coffee:js2coffee.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
js2coffee.transform = function(ast, options = {}) {
var comments, ctx, run;
ctx = {};
run = function(classes) {
return TransformerBase.run(ast, options, classes, ctx);
};
comments = !(options.comments === false);
if (comments) {
// Injects comme... | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | JavaScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | eb538dbd6163a3c74fc056afb160bd7616cd70c6 | 2,082 | https://github.com/js2coffee/js2coffee/blob/eb538dbd6163a3c74fc056afb160bd7616cd70c6/js2coffee.coffee | 82 | 129 |
js2coffee/js2coffee:js2coffee.coffee:4:completion | completion | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | require('./lib/transforms/binary')
require('./lib/transforms/others')
require('./lib/transforms/precedence')
require('./lib/transforms/returns')
require('./lib/transforms/switches')
]
# Consolidate nested blocks -- block nesting can be a side effect of the
# transformations above
run [
requ... | CoffeeScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | eb538dbd6163a3c74fc056afb160bd7616cd70c6 | 2,082 | https://github.com/js2coffee/js2coffee/blob/eb538dbd6163a3c74fc056afb160bd7616cd70c6/js2coffee.coffee | 82 | 129 |
js2coffee/js2coffee:js2coffee.coffee:4:raw_corpus | raw_corpus | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | ae726c173a029ee98e66e46096e394c51ad9dd39 | 2,082 | https://github.com/js2coffee/js2coffee/blob/ae726c173a029ee98e66e46096e394c51ad9dd39/js2coffee.coffee | 82 | 128 | ||
js2coffee/js2coffee:js2coffee.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require... | js2coffee.transform = function(ast, options = {}) {
var comments, ctx, run;
ctx = {};
run = function(classes) {
return TransformerBase.run(ast, options, classes, ctx);
};
comments = !(options.comments === false);
if (comments) {
// Injects comments into the AST as BlockComment and LineComment nodes.... | CoffeeScript | JavaScript | js2coffee/js2coffee | js2coffee.coffee | MIT | ae726c173a029ee98e66e46096e394c51ad9dd39 | 2,082 | https://github.com/js2coffee/js2coffee/blob/ae726c173a029ee98e66e46096e394c51ad9dd39/js2coffee.coffee | 82 | 128 |
js2coffee/js2coffee:js2coffee.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
js2coffee.transform = function(ast, options = {}) {
var comments, ctx, run;
ctx = {};
run = function(classes) {
return TransformerBase.run(ast, options, classes, ctx);
};
comments = !(options.comments === false);
if (comments) {
// Injects comme... | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | JavaScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | ae726c173a029ee98e66e46096e394c51ad9dd39 | 2,082 | https://github.com/js2coffee/js2coffee/blob/ae726c173a029ee98e66e46096e394c51ad9dd39/js2coffee.coffee | 82 | 128 |
js2coffee/js2coffee:js2coffee.coffee:4:completion | completion | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | require('./lib/transforms/objects')
require('./lib/transforms/others')
require('./lib/transforms/precedence')
require('./lib/transforms/returns')
require('./lib/transforms/switches')
]
# Consolidate nested blocks -- block nesting can be a side effect of the
# transformations above
run [
req... | CoffeeScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | ae726c173a029ee98e66e46096e394c51ad9dd39 | 2,082 | https://github.com/js2coffee/js2coffee/blob/ae726c173a029ee98e66e46096e394c51ad9dd39/js2coffee.coffee | 82 | 128 |
js2coffee/js2coffee:js2coffee.coffee:4:raw_corpus | raw_corpus | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 34fdfb395490e62c2be1660204440e5319835e5d | 2,082 | https://github.com/js2coffee/js2coffee/blob/34fdfb395490e62c2be1660204440e5319835e5d/js2coffee.coffee | 82 | 127 | ||
js2coffee/js2coffee:js2coffee.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require... | js2coffee.transform = function(ast, options = {}) {
var comments, ctx, run;
ctx = {};
run = function(classes) {
return TransformerBase.run(ast, options, classes, ctx);
};
comments = !(options.comments === false);
if (comments) {
// Injects comments into the AST as BlockComment and LineComment nodes.... | CoffeeScript | JavaScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 34fdfb395490e62c2be1660204440e5319835e5d | 2,082 | https://github.com/js2coffee/js2coffee/blob/34fdfb395490e62c2be1660204440e5319835e5d/js2coffee.coffee | 82 | 127 |
js2coffee/js2coffee:js2coffee.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
js2coffee.transform = function(ast, options = {}) {
var comments, ctx, run;
ctx = {};
run = function(classes) {
return TransformerBase.run(ast, options, classes, ctx);
};
comments = !(options.comments === false);
if (comments) {
// Injects comme... | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | JavaScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 34fdfb395490e62c2be1660204440e5319835e5d | 2,082 | https://github.com/js2coffee/js2coffee/blob/34fdfb395490e62c2be1660204440e5319835e5d/js2coffee.coffee | 82 | 127 |
js2coffee/js2coffee:js2coffee.coffee:4:completion | completion | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | require('./lib/transforms/others')
require('./lib/transforms/precedence')
require('./lib/transforms/returns')
require('./lib/transforms/switches')
]
# Consolidate nested blocks -- block nesting can be a side effect of the
# transformations above
run [
require('./lib/transforms/blocks')
]
{... | CoffeeScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 34fdfb395490e62c2be1660204440e5319835e5d | 2,082 | https://github.com/js2coffee/js2coffee/blob/34fdfb395490e62c2be1660204440e5319835e5d/js2coffee.coffee | 82 | 127 |
js2coffee/js2coffee:js2coffee.coffee:4:raw_corpus | raw_corpus | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 72e89689822683b9d5a930e6b7ef02186fdb56cf | 2,082 | https://github.com/js2coffee/js2coffee/blob/72e89689822683b9d5a930e6b7ef02186fdb56cf/js2coffee.coffee | 82 | 126 | ||
js2coffee/js2coffee:js2coffee.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require... | js2coffee.transform = function(ast, options = {}) {
var comments, ctx, run;
ctx = {};
run = function(classes) {
return TransformerBase.run(ast, options, classes, ctx);
};
comments = !(options.comments === false);
if (comments) {
// Injects comments into the AST as BlockComment and LineComment nodes.... | CoffeeScript | JavaScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 72e89689822683b9d5a930e6b7ef02186fdb56cf | 2,082 | https://github.com/js2coffee/js2coffee/blob/72e89689822683b9d5a930e6b7ef02186fdb56cf/js2coffee.coffee | 82 | 126 |
js2coffee/js2coffee:js2coffee.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
js2coffee.transform = function(ast, options = {}) {
var comments, ctx, run;
ctx = {};
run = function(classes) {
return TransformerBase.run(ast, options, classes, ctx);
};
comments = !(options.comments === false);
if (comments) {
// Injects comme... | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | JavaScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 72e89689822683b9d5a930e6b7ef02186fdb56cf | 2,082 | https://github.com/js2coffee/js2coffee/blob/72e89689822683b9d5a930e6b7ef02186fdb56cf/js2coffee.coffee | 82 | 126 |
js2coffee/js2coffee:js2coffee.coffee:4:completion | completion | js2coffee.transform = (ast, options = {}) ->
ctx = {}
run = (classes) -> TransformerBase.run(ast, options, classes, ctx)
comments = not (options.comments is false)
# Injects comments into the AST as BlockComment and LineComment nodes.
run [
require('./lib/transforms/comments')
] if comments
# Moves ... | require('./lib/transforms/others')
require('./lib/transforms/precedence')
require('./lib/transforms/returns')
require('./lib/transforms/switches')
]
# Consolidate nested blocks -- block nesting can be a side effect of the
# transformations above
run [
require('./lib/transforms/blocks')
]
{... | CoffeeScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | 72e89689822683b9d5a930e6b7ef02186fdb56cf | 2,082 | https://github.com/js2coffee/js2coffee/blob/72e89689822683b9d5a930e6b7ef02186fdb56cf/js2coffee.coffee | 82 | 126 |
js2coffee/js2coffee:js2coffee.coffee:3:raw_corpus | raw_corpus | js2coffee.parseJS = (source, options = {}) ->
try
Esprima = require('esprima-harmony')
Esprima.parse(source, loc: true, range: true, comment: true)
catch err
throw buildError(err, source, options.filename)
###*
# transform() : js2coffee.transform(ast, [options])
# Mutates a given JavaScript syntax tree... | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | c0b64d529719317673247ada2e6aaab001618367 | 2,082 | https://github.com/js2coffee/js2coffee/blob/c0b64d529719317673247ada2e6aaab001618367/js2coffee.coffee | 57 | 76 | ||
js2coffee/js2coffee:js2coffee.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
js2coffee.parseJS = (source, options = {}) ->
try
Esprima = require('esprima-harmony')
Esprima.parse(source, loc: true, range: true, comment: true)
catch err
throw buildError(err, source, options.filename)
###*
# transform() : js2coffee.transform... | js2coffee.parseJS = function(source, options = {}) {
var Esprima, err;
try {
Esprima = require('esprima-harmony');
return Esprima.parse(source, {
loc: true,
range: true,
comment: true
});
} catch (error) {
err = error;
throw buildError(err, source, options.filename);
}
};
... | CoffeeScript | JavaScript | js2coffee/js2coffee | js2coffee.coffee | MIT | c0b64d529719317673247ada2e6aaab001618367 | 2,082 | https://github.com/js2coffee/js2coffee/blob/c0b64d529719317673247ada2e6aaab001618367/js2coffee.coffee | 57 | 76 |
js2coffee/js2coffee:js2coffee.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
js2coffee.parseJS = function(source, options = {}) {
var Esprima, err;
try {
Esprima = require('esprima-harmony');
return Esprima.parse(source, {
loc: true,
range: true,
comment: true
});
} catch (error) {
err = error;
th... | js2coffee.parseJS = (source, options = {}) ->
try
Esprima = require('esprima-harmony')
Esprima.parse(source, loc: true, range: true, comment: true)
catch err
throw buildError(err, source, options.filename)
###*
# transform() : js2coffee.transform(ast, [options])
# Mutates a given JavaScript syntax tree... | JavaScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | c0b64d529719317673247ada2e6aaab001618367 | 2,082 | https://github.com/js2coffee/js2coffee/blob/c0b64d529719317673247ada2e6aaab001618367/js2coffee.coffee | 57 | 76 |
js2coffee/js2coffee:js2coffee.coffee:4:raw_corpus | raw_corpus | js2coffee.transform = (ast, options = {}) ->
ctx = {}
# Note that these transformations will need to be done in a few steps.
# The earlier steps (function, comment, etc) will make drastic modifications
# to the tree that the other transformations will need to pick up.
run = (classes) ->
TransformerBase.r... | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | c0b64d529719317673247ada2e6aaab001618367 | 2,082 | https://github.com/js2coffee/js2coffee/blob/c0b64d529719317673247ada2e6aaab001618367/js2coffee.coffee | 78 | 127 | ||
js2coffee/js2coffee:js2coffee.coffee:4:completion | completion | js2coffee.transform = (ast, options = {}) ->
ctx = {}
# Note that these transformations will need to be done in a few steps.
# The earlier steps (function, comment, etc) will make drastic modifications
# to the tree that the other transformations will need to pick up.
run = (classes) ->
TransformerBase.r... | require('./lib/transforms/loops')
require('./lib/transforms/members')
require('./lib/transforms/objects')
require('./lib/transforms/others')
require('./lib/transforms/precedence')
require('./lib/transforms/returns')
require('./lib/transforms/switches')
]
# Consolidate nested blocks -- block... | CoffeeScript | CoffeeScript | js2coffee/js2coffee | js2coffee.coffee | MIT | c0b64d529719317673247ada2e6aaab001618367 | 2,082 | https://github.com/js2coffee/js2coffee/blob/c0b64d529719317673247ada2e6aaab001618367/js2coffee.coffee | 78 | 127 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.