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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jeremyramin/terminal-plus:lib/process.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var execSync, pty;
pty = require('pty.js');
({execSync} = require('child_process'));
module.exports = function(ptyCwd, sh, args) {
var callback, cmd, cols, env, path, ptyProcess, rows, shell;
callback = this.async();
if (sh) {
shell = sh;
} else {
... | pty = require 'pty.js'
{execSync} = require 'child_process'
module.exports = (ptyCwd, sh, args) ->
callback = @async()
if sh
shell = sh
else
if process.platform is 'win32'
path = require 'path'
shell = path.resolve(process.env.SystemRoot, 'WindowsPowerShell', 'v1.0', 'powershell.exe')
els... | JavaScript | CoffeeScript | jeremyramin/terminal-plus | lib/process.coffee | MIT | e9dfeb4ceb8aad183da5d3f64394f275ab17cdee | 478 | https://github.com/jeremyramin/terminal-plus/blob/e9dfeb4ceb8aad183da5d3f64394f275ab17cdee/lib/process.coffee | 1 | 36 |
jeremyramin/terminal-plus:lib/process.coffee:1:completion | completion | pty = require 'pty.js'
{execSync} = require 'child_process'
module.exports = (ptyCwd, sh, args) ->
callback = @async()
if sh
shell = sh
else
if process.platform is 'win32'
path = require 'path'
shell = path.resolve(process.env.SystemRoot, 'WindowsPowerShell', 'v1.0', 'powershell.exe')
els... | env = JSON.parse execSync cmd
ptyProcess = pty.fork shell, args,
name: 'xterm-256color'
cols: cols
rows: rows
cwd: ptyCwd
env: env
ptyProcess.on 'data', (data) -> emit('terminal-plus:data', data)
ptyProcess.on 'exit', ->
emit('terminal-plus:exit')
callback()
process.on 'message', ... | CoffeeScript | CoffeeScript | jeremyramin/terminal-plus | lib/process.coffee | MIT | e9dfeb4ceb8aad183da5d3f64394f275ab17cdee | 478 | https://github.com/jeremyramin/terminal-plus/blob/e9dfeb4ceb8aad183da5d3f64394f275ab17cdee/lib/process.coffee | 1 | 36 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/embedded.coffee:1:raw_corpus | raw_corpus | hi: `function() {
return [document.title, "Hello JavaScript"].join(": ");
}` | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/documentation/coffee/embedded.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/embedded.coffee | 1 | 3 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/embedded.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
hi: `function() {
return [document.title, "Hello JavaScript"].join(": ");
}`
``` | ({
hi: function() {
return [document.title, "Hello JavaScript"].join(": ");
}
}); | CoffeeScript | JavaScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/documentation/coffee/embedded.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/embedded.coffee | 1 | 3 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/embedded.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
hi: function() {
return [document.title, "Hello JavaScript"].join(": ");
}
});
``` | hi: `function() {
return [document.title, "Hello JavaScript"].join(": ");
}` | JavaScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/documentation/coffee/embedded.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/embedded.coffee | 1 | 3 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/classes.coffee:1:raw_corpus | raw_corpus | class Animal
move: (meters) ->
alert @name + " moved " + meters + "m."
class Snake extends Animal
constructor: (name) ->
@name: name
move: ->
alert "Slithering..."
super 5
class Horse extends Animal
constructor: (name) ->
@name: name
move: ->
alert "Galloping..."
super 45
sam:... | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/documentation/coffee/classes.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/classes.coffee | 1 | 25 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/classes.coffee:1:completion | completion | class Animal
move: (meters) ->
alert @name + " moved " + meters + "m."
class Snake extends Animal
constructor: (name) ->
@name: name
move: ->
alert "Slithering..."
super 5 | class Horse extends Animal
constructor: (name) ->
@name: name
move: ->
alert "Galloping..."
super 45
sam: new Snake "Sammy the Python"
tom: new Horse "Tommy the Palomino"
sam.move()
tom.move() | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/documentation/coffee/classes.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/classes.coffee | 1 | 25 |
jianliaoim/talk-os:talk-web/client/dispatcher.coffee:1:raw_corpus | raw_corpus | EventEmitter = require 'wolfy87-eventemitter'
recorder = require 'actions-recorder'
Immutable = require 'immutable'
dev = require './util/dev'
module.exports = emitter = new EventEmitter
emitter.handleServerAction = (action) ->
action.source = 'server'
emitter.emit 'action', action
# dev.info action
recorder.... | CoffeeScript | jianliaoim/talk-os | talk-web/client/dispatcher.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/dispatcher.coffee | 1 | 18 | ||
jianliaoim/talk-os:talk-web/client/dispatcher.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
EventEmitter = require 'wolfy87-eventemitter'
recorder = require 'actions-recorder'
Immutable = require 'immutable'
dev = require './util/dev'
module.exports = emitter = new EventEmitter
emitter.handleServerAction = (action) ->
action.source = 'server'
emit... | var EventEmitter, Immutable, dev, emitter, recorder;
EventEmitter = require('wolfy87-eventemitter');
recorder = require('actions-recorder');
Immutable = require('immutable');
dev = require('./util/dev');
module.exports = emitter = new EventEmitter();
emitter.handleServerAction = function(action) {
action.source... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/dispatcher.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/dispatcher.coffee | 1 | 18 |
jianliaoim/talk-os:talk-web/client/dispatcher.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var EventEmitter, Immutable, dev, emitter, recorder;
EventEmitter = require('wolfy87-eventemitter');
recorder = require('actions-recorder');
Immutable = require('immutable');
dev = require('./util/dev');
module.exports = emitter = new EventEmitter();
emitter.... | EventEmitter = require 'wolfy87-eventemitter'
recorder = require 'actions-recorder'
Immutable = require 'immutable'
dev = require './util/dev'
module.exports = emitter = new EventEmitter
emitter.handleServerAction = (action) ->
action.source = 'server'
emitter.emit 'action', action
# dev.info action
recorder.... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/dispatcher.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/dispatcher.coffee | 1 | 18 |
jianliaoim/talk-os:talk-web/client/dispatcher.coffee:1:completion | completion | EventEmitter = require 'wolfy87-eventemitter'
recorder = require 'actions-recorder'
Immutable = require 'immutable'
dev = require './util/dev'
module.exports = emitter = new EventEmitter
emitter.handleServerAction = (action) ->
action.source = 'server' | emitter.emit 'action', action
# dev.info action
recorder.dispatch action.type, action.data
emitter.handleViewAction = (action) ->
action.source = 'view'
emitter.emit 'action', action
# dev.info action
recorder.dispatch action.type, action.data | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/dispatcher.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/dispatcher.coffee | 1 | 18 |
jianliaoim/talk-os:talk-web/client/module/room-name.coffee:1:raw_corpus | raw_corpus | cx = require 'classnames'
React = require 'react'
lang = require '../locales/lang'
PureRenderMixin = require 'react-addons-pure-render-mixin'
{ span } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'room-name'
mixins: [ PureRenderMixin ]
propTypes:
name: T.string.isRequire... | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/room-name.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/room-name.coffee | 1 | 23 | ||
jianliaoim/talk-os:talk-web/client/module/room-name.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
cx = require 'classnames'
React = require 'react'
lang = require '../locales/lang'
PureRenderMixin = require 'react-addons-pure-render-mixin'
{ span } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'room-name'
mixins: [ Pur... | var PureRenderMixin, React, T, cx, lang, span;
cx = require('classnames');
React = require('react');
lang = require('../locales/lang');
PureRenderMixin = require('react-addons-pure-render-mixin');
({span} = React.DOM);
T = React.PropTypes;
module.exports = React.createClass({
displayName: 'room-name',
mixins... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/module/room-name.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/room-name.coffee | 1 | 23 |
jianliaoim/talk-os:talk-web/client/module/room-name.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PureRenderMixin, React, T, cx, lang, span;
cx = require('classnames');
React = require('react');
lang = require('../locales/lang');
PureRenderMixin = require('react-addons-pure-render-mixin');
({span} = React.DOM);
T = React.PropTypes;
module.exports = R... | cx = require 'classnames'
React = require 'react'
lang = require '../locales/lang'
PureRenderMixin = require 'react-addons-pure-render-mixin'
{ span } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'room-name'
mixins: [ PureRenderMixin ]
propTypes:
name: T.string.isRequire... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/room-name.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/room-name.coffee | 1 | 23 |
jianliaoim/talk-os:talk-web/client/module/room-name.coffee:1:completion | completion | cx = require 'classnames'
React = require 'react'
lang = require '../locales/lang'
PureRenderMixin = require 'react-addons-pure-render-mixin'
{ span } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'room-name' | mixins: [ PureRenderMixin ]
propTypes:
name: T.string.isRequired
className: T.string
render: ->
name = @props.name
if name is 'general'
name = lang.getText 'room-general'
span className: cx(@props.className), name | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/room-name.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/room-name.coffee | 1 | 23 |
jianliaoim/talk-os:talk-api2x/server/mailers/room-message.coffee:1:raw_corpus | raw_corpus | class RoomMessageMailer extends BaseMailer
delay: 30 * 60 * 1000
template: 'room-message'
send: (_userId, _roomId, _teamId) ->
_roomId = _roomId._id if _roomId instanceof RoomModel
email = id: _userId + _roomId + _teamId
self = this
$preference = PreferenceModel.findOneAsync _id: _userId, 'emai... | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/mailers/room-message.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/room-message.coffee | 19 | 68 | ||
jianliaoim/talk-os:talk-api2x/server/mailers/room-message.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class RoomMessageMailer extends BaseMailer
delay: 30 * 60 * 1000
template: 'room-message'
send: (_userId, _roomId, _teamId) ->
_roomId = _roomId._id if _roomId instanceof RoomModel
email = id: _userId + _roomId + _teamId
self = this
$pref... | var RoomMessageMailer;
RoomMessageMailer = (function() {
class RoomMessageMailer extends BaseMailer {
send(_userId, _roomId, _teamId) {
var $notification, $preference, $room, $user, email, self;
if (_roomId instanceof RoomModel) {
_roomId = _roomId._id;
}
email = {
id: _us... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/server/mailers/room-message.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/room-message.coffee | 19 | 68 |
jianliaoim/talk-os:talk-api2x/server/mailers/room-message.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var RoomMessageMailer;
RoomMessageMailer = (function() {
class RoomMessageMailer extends BaseMailer {
send(_userId, _roomId, _teamId) {
var $notification, $preference, $room, $user, email, self;
if (_roomId instanceof RoomModel) {
_roomId... | class RoomMessageMailer extends BaseMailer
delay: 30 * 60 * 1000
template: 'room-message'
send: (_userId, _roomId, _teamId) ->
_roomId = _roomId._id if _roomId instanceof RoomModel
email = id: _userId + _roomId + _teamId
self = this
$preference = PreferenceModel.findOneAsync _id: _userId, 'emai... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/mailers/room-message.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/room-message.coffee | 19 | 68 |
jianliaoim/talk-os:talk-api2x/server/mailers/room-message.coffee:1:completion | completion | class RoomMessageMailer extends BaseMailer
delay: 30 * 60 * 1000
template: 'room-message'
send: (_userId, _roomId, _teamId) ->
_roomId = _roomId._id if _roomId instanceof RoomModel
email = id: _userId + _roomId + _teamId
self = this
$preference = PreferenceModel.findOneAsync _id: _userId, 'emai... | Promise.all [$preference, $room, $user, $notification]
.spread (preference, room, user, notification) ->
return if preference?.emailNotification is false
return unless room
return unless user?.isRobot or user?.email
return unless notification?.unreadNum > 0
room.topic = '公告板' if roo... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/mailers/room-message.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/room-message.coffee | 19 | 68 |
jianliaoim/talk-os:talk-api2x/server/mailers/room-message.coffee:2:raw_corpus | raw_corpus | limit: limit
MessageModel.findMessagesFromRoomAsync _roomId, options
# Construct messages
.then (messages) ->
return unless messages?.length
messages.sort (x, y) -> if x._id > y._id then 1 else -1
messages = messages.map (message) ->
message.alert = i18n.replace message.getAlert... | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/mailers/room-message.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/room-message.coffee | 69 | 92 | ||
jianliaoim/talk-os:talk-api2x/server/mailers/room-message.coffee:2:completion | completion | limit: limit
MessageModel.findMessagesFromRoomAsync _roomId, options
# Construct messages
.then (messages) ->
return unless messages?.length
messages.sort (x, y) -> if x._id > y._id then 1 else -1
messages = messages.map (message) ->
message.alert = i18n.replace message.getAlert... | if email.user.isGuest
email.clickUrl = email.room.guestUrl
else
email.clickUrl = util.buildTeamUrl messages[0].team, _roomId
email.subject = "[简聊] 来自#{email.room?.topic}的新消息"
self._sendByRender email
.catch (err) -> logger.warn err.stack
cancel: (_userId, _roomId, _teamId) ->
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/mailers/room-message.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/room-message.coffee | 69 | 92 |
jianliaoim/talk-os:talk-account/client/app/brand.coffee:1:raw_corpus | raw_corpus | React = require 'react'
Immutable = require 'immutable'
{div} = React.DOM
module.exports = React.createClass
displayName: 'app-brand'
propTypes:
language: React.PropTypes.string.isRequired
render: ->
div className: "app-brand is-#{@props.language}" | CoffeeScript | jianliaoim/talk-os | talk-account/client/app/brand.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/brand.coffee | 1 | 14 | ||
jianliaoim/talk-os:talk-account/client/app/brand.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
React = require 'react'
Immutable = require 'immutable'
{div} = React.DOM
module.exports = React.createClass
displayName: 'app-brand'
propTypes:
language: React.PropTypes.string.isRequired
render: ->
div className: "app-brand is-#{@props.langua... | var Immutable, React, div;
React = require('react');
Immutable = require('immutable');
({div} = React.DOM);
module.exports = React.createClass({
displayName: 'app-brand',
propTypes: {
language: React.PropTypes.string.isRequired
},
render: function() {
return div({
className: `app-brand is-${th... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/client/app/brand.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/brand.coffee | 1 | 14 |
jianliaoim/talk-os:talk-account/client/app/brand.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Immutable, React, div;
React = require('react');
Immutable = require('immutable');
({div} = React.DOM);
module.exports = React.createClass({
displayName: 'app-brand',
propTypes: {
language: React.PropTypes.string.isRequired
},
render: function()... | React = require 'react'
Immutable = require 'immutable'
{div} = React.DOM
module.exports = React.createClass
displayName: 'app-brand'
propTypes:
language: React.PropTypes.string.isRequired
render: ->
div className: "app-brand is-#{@props.language}" | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/client/app/brand.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/brand.coffee | 1 | 14 |
jianliaoim/talk-os:talk-account/client/app/brand.coffee:1:completion | completion | React = require 'react'
Immutable = require 'immutable'
{div} = React.DOM
module.exports = React.createClass
displayName: 'app-brand' | propTypes:
language: React.PropTypes.string.isRequired
render: ->
div className: "app-brand is-#{@props.language}" | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/client/app/brand.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/brand.coffee | 1 | 14 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:1:raw_corpus | raw_corpus | zeropad = (columns, num) ->
num += ''
while num.length < columns
num = '0' + num
num
api =
LEVEL_DEBUG: 0
LEVEL_INFO: 1
LEVEL_WARN: 2
LEVEL_ERROR: 3
LEVEL_FATAL: 4
LEVEL_OFF: 5
enableTag: (tag) ->
activeTags[tag] = true
disableTag: (tag) ->
delete activeTags[tag]
print: (str, raw... | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 7c2256a1a95a8332acdd153c2e82a9cfe5d3a180 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7c2256a1a95a8332acdd153c2e82a9cfe5d3a180/logger.coffee | 28 | 77 | ||
iizukanao/node-rtsp-rtmp-server:logger.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
zeropad = (columns, num) ->
num += ''
while num.length < columns
num = '0' + num
num
api =
LEVEL_DEBUG: 0
LEVEL_INFO: 1
LEVEL_WARN: 2
LEVEL_ERROR: 3
LEVEL_FATAL: 4
LEVEL_OFF: 5
enableTag: (tag) ->
activeTags[tag] = true
disableTag... | var api, zeropad;
zeropad = function(columns, num) {
num += '';
while (num.length < columns) {
num = '0' + num;
}
return num;
};
api = {
LEVEL_DEBUG: 0,
LEVEL_INFO: 1,
LEVEL_WARN: 2,
LEVEL_ERROR: 3,
LEVEL_FATAL: 4,
LEVEL_OFF: 5,
enableTag: function(tag) {
return activeTags[tag] = true;
... | CoffeeScript | JavaScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 7c2256a1a95a8332acdd153c2e82a9cfe5d3a180 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7c2256a1a95a8332acdd153c2e82a9cfe5d3a180/logger.coffee | 28 | 77 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var api, zeropad;
zeropad = function(columns, num) {
num += '';
while (num.length < columns) {
num = '0' + num;
}
return num;
};
api = {
LEVEL_DEBUG: 0,
LEVEL_INFO: 1,
LEVEL_WARN: 2,
LEVEL_ERROR: 3,
LEVEL_FATAL: 4,
LEVEL_OFF: 5,
enableTa... | zeropad = (columns, num) ->
num += ''
while num.length < columns
num = '0' + num
num
api =
LEVEL_DEBUG: 0
LEVEL_INFO: 1
LEVEL_WARN: 2
LEVEL_ERROR: 3
LEVEL_FATAL: 4
LEVEL_OFF: 5
enableTag: (tag) ->
activeTags[tag] = true
disableTag: (tag) ->
delete activeTags[tag]
print: (str, raw... | JavaScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 7c2256a1a95a8332acdd153c2e82a9cfe5d3a180 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7c2256a1a95a8332acdd153c2e82a9cfe5d3a180/logger.coffee | 28 | 77 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:1:completion | completion | zeropad = (columns, num) ->
num += ''
while num.length < columns
num = '0' + num
num
api =
LEVEL_DEBUG: 0
LEVEL_INFO: 1
LEVEL_WARN: 2
LEVEL_ERROR: 3
LEVEL_FATAL: 4
LEVEL_OFF: 5
enableTag: (tag) ->
activeTags[tag] = true
disableTag: (tag) ->
delete activeTags[tag]
print: (str, raw... | "#{zeropad 2, d.getDate()} #{zeropad 2, d.getHours()}:" +
"#{zeropad 2, d.getMinutes()}:#{zeropad 2, d.getSeconds()}." +
"#{zeropad 3, d.getMilliseconds()} "
console.log str
tag: (tag, str, raw=false) ->
if activeTags[tag]?
api.print str, raw
msg: (level, str, raw=false) ->
if le... | CoffeeScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 7c2256a1a95a8332acdd153c2e82a9cfe5d3a180 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7c2256a1a95a8332acdd153c2e82a9cfe5d3a180/logger.coffee | 28 | 77 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:raw_corpus | raw_corpus | info: (str, raw=false) ->
api.msg api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.msg api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
api.msg api.LEVEL_ERROR, str, raw
fatal: (str, raw=false) ->
api.msg api.LEVEL_FATAL, str, raw
logLevel = api.LEVEL_INFO # default verbosity | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 7c2256a1a95a8332acdd153c2e82a9cfe5d3a180 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7c2256a1a95a8332acdd153c2e82a9cfe5d3a180/logger.coffee | 78 | 90 | ||
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
info: (str, raw=false) ->
api.msg api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.msg api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
api.msg api.LEVEL_ERROR, str, raw
fatal: (str, raw=false) ->
api.msg api.LEVEL_FATAL, str, ra... | var logLevel;
({
info: function(str, raw = false) {
return api.msg(api.LEVEL_INFO, str, raw);
},
warn: function(str, raw = false) {
return api.msg(api.LEVEL_WARN, str, raw);
},
error: function(str, raw = false) {
return api.msg(api.LEVEL_ERROR, str, raw);
},
fatal: function(str, raw = false) ... | CoffeeScript | JavaScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 7c2256a1a95a8332acdd153c2e82a9cfe5d3a180 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7c2256a1a95a8332acdd153c2e82a9cfe5d3a180/logger.coffee | 78 | 90 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var logLevel;
({
info: function(str, raw = false) {
return api.msg(api.LEVEL_INFO, str, raw);
},
warn: function(str, raw = false) {
return api.msg(api.LEVEL_WARN, str, raw);
},
error: function(str, raw = false) {
return api.msg(api.LEVEL_ERRO... | info: (str, raw=false) ->
api.msg api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.msg api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
api.msg api.LEVEL_ERROR, str, raw
fatal: (str, raw=false) ->
api.msg api.LEVEL_FATAL, str, raw
logLevel = api.LEVEL_INFO # default verbosity | JavaScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 7c2256a1a95a8332acdd153c2e82a9cfe5d3a180 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7c2256a1a95a8332acdd153c2e82a9cfe5d3a180/logger.coffee | 78 | 90 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:completion | completion | info: (str, raw=false) ->
api.msg api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.msg api.LEVEL_WARN, str, raw | error: (str, raw=false) ->
api.msg api.LEVEL_ERROR, str, raw
fatal: (str, raw=false) ->
api.msg api.LEVEL_FATAL, str, raw
logLevel = api.LEVEL_INFO # default verbosity | CoffeeScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 7c2256a1a95a8332acdd153c2e82a9cfe5d3a180 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7c2256a1a95a8332acdd153c2e82a9cfe5d3a180/logger.coffee | 78 | 90 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:raw_corpus | raw_corpus | info: (str, raw=false) ->
api.msg api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.msg api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
api.msg api.LEVEL_ERROR, str, raw
fatal: (str, raw=false) ->
api.msg api.LEVEL_FATAL, str, raw
logLevel = api.LEVEL_DEBUG | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | ffbcb5dead4972195b88a69dbe95519355fac0fd | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/ffbcb5dead4972195b88a69dbe95519355fac0fd/logger.coffee | 78 | 90 | ||
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
info: (str, raw=false) ->
api.msg api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.msg api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
api.msg api.LEVEL_ERROR, str, raw
fatal: (str, raw=false) ->
api.msg api.LEVEL_FATAL, str, ra... | var logLevel;
({
info: function(str, raw = false) {
return api.msg(api.LEVEL_INFO, str, raw);
},
warn: function(str, raw = false) {
return api.msg(api.LEVEL_WARN, str, raw);
},
error: function(str, raw = false) {
return api.msg(api.LEVEL_ERROR, str, raw);
},
fatal: function(str, raw = false) ... | CoffeeScript | JavaScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | ffbcb5dead4972195b88a69dbe95519355fac0fd | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/ffbcb5dead4972195b88a69dbe95519355fac0fd/logger.coffee | 78 | 90 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var logLevel;
({
info: function(str, raw = false) {
return api.msg(api.LEVEL_INFO, str, raw);
},
warn: function(str, raw = false) {
return api.msg(api.LEVEL_WARN, str, raw);
},
error: function(str, raw = false) {
return api.msg(api.LEVEL_ERRO... | info: (str, raw=false) ->
api.msg api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.msg api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
api.msg api.LEVEL_ERROR, str, raw
fatal: (str, raw=false) ->
api.msg api.LEVEL_FATAL, str, raw
logLevel = api.LEVEL_DEBUG | JavaScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | ffbcb5dead4972195b88a69dbe95519355fac0fd | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/ffbcb5dead4972195b88a69dbe95519355fac0fd/logger.coffee | 78 | 90 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:completion | completion | info: (str, raw=false) ->
api.msg api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.msg api.LEVEL_WARN, str, raw | error: (str, raw=false) ->
api.msg api.LEVEL_ERROR, str, raw
fatal: (str, raw=false) ->
api.msg api.LEVEL_FATAL, str, raw
logLevel = api.LEVEL_DEBUG | CoffeeScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | ffbcb5dead4972195b88a69dbe95519355fac0fd | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/ffbcb5dead4972195b88a69dbe95519355fac0fd/logger.coffee | 78 | 90 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:1:raw_corpus | raw_corpus | zeropad = (columns, num) ->
num += ''
while num.length < columns
num = '0' + num
num
api =
LEVEL_DEBUG: 0
LEVEL_INFO: 1
LEVEL_WARN: 2
LEVEL_ERROR: 3
LEVEL_FATAL: 4
LEVEL_OFF: 5
enableTag: (tag) ->
activeTags[tag] = true
disableTag: (tag) ->
delete activeTags[tag]
print: (str, raw... | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 7a7dc8c4ac21c565fa0118e5485447ccbc83f086 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7a7dc8c4ac21c565fa0118e5485447ccbc83f086/logger.coffee | 28 | 77 | ||
iizukanao/node-rtsp-rtmp-server:logger.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
zeropad = (columns, num) ->
num += ''
while num.length < columns
num = '0' + num
num
api =
LEVEL_DEBUG: 0
LEVEL_INFO: 1
LEVEL_WARN: 2
LEVEL_ERROR: 3
LEVEL_FATAL: 4
LEVEL_OFF: 5
enableTag: (tag) ->
activeTags[tag] = true
disableTag... | var api, zeropad;
zeropad = function(columns, num) {
num += '';
while (num.length < columns) {
num = '0' + num;
}
return num;
};
api = {
LEVEL_DEBUG: 0,
LEVEL_INFO: 1,
LEVEL_WARN: 2,
LEVEL_ERROR: 3,
LEVEL_FATAL: 4,
LEVEL_OFF: 5,
enableTag: function(tag) {
return activeTags[tag] = true;
... | CoffeeScript | JavaScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 7a7dc8c4ac21c565fa0118e5485447ccbc83f086 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7a7dc8c4ac21c565fa0118e5485447ccbc83f086/logger.coffee | 28 | 77 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var api, zeropad;
zeropad = function(columns, num) {
num += '';
while (num.length < columns) {
num = '0' + num;
}
return num;
};
api = {
LEVEL_DEBUG: 0,
LEVEL_INFO: 1,
LEVEL_WARN: 2,
LEVEL_ERROR: 3,
LEVEL_FATAL: 4,
LEVEL_OFF: 5,
enableTa... | zeropad = (columns, num) ->
num += ''
while num.length < columns
num = '0' + num
num
api =
LEVEL_DEBUG: 0
LEVEL_INFO: 1
LEVEL_WARN: 2
LEVEL_ERROR: 3
LEVEL_FATAL: 4
LEVEL_OFF: 5
enableTag: (tag) ->
activeTags[tag] = true
disableTag: (tag) ->
delete activeTags[tag]
print: (str, raw... | JavaScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 7a7dc8c4ac21c565fa0118e5485447ccbc83f086 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7a7dc8c4ac21c565fa0118e5485447ccbc83f086/logger.coffee | 28 | 77 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:1:completion | completion | zeropad = (columns, num) ->
num += ''
while num.length < columns
num = '0' + num
num
api =
LEVEL_DEBUG: 0
LEVEL_INFO: 1
LEVEL_WARN: 2
LEVEL_ERROR: 3
LEVEL_FATAL: 4
LEVEL_OFF: 5
enableTag: (tag) ->
activeTags[tag] = true
disableTag: (tag) ->
delete activeTags[tag]
print: (str, raw... | "#{zeropad 2, d.getMinutes()}:#{zeropad 2, d.getSeconds()}." +
"#{zeropad 3, d.getMilliseconds()} " + str
else
msg = str
console.log msg
tag: (tag, str, raw=false) ->
if activeTags[tag]?
api.print str, raw
msg: (level, str, raw=false) ->
if level >= logLevel
api.print str... | CoffeeScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 7a7dc8c4ac21c565fa0118e5485447ccbc83f086 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7a7dc8c4ac21c565fa0118e5485447ccbc83f086/logger.coffee | 28 | 77 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:raw_corpus | raw_corpus | api.msg api.LEVEL_DEBUG, str, raw
info: (str, raw=false) ->
api.msg api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.msg api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
api.msg api.LEVEL_ERROR, str, raw
fatal: (str, raw=false) ->
api.msg api.LEVEL_FATAL, str, raw
logLevel = api.LE... | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 7a7dc8c4ac21c565fa0118e5485447ccbc83f086 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7a7dc8c4ac21c565fa0118e5485447ccbc83f086/logger.coffee | 78 | 92 | ||
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
api.msg api.LEVEL_DEBUG, str, raw
info: (str, raw=false) ->
api.msg api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.msg api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
api.msg api.LEVEL_ERROR, str, raw
fatal: (str, raw=false) ->... | var logLevel;
api.msg(api.LEVEL_DEBUG, str, raw({
info: function(str, raw = false) {
return api.msg(api.LEVEL_INFO, str, raw);
},
warn: function(str, raw = false) {
return api.msg(api.LEVEL_WARN, str, raw);
},
error: function(str, raw = false) {
return api.msg(api.LEVEL_ERROR, str, raw);
},
f... | CoffeeScript | JavaScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 7a7dc8c4ac21c565fa0118e5485447ccbc83f086 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7a7dc8c4ac21c565fa0118e5485447ccbc83f086/logger.coffee | 78 | 92 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var logLevel;
api.msg(api.LEVEL_DEBUG, str, raw({
info: function(str, raw = false) {
return api.msg(api.LEVEL_INFO, str, raw);
},
warn: function(str, raw = false) {
return api.msg(api.LEVEL_WARN, str, raw);
},
error: function(str, raw = false) {
... | api.msg api.LEVEL_DEBUG, str, raw
info: (str, raw=false) ->
api.msg api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.msg api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
api.msg api.LEVEL_ERROR, str, raw
fatal: (str, raw=false) ->
api.msg api.LEVEL_FATAL, str, raw
logLevel = api.LE... | JavaScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 7a7dc8c4ac21c565fa0118e5485447ccbc83f086 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7a7dc8c4ac21c565fa0118e5485447ccbc83f086/logger.coffee | 78 | 92 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:completion | completion | api.msg api.LEVEL_DEBUG, str, raw
info: (str, raw=false) ->
api.msg api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.msg api.LEVEL_WARN, str, raw | error: (str, raw=false) ->
api.msg api.LEVEL_ERROR, str, raw
fatal: (str, raw=false) ->
api.msg api.LEVEL_FATAL, str, raw
logLevel = api.LEVEL_DEBUG | CoffeeScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 7a7dc8c4ac21c565fa0118e5485447ccbc83f086 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/7a7dc8c4ac21c565fa0118e5485447ccbc83f086/logger.coffee | 78 | 92 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:1:raw_corpus | raw_corpus | # Current log level
logLevel = null
activeTags = {}
zeropad = (columns, num) ->
num += ''
while num.length < columns
num = '0' + num
num
api =
LEVEL_DEBUG: 0
LEVEL_INFO: 1
LEVEL_WARN: 2
LEVEL_ERROR: 3
LEVEL_FATAL: 4
LEVEL_OFF: 5
enableTag: (tag) ->
activeTags[tag] = true
disableTag: (... | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 9285a0cdcbfab58e739c61cab1b833b80a3b8ea6 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/9285a0cdcbfab58e739c61cab1b833b80a3b8ea6/logger.coffee | 1 | 50 | ||
iizukanao/node-rtsp-rtmp-server:logger.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Current log level
logLevel = null
activeTags = {}
zeropad = (columns, num) ->
num += ''
while num.length < columns
num = '0' + num
num
api =
LEVEL_DEBUG: 0
LEVEL_INFO: 1
LEVEL_WARN: 2
LEVEL_ERROR: 3
LEVEL_FATAL: 4
LEVEL_OFF: 5
enable... | // Current log level
var activeTags, api, logLevel, zeropad;
logLevel = null;
activeTags = {};
zeropad = function(columns, num) {
num += '';
while (num.length < columns) {
num = '0' + num;
}
return num;
};
api = {
LEVEL_DEBUG: 0,
LEVEL_INFO: 1,
LEVEL_WARN: 2,
LEVEL_ERROR: 3,
LEVEL_FATAL: 4,
... | CoffeeScript | JavaScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 9285a0cdcbfab58e739c61cab1b833b80a3b8ea6 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/9285a0cdcbfab58e739c61cab1b833b80a3b8ea6/logger.coffee | 1 | 50 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Current log level
var activeTags, api, logLevel, zeropad;
logLevel = null;
activeTags = {};
zeropad = function(columns, num) {
num += '';
while (num.length < columns) {
num = '0' + num;
}
return num;
};
api = {
LEVEL_DEBUG: 0,
LEVEL_INFO: 1,
... | # Current log level
logLevel = null
activeTags = {}
zeropad = (columns, num) ->
num += ''
while num.length < columns
num = '0' + num
num
api =
LEVEL_DEBUG: 0
LEVEL_INFO: 1
LEVEL_WARN: 2
LEVEL_ERROR: 3
LEVEL_FATAL: 4
LEVEL_OFF: 5
enableTag: (tag) ->
activeTags[tag] = true
disableTag: (... | JavaScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 9285a0cdcbfab58e739c61cab1b833b80a3b8ea6 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/9285a0cdcbfab58e739c61cab1b833b80a3b8ea6/logger.coffee | 1 | 50 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:1:completion | completion | # Current log level
logLevel = null
activeTags = {}
zeropad = (columns, num) ->
num += ''
while num.length < columns
num = '0' + num
num
api =
LEVEL_DEBUG: 0
LEVEL_INFO: 1
LEVEL_WARN: 2
LEVEL_ERROR: 3
LEVEL_FATAL: 4
LEVEL_OFF: 5
enableTag: (tag) ->
activeTags[tag] = true
disableTag: (... | print: (str, raw=false) ->
if not raw
d = new Date()
msg = "#{d.getFullYear()}-#{zeropad 2, d.getMonth()+1}-" +
"#{zeropad 2, d.getDate()} #{zeropad 2, d.getHours()}:" +
"#{zeropad 2, d.getMinutes()}:#{zeropad 2, d.getSeconds()}." +
"#{zeropad 3, d.getMilliseconds()} " + str
... | CoffeeScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 9285a0cdcbfab58e739c61cab1b833b80a3b8ea6 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/9285a0cdcbfab58e739c61cab1b833b80a3b8ea6/logger.coffee | 1 | 50 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:raw_corpus | raw_corpus | getLevel: ->
return logLevel
debug: (str, raw=false) ->
api.msg api.LEVEL_DEBUG, str, raw
info: (str, raw=false) ->
api.msg api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.msg api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
api.msg api.LEVEL_ERROR, str, raw
fatal: (str, raw... | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 9285a0cdcbfab58e739c61cab1b833b80a3b8ea6 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/9285a0cdcbfab58e739c61cab1b833b80a3b8ea6/logger.coffee | 51 | 72 | ||
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
getLevel: ->
return logLevel
debug: (str, raw=false) ->
api.msg api.LEVEL_DEBUG, str, raw
info: (str, raw=false) ->
api.msg api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.msg api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
... | var logLevel;
({
getLevel: function() {
return logLevel;
},
debug: function(str, raw = false) {
return api.msg(api.LEVEL_DEBUG, str, raw);
},
info: function(str, raw = false) {
return api.msg(api.LEVEL_INFO, str, raw);
},
warn: function(str, raw = false) {
return api.msg(api.LEVEL_WARN, s... | CoffeeScript | JavaScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 9285a0cdcbfab58e739c61cab1b833b80a3b8ea6 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/9285a0cdcbfab58e739c61cab1b833b80a3b8ea6/logger.coffee | 51 | 72 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var logLevel;
({
getLevel: function() {
return logLevel;
},
debug: function(str, raw = false) {
return api.msg(api.LEVEL_DEBUG, str, raw);
},
info: function(str, raw = false) {
return api.msg(api.LEVEL_INFO, str, raw);
},
warn: function(s... | getLevel: ->
return logLevel
debug: (str, raw=false) ->
api.msg api.LEVEL_DEBUG, str, raw
info: (str, raw=false) ->
api.msg api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.msg api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
api.msg api.LEVEL_ERROR, str, raw
fatal: (str, raw... | JavaScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 9285a0cdcbfab58e739c61cab1b833b80a3b8ea6 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/9285a0cdcbfab58e739c61cab1b833b80a3b8ea6/logger.coffee | 51 | 72 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:completion | completion | getLevel: ->
return logLevel
debug: (str, raw=false) ->
api.msg api.LEVEL_DEBUG, str, raw
info: (str, raw=false) ->
api.msg api.LEVEL_INFO, str, raw
warn: (str, raw=false) -> | api.msg api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
api.msg api.LEVEL_ERROR, str, raw
fatal: (str, raw=false) ->
api.msg api.LEVEL_FATAL, str, raw
logLevel = api.LEVEL_DEBUG
module.exports = api | CoffeeScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 9285a0cdcbfab58e739c61cab1b833b80a3b8ea6 | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/9285a0cdcbfab58e739c61cab1b833b80a3b8ea6/logger.coffee | 51 | 72 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:1:raw_corpus | raw_corpus | # Current log level
logLevel = null
activeTags = {}
zeropad = (columns, num) ->
num += ''
while num.length < columns
num = '0' + num
num
api =
LEVEL_DEBUG: 0
LEVEL_INFO: 1
LEVEL_WARN: 2
LEVEL_ERROR: 3
LEVEL_FATAL: 4
LEVEL_OFF: 5
enableTag: (tag) ->
activeTags[tag] = true
disableTag: (... | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 699e1414a8cacbdc5314312977897be597bb679b | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/699e1414a8cacbdc5314312977897be597bb679b/logger.coffee | 1 | 50 | ||
iizukanao/node-rtsp-rtmp-server:logger.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Current log level
logLevel = null
activeTags = {}
zeropad = (columns, num) ->
num += ''
while num.length < columns
num = '0' + num
num
api =
LEVEL_DEBUG: 0
LEVEL_INFO: 1
LEVEL_WARN: 2
LEVEL_ERROR: 3
LEVEL_FATAL: 4
LEVEL_OFF: 5
enable... | // Current log level
var activeTags, api, logLevel, zeropad;
logLevel = null;
activeTags = {};
zeropad = function(columns, num) {
num += '';
while (num.length < columns) {
num = '0' + num;
}
return num;
};
api = {
LEVEL_DEBUG: 0,
LEVEL_INFO: 1,
LEVEL_WARN: 2,
LEVEL_ERROR: 3,
LEVEL_FATAL: 4,
... | CoffeeScript | JavaScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 699e1414a8cacbdc5314312977897be597bb679b | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/699e1414a8cacbdc5314312977897be597bb679b/logger.coffee | 1 | 50 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Current log level
var activeTags, api, logLevel, zeropad;
logLevel = null;
activeTags = {};
zeropad = function(columns, num) {
num += '';
while (num.length < columns) {
num = '0' + num;
}
return num;
};
api = {
LEVEL_DEBUG: 0,
LEVEL_INFO: 1,
... | # Current log level
logLevel = null
activeTags = {}
zeropad = (columns, num) ->
num += ''
while num.length < columns
num = '0' + num
num
api =
LEVEL_DEBUG: 0
LEVEL_INFO: 1
LEVEL_WARN: 2
LEVEL_ERROR: 3
LEVEL_FATAL: 4
LEVEL_OFF: 5
enableTag: (tag) ->
activeTags[tag] = true
disableTag: (... | JavaScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 699e1414a8cacbdc5314312977897be597bb679b | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/699e1414a8cacbdc5314312977897be597bb679b/logger.coffee | 1 | 50 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:1:completion | completion | # Current log level
logLevel = null
activeTags = {}
zeropad = (columns, num) ->
num += ''
while num.length < columns
num = '0' + num
num
api =
LEVEL_DEBUG: 0
LEVEL_INFO: 1
LEVEL_WARN: 2
LEVEL_ERROR: 3
LEVEL_FATAL: 4
LEVEL_OFF: 5
enableTag: (tag) ->
activeTags[tag] = true
disableTag: (... | print: (str, raw=false) ->
if not raw
d = new Date()
msg = "#{d.getFullYear()}-#{zeropad 2, d.getMonth()+1}-" +
"#{zeropad 2, d.getDate()} #{zeropad 2, d.getHours()}:" +
"#{zeropad 2, d.getMinutes()}:#{zeropad 2, d.getSeconds()}." +
"#{zeropad 3, d.getMilliseconds()} " + str
... | CoffeeScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 699e1414a8cacbdc5314312977897be597bb679b | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/699e1414a8cacbdc5314312977897be597bb679b/logger.coffee | 1 | 50 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:raw_corpus | raw_corpus | getLevel: ->
return logLevel
debug: (str, raw=false) ->
api.log api.LEVEL_DEBUG, str, raw
info: (str, raw=false) ->
api.log api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.log api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
api.log api.LEVEL_ERROR, str, raw
fatal: (str, raw... | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 699e1414a8cacbdc5314312977897be597bb679b | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/699e1414a8cacbdc5314312977897be597bb679b/logger.coffee | 51 | 72 | ||
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
getLevel: ->
return logLevel
debug: (str, raw=false) ->
api.log api.LEVEL_DEBUG, str, raw
info: (str, raw=false) ->
api.log api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.log api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
... | var logLevel;
({
getLevel: function() {
return logLevel;
},
debug: function(str, raw = false) {
return api.log(api.LEVEL_DEBUG, str, raw);
},
info: function(str, raw = false) {
return api.log(api.LEVEL_INFO, str, raw);
},
warn: function(str, raw = false) {
return api.log(api.LEVEL_WARN, s... | CoffeeScript | JavaScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 699e1414a8cacbdc5314312977897be597bb679b | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/699e1414a8cacbdc5314312977897be597bb679b/logger.coffee | 51 | 72 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var logLevel;
({
getLevel: function() {
return logLevel;
},
debug: function(str, raw = false) {
return api.log(api.LEVEL_DEBUG, str, raw);
},
info: function(str, raw = false) {
return api.log(api.LEVEL_INFO, str, raw);
},
warn: function(s... | getLevel: ->
return logLevel
debug: (str, raw=false) ->
api.log api.LEVEL_DEBUG, str, raw
info: (str, raw=false) ->
api.log api.LEVEL_INFO, str, raw
warn: (str, raw=false) ->
api.log api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
api.log api.LEVEL_ERROR, str, raw
fatal: (str, raw... | JavaScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 699e1414a8cacbdc5314312977897be597bb679b | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/699e1414a8cacbdc5314312977897be597bb679b/logger.coffee | 51 | 72 |
iizukanao/node-rtsp-rtmp-server:logger.coffee:2:completion | completion | getLevel: ->
return logLevel
debug: (str, raw=false) ->
api.log api.LEVEL_DEBUG, str, raw
info: (str, raw=false) ->
api.log api.LEVEL_INFO, str, raw
warn: (str, raw=false) -> | api.log api.LEVEL_WARN, str, raw
error: (str, raw=false) ->
api.log api.LEVEL_ERROR, str, raw
fatal: (str, raw=false) ->
api.log api.LEVEL_FATAL, str, raw
logLevel = api.LEVEL_DEBUG
module.exports = api | CoffeeScript | CoffeeScript | iizukanao/node-rtsp-rtmp-server | logger.coffee | MIT | 699e1414a8cacbdc5314312977897be597bb679b | 1,100 | https://github.com/iizukanao/node-rtsp-rtmp-server/blob/699e1414a8cacbdc5314312977897be597bb679b/logger.coffee | 51 | 72 |
lmaccherone/node-localstorage:.play/es6ProxyTest.coffee:1:raw_corpus | raw_corpus | class ObjectLike
constructor: (obj) ->
unless obj?
obj = {}
@dummy = obj
interceptor =
set: (receiver, key, value) =>
@dummy[key] = value
get: (receiver, key) =>
return @dummy[key]
return Proxy.create(interceptor, @dummy)
exports.es6ProxyTest =
theTest: (test) ... | CoffeeScript | lmaccherone/node-localstorage | .play/es6ProxyTest.coffee | MIT | 23eff752dc603ad9559c50739589d3ec673c07f7 | 460 | https://github.com/lmaccherone/node-localstorage/blob/23eff752dc603ad9559c50739589d3ec673c07f7/.play/es6ProxyTest.coffee | 1 | 22 | ||
lmaccherone/node-localstorage:.play/es6ProxyTest.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class ObjectLike
constructor: (obj) ->
unless obj?
obj = {}
@dummy = obj
interceptor =
set: (receiver, key, value) =>
@dummy[key] = value
get: (receiver, key) =>
return @dummy[key]
return Proxy.create(interce... | var ObjectLike;
ObjectLike = class ObjectLike {
constructor(obj) {
var interceptor;
if (obj == null) {
obj = {};
}
this.dummy = obj;
interceptor = {
set: (receiver, key, value) => {
return this.dummy[key] = value;
},
get: (receiver, key) => {
return this.du... | CoffeeScript | JavaScript | lmaccherone/node-localstorage | .play/es6ProxyTest.coffee | MIT | 23eff752dc603ad9559c50739589d3ec673c07f7 | 460 | https://github.com/lmaccherone/node-localstorage/blob/23eff752dc603ad9559c50739589d3ec673c07f7/.play/es6ProxyTest.coffee | 1 | 22 |
lmaccherone/node-localstorage:.play/es6ProxyTest.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ObjectLike;
ObjectLike = class ObjectLike {
constructor(obj) {
var interceptor;
if (obj == null) {
obj = {};
}
this.dummy = obj;
interceptor = {
set: (receiver, key, value) => {
return this.dummy[key] = value;
},... | class ObjectLike
constructor: (obj) ->
unless obj?
obj = {}
@dummy = obj
interceptor =
set: (receiver, key, value) =>
@dummy[key] = value
get: (receiver, key) =>
return @dummy[key]
return Proxy.create(interceptor, @dummy)
exports.es6ProxyTest =
theTest: (test) ... | JavaScript | CoffeeScript | lmaccherone/node-localstorage | .play/es6ProxyTest.coffee | MIT | 23eff752dc603ad9559c50739589d3ec673c07f7 | 460 | https://github.com/lmaccherone/node-localstorage/blob/23eff752dc603ad9559c50739589d3ec673c07f7/.play/es6ProxyTest.coffee | 1 | 22 |
lmaccherone/node-localstorage:.play/es6ProxyTest.coffee:1:completion | completion | class ObjectLike
constructor: (obj) ->
unless obj?
obj = {}
@dummy = obj
interceptor =
set: (receiver, key, value) =>
@dummy[key] = value
get: (receiver, key) => | return @dummy[key]
return Proxy.create(interceptor, @dummy)
exports.es6ProxyTest =
theTest: (test) ->
a = new ObjectLike()
a['something long'] = 10
test.equal(a['something long'], 11)
test.done() | CoffeeScript | CoffeeScript | lmaccherone/node-localstorage | .play/es6ProxyTest.coffee | MIT | 23eff752dc603ad9559c50739589d3ec673c07f7 | 460 | https://github.com/lmaccherone/node-localstorage/blob/23eff752dc603ad9559c50739589d3ec673c07f7/.play/es6ProxyTest.coffee | 1 | 22 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | d812c3887a7e3def92d7ff9b67f07c6a11859ae2 | 815 | https://github.com/octoblu/meshblu/blob/d812c3887a7e3def92d7ff9b67f07c6a11859ae2/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 46 | ||
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@d... | var TestDatabase, _;
_ = require('lodash');
TestDatabase = require('../test-database');
describe('createSubscriptionIfAuthorized', function() {
beforeEach(function() {
return this.sut = require('../../lib/createSubscriptionIfAuthorized');
});
beforeEach(function(done) {
return TestDatabase.open((error,... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | d812c3887a7e3def92d7ff9b67f07c6a11859ae2 | 815 | https://github.com/octoblu/meshblu/blob/d812c3887a7e3def92d7ff9b67f07c6a11859ae2/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 46 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TestDatabase, _;
_ = require('lodash');
TestDatabase = require('../test-database');
describe('createSubscriptionIfAuthorized', function() {
beforeEach(function() {
return this.sut = require('../../lib/createSubscriptionIfAuthorized');
});
beforeEac... | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | d812c3887a7e3def92d7ff9b67f07c6a11859ae2 | 815 | https://github.com/octoblu/meshblu/blob/d812c3887a7e3def92d7ff9b67f07c6a11859ae2/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 46 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:completion | completion | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | beforeEach (done) ->
storeError = (@error) => done()
@sut {}, {type: 'broadcast'}, storeError
it 'should yield not an error', ->
expect(@error).not.to.be.an.instanceOf Error
describe 'when we have one open device and one closed device', ->
beforeEach (done) ->
@open_device = uuid: 'u... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | d812c3887a7e3def92d7ff9b67f07c6a11859ae2 | 815 | https://github.com/octoblu/meshblu/blob/d812c3887a7e3def92d7ff9b67f07c6a11859ae2/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 46 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:2:raw_corpus | raw_corpus | @dependencies.getDevice = sinon.stub().yields null, @open_device
@sut @open_device, params, done, @dependencies
it 'should create exactly one subscription in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?
e... | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | d812c3887a7e3def92d7ff9b67f07c6a11859ae2 | 815 | https://github.com/octoblu/meshblu/blob/d812c3887a7e3def92d7ff9b67f07c6a11859ae2/test/lib/createSubscriptionIfAuthorized-spec.coffee | 48 | 91 | ||
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:2:completion | completion | @dependencies.getDevice = sinon.stub().yields null, @open_device
@sut @open_device, params, done, @dependencies
it 'should create exactly one subscription in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?
e... | type: 'broadcast'
}
@dependencies.getDevice = sinon.stub().yields null, @open_device
@sut @open_device, params, done, @dependencies
it 'should not create a new subscription in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | d812c3887a7e3def92d7ff9b67f07c6a11859ae2 | 815 | https://github.com/octoblu/meshblu/blob/d812c3887a7e3def92d7ff9b67f07c6a11859ae2/test/lib/createSubscriptionIfAuthorized-spec.coffee | 48 | 91 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:3:raw_corpus | raw_corpus | @dependencies.getDevice = sinon.stub().yields null, @closed_device
storeError = (@error) => done()
@sut @other_device, params, storeError, @dependencies
it 'should create exactly no subscriptions in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
... | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | d812c3887a7e3def92d7ff9b67f07c6a11859ae2 | 815 | https://github.com/octoblu/meshblu/blob/d812c3887a7e3def92d7ff9b67f07c6a11859ae2/test/lib/createSubscriptionIfAuthorized-spec.coffee | 93 | 106 | ||
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:3:completion | completion | @dependencies.getDevice = sinon.stub().yields null, @closed_device
storeError = (@error) => done()
@sut @other_device, params, storeError, @dependencies
it 'should create exactly no subscriptions in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) => | return done error if error?
expect(subscriptionCount).to.equal 0
done()
it 'should yield an error', ->
expect(@error).to.be.an.instanceOf Error
expect(@error.message).to.deep.equal 'Insufficient permissions to subscribe on behalf of that device' | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | d812c3887a7e3def92d7ff9b67f07c6a11859ae2 | 815 | https://github.com/octoblu/meshblu/blob/d812c3887a7e3def92d7ff9b67f07c6a11859ae2/test/lib/createSubscriptionIfAuthorized-spec.coffee | 93 | 106 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 5f61924b7351403d201c82dc6606f07f97392f74 | 815 | https://github.com/octoblu/meshblu/blob/5f61924b7351403d201c82dc6606f07f97392f74/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 46 | ||
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@d... | var TestDatabase, _;
_ = require('lodash');
TestDatabase = require('../test-database');
describe('createSubscriptionIfAuthorized', function() {
beforeEach(function() {
return this.sut = require('../../lib/createSubscriptionIfAuthorized');
});
beforeEach(function(done) {
return TestDatabase.open((error,... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 5f61924b7351403d201c82dc6606f07f97392f74 | 815 | https://github.com/octoblu/meshblu/blob/5f61924b7351403d201c82dc6606f07f97392f74/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 46 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TestDatabase, _;
_ = require('lodash');
TestDatabase = require('../test-database');
describe('createSubscriptionIfAuthorized', function() {
beforeEach(function() {
return this.sut = require('../../lib/createSubscriptionIfAuthorized');
});
beforeEac... | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 5f61924b7351403d201c82dc6606f07f97392f74 | 815 | https://github.com/octoblu/meshblu/blob/5f61924b7351403d201c82dc6606f07f97392f74/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 46 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:completion | completion | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | beforeEach (done) ->
storeError = (@error) => done()
@sut {}, {type: 'broadcast'}, storeError
it 'should yield not an error', ->
expect(@error).not.to.be.an.instanceOf Error
describe 'when we have one open device and one closed device', ->
beforeEach (done) ->
@open_device = uuid: 'u... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 5f61924b7351403d201c82dc6606f07f97392f74 | 815 | https://github.com/octoblu/meshblu/blob/5f61924b7351403d201c82dc6606f07f97392f74/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 46 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:2:raw_corpus | raw_corpus | @dependencies.getDevice = sinon.stub().yields null, @open_device
@sut @open_device, params, done, @dependencies
it 'should create exactly one subscription in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?
e... | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 5f61924b7351403d201c82dc6606f07f97392f74 | 815 | https://github.com/octoblu/meshblu/blob/5f61924b7351403d201c82dc6606f07f97392f74/test/lib/createSubscriptionIfAuthorized-spec.coffee | 48 | 91 | ||
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:2:completion | completion | @dependencies.getDevice = sinon.stub().yields null, @open_device
@sut @open_device, params, done, @dependencies
it 'should create exactly one subscription in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?
e... | type: 'event'
}
@dependencies.getDevice = sinon.stub().yields null, @open_device
@sut @open_device, params, done, @dependencies
it 'should not create a new subscription in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 5f61924b7351403d201c82dc6606f07f97392f74 | 815 | https://github.com/octoblu/meshblu/blob/5f61924b7351403d201c82dc6606f07f97392f74/test/lib/createSubscriptionIfAuthorized-spec.coffee | 48 | 91 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 34fcd9be8665d56fe7253a9824cea239276ea0fe | 815 | https://github.com/octoblu/meshblu/blob/34fcd9be8665d56fe7253a9824cea239276ea0fe/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 46 | ||
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@d... | var TestDatabase, _;
_ = require('lodash');
TestDatabase = require('../test-database');
describe('createSubscriptionIfAuthorized', function() {
beforeEach(function() {
return this.sut = require('../../lib/createSubscriptionIfAuthorized');
});
beforeEach(function(done) {
return TestDatabase.open((error,... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 34fcd9be8665d56fe7253a9824cea239276ea0fe | 815 | https://github.com/octoblu/meshblu/blob/34fcd9be8665d56fe7253a9824cea239276ea0fe/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 46 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TestDatabase, _;
_ = require('lodash');
TestDatabase = require('../test-database');
describe('createSubscriptionIfAuthorized', function() {
beforeEach(function() {
return this.sut = require('../../lib/createSubscriptionIfAuthorized');
});
beforeEac... | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 34fcd9be8665d56fe7253a9824cea239276ea0fe | 815 | https://github.com/octoblu/meshblu/blob/34fcd9be8665d56fe7253a9824cea239276ea0fe/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 46 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:completion | completion | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | beforeEach (done) ->
storeError = (@error) => done()
@sut {}, {type: 'broadcast'}, storeError
it 'should yield not an error', ->
expect(@error).not.to.be.an.instanceOf Error
describe 'when we have one open device and one closed device', ->
beforeEach (done) ->
@open_device = uuid: 'u... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 34fcd9be8665d56fe7253a9824cea239276ea0fe | 815 | https://github.com/octoblu/meshblu/blob/34fcd9be8665d56fe7253a9824cea239276ea0fe/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 46 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:2:raw_corpus | raw_corpus | @dependencies.getDevice = sinon.stub().yields null, @open_device
@sut @open_device, params, done, @dependencies
it 'should create exactly one subscription in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?
e... | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 34fcd9be8665d56fe7253a9824cea239276ea0fe | 815 | https://github.com/octoblu/meshblu/blob/34fcd9be8665d56fe7253a9824cea239276ea0fe/test/lib/createSubscriptionIfAuthorized-spec.coffee | 48 | 91 | ||
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:2:completion | completion | @dependencies.getDevice = sinon.stub().yields null, @open_device
@sut @open_device, params, done, @dependencies
it 'should create exactly one subscription in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?
e... | type: 'event'
}
@dependencies.getDevice = sinon.stub().yields null, @open_device
@sut @open_device, params, done, @dependencies
it 'should not create a new subscription in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 34fcd9be8665d56fe7253a9824cea239276ea0fe | 815 | https://github.com/octoblu/meshblu/blob/34fcd9be8665d56fe7253a9824cea239276ea0fe/test/lib/createSubscriptionIfAuthorized-spec.coffee | 48 | 91 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 3754117cb39a22bbfd909d7ba5aba71a2f26ccf0 | 815 | https://github.com/octoblu/meshblu/blob/3754117cb39a22bbfd909d7ba5aba71a2f26ccf0/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 40 | ||
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@d... | var TestDatabase, _;
_ = require('lodash');
TestDatabase = require('../test-database');
describe('createSubscriptionIfAuthorized', function() {
beforeEach(function() {
return this.sut = require('../../lib/createSubscriptionIfAuthorized');
});
beforeEach(function(done) {
return TestDatabase.open((error,... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 3754117cb39a22bbfd909d7ba5aba71a2f26ccf0 | 815 | https://github.com/octoblu/meshblu/blob/3754117cb39a22bbfd909d7ba5aba71a2f26ccf0/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 40 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TestDatabase, _;
_ = require('lodash');
TestDatabase = require('../test-database');
describe('createSubscriptionIfAuthorized', function() {
beforeEach(function() {
return this.sut = require('../../lib/createSubscriptionIfAuthorized');
});
beforeEac... | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 3754117cb39a22bbfd909d7ba5aba71a2f26ccf0 | 815 | https://github.com/octoblu/meshblu/blob/3754117cb39a22bbfd909d7ba5aba71a2f26ccf0/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 40 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:completion | completion | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | expect(@error.message).to.deep.equal 'Type must be one of ["event"]'
describe 'when we have one open device and one closed device', ->
beforeEach (done) ->
@open_device = uuid: 'uuid1', configureWhitelist: ['*']
@database.devices.insert uuid: 'uuid1', token: 'token1', configureWhitelist: ['*'], done
... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 3754117cb39a22bbfd909d7ba5aba71a2f26ccf0 | 815 | https://github.com/octoblu/meshblu/blob/3754117cb39a22bbfd909d7ba5aba71a2f26ccf0/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 40 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:2:raw_corpus | raw_corpus | @sut @open_device, params, done, @dependencies
it 'should create exactly one subscription in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?
expect(subscriptionCount).to.equal 1
done()
it 'should cre... | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 3754117cb39a22bbfd909d7ba5aba71a2f26ccf0 | 815 | https://github.com/octoblu/meshblu/blob/3754117cb39a22bbfd909d7ba5aba71a2f26ccf0/test/lib/createSubscriptionIfAuthorized-spec.coffee | 42 | 83 | ||
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:2:completion | completion | @sut @open_device, params, done, @dependencies
it 'should create exactly one subscription in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?
expect(subscriptionCount).to.equal 1
done()
it 'should cre... | }
@dependencies.getDevice = sinon.stub().yields null, @open_device
@sut @open_device, params, done, @dependencies
it 'should not create a new subscription in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 3754117cb39a22bbfd909d7ba5aba71a2f26ccf0 | 815 | https://github.com/octoblu/meshblu/blob/3754117cb39a22bbfd909d7ba5aba71a2f26ccf0/test/lib/createSubscriptionIfAuthorized-spec.coffee | 42 | 83 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:2:raw_corpus | raw_corpus | @sut @open_device, params, done, @dependencies
it 'should create exactly one subscription in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?
expect(subscriptionCount).to.equal 1
done()
it 'should cre... | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 83945960cf060e0da7257f8f56c4304be422598b | 815 | https://github.com/octoblu/meshblu/blob/83945960cf060e0da7257f8f56c4304be422598b/test/lib/createSubscriptionIfAuthorized-spec.coffee | 42 | 83 | ||
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:2:completion | completion | @sut @open_device, params, done, @dependencies
it 'should create exactly one subscription in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?
expect(subscriptionCount).to.equal 1
done()
it 'should cre... | }
@dependencies.getDevice = sinon.stub().yields null, @open_device
@sut @open_device, params, done, @dependencies
it 'should not create a new subscription in the database', ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | 83945960cf060e0da7257f8f56c4304be422598b | 815 | https://github.com/octoblu/meshblu/blob/83945960cf060e0da7257f8f56c4304be422598b/test/lib/createSubscriptionIfAuthorized-spec.coffee | 42 | 83 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | a9aac28463fe42fc81311742a93dd245ad47d0a7 | 815 | https://github.com/octoblu/meshblu/blob/a9aac28463fe42fc81311742a93dd245ad47d0a7/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 39 | ||
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@d... | var TestDatabase, _;
_ = require('lodash');
TestDatabase = require('../test-database');
describe('createSubscriptionIfAuthorized', function() {
beforeEach(function() {
return this.sut = require('../../lib/createSubscriptionIfAuthorized');
});
beforeEach(function(done) {
return TestDatabase.open((error,... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | a9aac28463fe42fc81311742a93dd245ad47d0a7 | 815 | https://github.com/octoblu/meshblu/blob/a9aac28463fe42fc81311742a93dd245ad47d0a7/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 39 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TestDatabase, _;
_ = require('lodash');
TestDatabase = require('../test-database');
describe('createSubscriptionIfAuthorized', function() {
beforeEach(function() {
return this.sut = require('../../lib/createSubscriptionIfAuthorized');
});
beforeEac... | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | a9aac28463fe42fc81311742a93dd245ad47d0a7 | 815 | https://github.com/octoblu/meshblu/blob/a9aac28463fe42fc81311742a93dd245ad47d0a7/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 39 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:completion | completion | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | @closed_device = uuid: 'uuid2', configureWhitelist: []
@database.devices.insert uuid: 'uuid2', token: 'token2', configureWhitelist: [], done
describe 'when the open device creates a subscription from itself to the closed device', ->
beforeEach (done) ->
params = {
uuid: @open_device.u... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | a9aac28463fe42fc81311742a93dd245ad47d0a7 | 815 | https://github.com/octoblu/meshblu/blob/a9aac28463fe42fc81311742a93dd245ad47d0a7/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 39 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:2:raw_corpus | raw_corpus | it 'should create a new subscription for uuid1', (done) ->
@database.subscriptions.findOne {}, (error, subscription) =>
return done error if error?
subscription = _.omit subscription, '_id'
expect(subscription).to.deep.equal subscriberUuid: @open_device.uuid, emitterUuid: @closed_d... | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | a9aac28463fe42fc81311742a93dd245ad47d0a7 | 815 | https://github.com/octoblu/meshblu/blob/a9aac28463fe42fc81311742a93dd245ad47d0a7/test/lib/createSubscriptionIfAuthorized-spec.coffee | 41 | 79 | ||
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should create a new subscription for uuid1', (done) ->
@database.subscriptions.findOne {}, (error, subscription) =>
return done error if error?
subscription = _.omit subscription, '_id'
expect(subscription).to.deep.equal ... | it('should create a new subscription for uuid1', function(done) {
return this.database.subscriptions.findOne({}, (error, subscription) => {
if (error != null) {
return done(error);
}
subscription = _.omit(subscription, '_id');
expect(subscription).to.deep.equal({
subscriberUuid: this.open_... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | a9aac28463fe42fc81311742a93dd245ad47d0a7 | 815 | https://github.com/octoblu/meshblu/blob/a9aac28463fe42fc81311742a93dd245ad47d0a7/test/lib/createSubscriptionIfAuthorized-spec.coffee | 41 | 79 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should create a new subscription for uuid1', function(done) {
return this.database.subscriptions.findOne({}, (error, subscription) => {
if (error != null) {
return done(error);
}
subscription = _.omit(subscription, '_id');
expect(subscri... | it 'should create a new subscription for uuid1', (done) ->
@database.subscriptions.findOne {}, (error, subscription) =>
return done error if error?
subscription = _.omit subscription, '_id'
expect(subscription).to.deep.equal subscriberUuid: @open_device.uuid, emitterUuid: @closed_d... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | a9aac28463fe42fc81311742a93dd245ad47d0a7 | 815 | https://github.com/octoblu/meshblu/blob/a9aac28463fe42fc81311742a93dd245ad47d0a7/test/lib/createSubscriptionIfAuthorized-spec.coffee | 41 | 79 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.