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-api2x/test/controllers/favorite.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
body:
_favoriteIds: [app.favorite1._id]
_sessionUserId: app.user1._id
_roomId: app.room1._id
app.request options, (err, res, messages) ->
messages.length.should.eql 1
messages.forEach _checkMessage
... | ({
body: {
_favoriteIds: [app.favorite1._id],
_sessionUserId: app.user1._id,
_roomId: app.room1._id
}
});
app.request(options, function(err, res, messages) {
messages.length.should.eql(1);
messages.forEach(_checkMessage);
return callback(err);
}, done); | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/test/controllers/favorite.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/controllers/favorite.coffee | 173 | 181 |
jianliaoim/talk-os:talk-api2x/test/controllers/favorite.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
body: {
_favoriteIds: [app.favorite1._id],
_sessionUserId: app.user1._id,
_roomId: app.room1._id
}
});
app.request(options, function(err, res, messages) {
messages.length.should.eql(1);
messages.forEach(_checkMessage);
return callback(err)... | body:
_favoriteIds: [app.favorite1._id]
_sessionUserId: app.user1._id
_roomId: app.room1._id
app.request options, (err, res, messages) ->
messages.length.should.eql 1
messages.forEach _checkMessage
callback err
, done | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/test/controllers/favorite.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/controllers/favorite.coffee | 173 | 181 |
jianliaoim/talk-os:talk-api2x/test/controllers/favorite.coffee:5:completion | completion | body:
_favoriteIds: [app.favorite1._id]
_sessionUserId: app.user1._id
_roomId: app.room1._id | app.request options, (err, res, messages) ->
messages.length.should.eql 1
messages.forEach _checkMessage
callback err
, done | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/test/controllers/favorite.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/controllers/favorite.coffee | 173 | 181 |
soyjavi/QuoJS:spec/3_element.coffee:1:raw_corpus | raw_corpus | describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<input type="text" class="quo" data-quo="js" value="1980"/>"""
el = $$ "input"
it "can get a attribute of a given element", ->
attribute = "class"
expect(el.attr attribute).toEqual "quo"
it "can set a attribute i... | CoffeeScript | soyjavi/QuoJS | spec/3_element.coffee | MIT | f97418c4e9e8e8346fd1679d2beb24bc1f0fd507 | 2,055 | https://github.com/soyjavi/QuoJS/blob/f97418c4e9e8e8346fd1679d2beb24bc1f0fd507/spec/3_element.coffee | 1 | 50 | ||
soyjavi/QuoJS:spec/3_element.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<input type="text" class="quo" data-quo="js" value="1980"/>"""
el = $$ "input"
it "can get a attribute of a given element", ->
attribute = "class"
expect(el.at... | describe("Style", function() {
var el;
el = void 0;
beforeEach(function() {
document.body.innerHTML = `<input type="text" class="quo" data-quo="js" value="1980"/>`;
return el = $$("input");
});
it("can get a attribute of a given element", function() {
var attribute;
attribute = "class";
re... | CoffeeScript | JavaScript | soyjavi/QuoJS | spec/3_element.coffee | MIT | f97418c4e9e8e8346fd1679d2beb24bc1f0fd507 | 2,055 | https://github.com/soyjavi/QuoJS/blob/f97418c4e9e8e8346fd1679d2beb24bc1f0fd507/spec/3_element.coffee | 1 | 50 |
soyjavi/QuoJS:spec/3_element.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe("Style", function() {
var el;
el = void 0;
beforeEach(function() {
document.body.innerHTML = `<input type="text" class="quo" data-quo="js" value="1980"/>`;
return el = $$("input");
});
it("can get a attribute of a given element", function... | describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<input type="text" class="quo" data-quo="js" value="1980"/>"""
el = $$ "input"
it "can get a attribute of a given element", ->
attribute = "class"
expect(el.attr attribute).toEqual "quo"
it "can set a attribute i... | JavaScript | CoffeeScript | soyjavi/QuoJS | spec/3_element.coffee | MIT | f97418c4e9e8e8346fd1679d2beb24bc1f0fd507 | 2,055 | https://github.com/soyjavi/QuoJS/blob/f97418c4e9e8e8346fd1679d2beb24bc1f0fd507/spec/3_element.coffee | 1 | 50 |
soyjavi/QuoJS:spec/3_element.coffee:1:completion | completion | describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<input type="text" class="quo" data-quo="js" value="1980"/>"""
el = $$ "input"
it "can get a attribute of a given element", ->
attribute = "class"
expect(el.attr attribute).toEqual "quo"
it "can set a attribute i... | expect(el.attr attribute).toEqual null
it "can get a data attribute in a given element", ->
attribute = "quo"
expect(el.data attribute).toEqual "js"
it "can set a data attribute in a given element", ->
attribute = "framework"
value = "quojs"
el.data attribute, value
expect(el.data attri... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | spec/3_element.coffee | MIT | f97418c4e9e8e8346fd1679d2beb24bc1f0fd507 | 2,055 | https://github.com/soyjavi/QuoJS/blob/f97418c4e9e8e8346fd1679d2beb24bc1f0fd507/spec/3_element.coffee | 1 | 50 |
soyjavi/QuoJS:spec/3_element.coffee:1:raw_corpus | raw_corpus | describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo" data-quo="js"></section>"""
el = $$ "section"
it "can get a attribute of a given element", ->
attribute = "class"
expect(el.attr attribute).toEqual "quo"
it "can set a attribute in a given ele... | CoffeeScript | soyjavi/QuoJS | spec/3_element.coffee | MIT | d4c2c5e53ce5e18a0ea8a200d0b253e4669c0397 | 2,055 | https://github.com/soyjavi/QuoJS/blob/d4c2c5e53ce5e18a0ea8a200d0b253e4669c0397/spec/3_element.coffee | 1 | 39 | ||
soyjavi/QuoJS:spec/3_element.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo" data-quo="js"></section>"""
el = $$ "section"
it "can get a attribute of a given element", ->
attribute = "class"
expect(el.attr attribute... | describe("Style", function() {
var el;
el = void 0;
beforeEach(function() {
document.body.innerHTML = `<section class="quo" data-quo="js"></section>`;
return el = $$("section");
});
it("can get a attribute of a given element", function() {
var attribute;
attribute = "class";
return expect(... | CoffeeScript | JavaScript | soyjavi/QuoJS | spec/3_element.coffee | MIT | d4c2c5e53ce5e18a0ea8a200d0b253e4669c0397 | 2,055 | https://github.com/soyjavi/QuoJS/blob/d4c2c5e53ce5e18a0ea8a200d0b253e4669c0397/spec/3_element.coffee | 1 | 39 |
soyjavi/QuoJS:spec/3_element.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe("Style", function() {
var el;
el = void 0;
beforeEach(function() {
document.body.innerHTML = `<section class="quo" data-quo="js"></section>`;
return el = $$("section");
});
it("can get a attribute of a given element", function() {
var... | describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo" data-quo="js"></section>"""
el = $$ "section"
it "can get a attribute of a given element", ->
attribute = "class"
expect(el.attr attribute).toEqual "quo"
it "can set a attribute in a given ele... | JavaScript | CoffeeScript | soyjavi/QuoJS | spec/3_element.coffee | MIT | d4c2c5e53ce5e18a0ea8a200d0b253e4669c0397 | 2,055 | https://github.com/soyjavi/QuoJS/blob/d4c2c5e53ce5e18a0ea8a200d0b253e4669c0397/spec/3_element.coffee | 1 | 39 |
soyjavi/QuoJS:spec/3_element.coffee:1:completion | completion | describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo" data-quo="js"></section>"""
el = $$ "section"
it "can get a attribute of a given element", ->
attribute = "class"
expect(el.attr attribute).toEqual "quo"
it "can set a attribute in a given ele... | it "can remove a attribute in a given element", ->
attribute = "class"
el.removeAttr attribute
expect(el.attr attribute).toEqual null
it "can get a data attribute in a given element", ->
attribute = "quo"
expect(el.data attribute).toEqual "js"
it "can set a data attribute in a given element", ... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | spec/3_element.coffee | MIT | d4c2c5e53ce5e18a0ea8a200d0b253e4669c0397 | 2,055 | https://github.com/soyjavi/QuoJS/blob/d4c2c5e53ce5e18a0ea8a200d0b253e4669c0397/spec/3_element.coffee | 1 | 39 |
soyjavi/QuoJS:spec/3_element.coffee:1:raw_corpus | raw_corpus | describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo"></section>"""
el = $$ "section"
it "can get a attribute of a given element", ->
attribute = "class"
expect(el.attr attribute).toEqual "quo"
it "can set a attribute in a given element", ->
... | CoffeeScript | soyjavi/QuoJS | spec/3_element.coffee | MIT | 6d386d0ab6d2176ecbc2359f96c31a0ff98ee9ae | 2,055 | https://github.com/soyjavi/QuoJS/blob/6d386d0ab6d2176ecbc2359f96c31a0ff98ee9ae/spec/3_element.coffee | 1 | 23 | ||
soyjavi/QuoJS:spec/3_element.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo"></section>"""
el = $$ "section"
it "can get a attribute of a given element", ->
attribute = "class"
expect(el.attr attribute).toEqual "quo... | describe("Style", function() {
var el;
el = void 0;
beforeEach(function() {
document.body.innerHTML = `<section class="quo"></section>`;
return el = $$("section");
});
it("can get a attribute of a given element", function() {
var attribute;
attribute = "class";
return expect(el.attr(attrib... | CoffeeScript | JavaScript | soyjavi/QuoJS | spec/3_element.coffee | MIT | 6d386d0ab6d2176ecbc2359f96c31a0ff98ee9ae | 2,055 | https://github.com/soyjavi/QuoJS/blob/6d386d0ab6d2176ecbc2359f96c31a0ff98ee9ae/spec/3_element.coffee | 1 | 23 |
soyjavi/QuoJS:spec/3_element.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe("Style", function() {
var el;
el = void 0;
beforeEach(function() {
document.body.innerHTML = `<section class="quo"></section>`;
return el = $$("section");
});
it("can get a attribute of a given element", function() {
var attribute;
... | describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo"></section>"""
el = $$ "section"
it "can get a attribute of a given element", ->
attribute = "class"
expect(el.attr attribute).toEqual "quo"
it "can set a attribute in a given element", ->
... | JavaScript | CoffeeScript | soyjavi/QuoJS | spec/3_element.coffee | MIT | 6d386d0ab6d2176ecbc2359f96c31a0ff98ee9ae | 2,055 | https://github.com/soyjavi/QuoJS/blob/6d386d0ab6d2176ecbc2359f96c31a0ff98ee9ae/spec/3_element.coffee | 1 | 23 |
soyjavi/QuoJS:spec/3_element.coffee:1:completion | completion | describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo"></section>"""
el = $$ "section"
it "can get a attribute of a given element", ->
attribute = "class"
expect(el.attr attribute).toEqual "quo" | it "can set a attribute in a given element", ->
attribute = "data-framework"
value = "quojs"
el.attr attribute, value
expect(el.attr attribute).toEqual value
it "can remove a attribute in a given element", ->
attribute = "class"
el.removeAttr attribute
expect(el.attr attribute).toEqual n... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | spec/3_element.coffee | MIT | 6d386d0ab6d2176ecbc2359f96c31a0ff98ee9ae | 2,055 | https://github.com/soyjavi/QuoJS/blob/6d386d0ab6d2176ecbc2359f96c31a0ff98ee9ae/spec/3_element.coffee | 1 | 23 |
jianliaoim/talk-os:talk-web/client/module/no-mentions.coffee:1:raw_corpus | raw_corpus | React = require 'react'
PureRenderMixin = require 'react-addons-pure-render-mixin'
lang = require '../locales/lang'
{ div, span } = React.DOM
module.exports = React.createClass
displayName: 'no-mentions'
mixins: [PureRenderMixin]
render: ->
div className: 'no-mentions',
span className: 'ti ti-at'
... | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/no-mentions.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/no-mentions.coffee | 1 | 15 | ||
jianliaoim/talk-os:talk-web/client/module/no-mentions.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
React = require 'react'
PureRenderMixin = require 'react-addons-pure-render-mixin'
lang = require '../locales/lang'
{ div, span } = React.DOM
module.exports = React.createClass
displayName: 'no-mentions'
mixins: [PureRenderMixin]
render: ->
div clas... | var PureRenderMixin, React, div, lang, span;
React = require('react');
PureRenderMixin = require('react-addons-pure-render-mixin');
lang = require('../locales/lang');
({div, span} = React.DOM);
module.exports = React.createClass({
displayName: 'no-mentions',
mixins: [PureRenderMixin],
render: function() {
... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/module/no-mentions.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/no-mentions.coffee | 1 | 15 |
jianliaoim/talk-os:talk-web/client/module/no-mentions.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PureRenderMixin, React, div, lang, span;
React = require('react');
PureRenderMixin = require('react-addons-pure-render-mixin');
lang = require('../locales/lang');
({div, span} = React.DOM);
module.exports = React.createClass({
displayName: 'no-mentions',... | React = require 'react'
PureRenderMixin = require 'react-addons-pure-render-mixin'
lang = require '../locales/lang'
{ div, span } = React.DOM
module.exports = React.createClass
displayName: 'no-mentions'
mixins: [PureRenderMixin]
render: ->
div className: 'no-mentions',
span className: 'ti ti-at'
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/no-mentions.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/no-mentions.coffee | 1 | 15 |
jianliaoim/talk-os:talk-web/client/module/no-mentions.coffee:1:completion | completion | React = require 'react'
PureRenderMixin = require 'react-addons-pure-render-mixin'
lang = require '../locales/lang'
{ div, span } = React.DOM | module.exports = React.createClass
displayName: 'no-mentions'
mixins: [PureRenderMixin]
render: ->
div className: 'no-mentions',
span className: 'ti ti-at'
div className: 'message', lang.getText 'no-mentions' | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/no-mentions.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/no-mentions.coffee | 1 | 15 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:1:raw_corpus | raw_corpus | sortNotifications = (store, _teamId) ->
store.updateIn ['notifications', _teamId], (cursor) ->
if cursor
cursor
.sortBy reorder.byUpdatedAt
.sortBy reorder.isPinned
else
cursor | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 23 | 30 | ||
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
sortNotifications = (store, _teamId) ->
store.updateIn ['notifications', _teamId], (cursor) ->
if cursor
cursor
.sortBy reorder.byUpdatedAt
.sortBy reorder.isPinned
else
cursor
``` | var sortNotifications;
sortNotifications = function(store, _teamId) {
return store.updateIn(['notifications', _teamId], function(cursor) {
if (cursor) {
return cursor.sortBy(reorder.byUpdatedAt).sortBy(reorder.isPinned);
} else {
return cursor;
}
});
}; | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 23 | 30 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var sortNotifications;
sortNotifications = function(store, _teamId) {
return store.updateIn(['notifications', _teamId], function(cursor) {
if (cursor) {
return cursor.sortBy(reorder.byUpdatedAt).sortBy(reorder.isPinned);
} else {
return curso... | sortNotifications = (store, _teamId) ->
store.updateIn ['notifications', _teamId], (cursor) ->
if cursor
cursor
.sortBy reorder.byUpdatedAt
.sortBy reorder.isPinned
else
cursor | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 23 | 30 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:1:completion | completion | sortNotifications = (store, _teamId) ->
store.updateIn ['notifications', _teamId], (cursor) ->
if cursor
cursor | .sortBy reorder.byUpdatedAt
.sortBy reorder.isPinned
else
cursor | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 23 | 30 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:2:raw_corpus | raw_corpus | recountTeamUnread = (store, _teamId) ->
notifications = store.getIn(['notifications', _teamId])
if Immutable.List.isList(notifications)
teamUnreadInNotifications = notifications.reduce (sum, n) ->
unreadNum = if n.get('isMute') then 0 else n.get('unreadNum')
sum + unreadNum
, 0
store = store... | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 32 | 41 | ||
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
recountTeamUnread = (store, _teamId) ->
notifications = store.getIn(['notifications', _teamId])
if Immutable.List.isList(notifications)
teamUnreadInNotifications = notifications.reduce (sum, n) ->
unreadNum = if n.get('isMute') then 0 else n.get('un... | var recountTeamUnread;
recountTeamUnread = function(store, _teamId) {
var notifications, teamUnreadInNotifications;
notifications = store.getIn(['notifications', _teamId]);
if (Immutable.List.isList(notifications)) {
teamUnreadInNotifications = notifications.reduce(function(sum, n) {
var unreadNum;
... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 32 | 41 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var recountTeamUnread;
recountTeamUnread = function(store, _teamId) {
var notifications, teamUnreadInNotifications;
notifications = store.getIn(['notifications', _teamId]);
if (Immutable.List.isList(notifications)) {
teamUnreadInNotifications = notificat... | recountTeamUnread = (store, _teamId) ->
notifications = store.getIn(['notifications', _teamId])
if Immutable.List.isList(notifications)
teamUnreadInNotifications = notifications.reduce (sum, n) ->
unreadNum = if n.get('isMute') then 0 else n.get('unreadNum')
sum + unreadNum
, 0
store = store... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 32 | 41 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:2:completion | completion | recountTeamUnread = (store, _teamId) ->
notifications = store.getIn(['notifications', _teamId])
if Immutable.List.isList(notifications)
teamUnreadInNotifications = notifications.reduce (sum, n) ->
unreadNum = if n.get('isMute') then 0 else n.get('unreadNum') | sum + unreadNum
, 0
store = store.setIn ['teams', _teamId, 'unread'], teamUnreadInNotifications
else
store | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 32 | 41 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:3:raw_corpus | raw_corpus | exports.create = (store, notificationDatum) ->
_notyId = notificationDatum.get '_id'
_teamId = notificationDatum.get '_teamId'
store =
if store.hasIn [ 'notifications', _teamId ]
store
.updateIn [ 'notifications', _teamId ], (cursor) ->
inCollection = (item) -> item.get('_id') is _notyId
... | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 43 | 66 | ||
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.create = (store, notificationDatum) ->
_notyId = notificationDatum.get '_id'
_teamId = notificationDatum.get '_teamId'
store =
if store.hasIn [ 'notifications', _teamId ]
store
.updateIn [ 'notifications', _teamId ], (cursor) ->
... | exports.create = function(store, notificationDatum) {
var _notyId, _teamId, data;
_notyId = notificationDatum.get('_id');
_teamId = notificationDatum.get('_teamId');
store = store.hasIn(['notifications', _teamId]) ? store.updateIn(['notifications', _teamId], function(cursor) {
var existIndex, inCollection;
... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 43 | 66 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.create = function(store, notificationDatum) {
var _notyId, _teamId, data;
_notyId = notificationDatum.get('_id');
_teamId = notificationDatum.get('_teamId');
store = store.hasIn(['notifications', _teamId]) ? store.updateIn(['notifications', _teamId]... | exports.create = (store, notificationDatum) ->
_notyId = notificationDatum.get '_id'
_teamId = notificationDatum.get '_teamId'
store =
if store.hasIn [ 'notifications', _teamId ]
store
.updateIn [ 'notifications', _teamId ], (cursor) ->
inCollection = (item) -> item.get('_id') is _notyId
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 43 | 66 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:3:completion | completion | exports.create = (store, notificationDatum) ->
_notyId = notificationDatum.get '_id'
_teamId = notificationDatum.get '_teamId'
store =
if store.hasIn [ 'notifications', _teamId ]
store
.updateIn [ 'notifications', _teamId ], (cursor) ->
inCollection = (item) -> item.get('_id') is _notyId
... | cursor
.update existIndex, (item) ->
item.merge notificationDatum
else
cursor
.push notificationDatum
else
data = Immutable.List [ notificationDatum ]
store
.setIn [ 'notifications', _teamId ], data
sortNotifications(store, _teamId) | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 43 | 66 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:4:raw_corpus | raw_corpus | exports.read = (store, notificationsData) ->
_teamId = notificationsData.get '_teamId'
inTeam = _teamId is store.getIn(['device', '_teamId'])
data = notificationsData.get('data')
.filter refine.byNullTarget # 脏数据,旧数据中有可能没有target
store =
if data.size isnt 0
if store.hasIn ['notifications', _teamI... | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 68 | 96 | ||
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.read = (store, notificationsData) ->
_teamId = notificationsData.get '_teamId'
inTeam = _teamId is store.getIn(['device', '_teamId'])
data = notificationsData.get('data')
.filter refine.byNullTarget # 脏数据,旧数据中有可能没有target
store =
if data.... | exports.read = function(store, notificationsData) {
var _teamId, data, inTeam;
_teamId = notificationsData.get('_teamId');
inTeam = _teamId === store.getIn(['device', '_teamId']);
data = notificationsData.get('data').filter(refine.byNullTarget); // 脏数据,旧数据中有可能没有target
store = data.size !== 0 ? store.hasIn(['n... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 68 | 96 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.read = function(store, notificationsData) {
var _teamId, data, inTeam;
_teamId = notificationsData.get('_teamId');
inTeam = _teamId === store.getIn(['device', '_teamId']);
data = notificationsData.get('data').filter(refine.byNullTarget); // 脏数据,旧数据中... | exports.read = (store, notificationsData) ->
_teamId = notificationsData.get '_teamId'
inTeam = _teamId is store.getIn(['device', '_teamId'])
data = notificationsData.get('data')
.filter refine.byNullTarget # 脏数据,旧数据中有可能没有target
store =
if data.size isnt 0
if store.hasIn ['notifications', _teamI... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 68 | 96 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:4:completion | completion | exports.read = (store, notificationsData) ->
_teamId = notificationsData.get '_teamId'
inTeam = _teamId is store.getIn(['device', '_teamId'])
data = notificationsData.get('data')
.filter refine.byNullTarget # 脏数据,旧数据中有可能没有target
store =
if data.size isnt 0
if store.hasIn ['notifications', _teamI... | if existIndex is -1
cursor = cursor.push dataItem
else
cursor = cursor.update existIndex, (item) ->
item.merge(dataItem)
cursor
else
store.setIn ['notifications', _teamId], data
else
store
if inTeam
store = recountTeamUnrea... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 68 | 96 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:5:raw_corpus | raw_corpus | exports.update = (store, newNotification) ->
_id = newNotification.get '_id'
_teamId = newNotification.get '_teamId'
inTeam = _teamId is store.getIn(['device', '_teamId'])
store = store
.updateIn ['notifications', _teamId], (cursor) ->
if cursor and Immutable.List.isList(cursor)
index = curso... | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 98 | 134 | ||
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.update = (store, newNotification) ->
_id = newNotification.get '_id'
_teamId = newNotification.get '_teamId'
inTeam = _teamId is store.getIn(['device', '_teamId'])
store = store
.updateIn ['notifications', _teamId], (cursor) ->
if curso... | exports.update = function(store, newNotification) {
var _id, _teamId, inTeam;
_id = newNotification.get('_id');
_teamId = newNotification.get('_teamId');
inTeam = _teamId === store.getIn(['device', '_teamId']);
store = store.updateIn(['notifications', _teamId], function(cursor) {
var index;
if (cursor... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 98 | 134 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.update = function(store, newNotification) {
var _id, _teamId, inTeam;
_id = newNotification.get('_id');
_teamId = newNotification.get('_teamId');
inTeam = _teamId === store.getIn(['device', '_teamId']);
store = store.updateIn(['notifications', _te... | exports.update = (store, newNotification) ->
_id = newNotification.get '_id'
_teamId = newNotification.get '_teamId'
inTeam = _teamId is store.getIn(['device', '_teamId'])
store = store
.updateIn ['notifications', _teamId], (cursor) ->
if cursor and Immutable.List.isList(cursor)
index = curso... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 98 | 134 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:5:completion | completion | exports.update = (store, newNotification) ->
_id = newNotification.get '_id'
_teamId = newNotification.get '_teamId'
inTeam = _teamId is store.getIn(['device', '_teamId'])
store = store
.updateIn ['notifications', _teamId], (cursor) ->
if cursor and Immutable.List.isList(cursor)
index = curso... | .update 'teams', (cursor) ->
if cursor.has _teamId
cursor.updateIn [_teamId, 'unread'], (currentUnread) ->
currentUnread or= 0
if not newNotification.get('isMute')
oldUnreadNum = newNotification.get('oldUnreadNum')
unreadNum = newNotification.get('unreadNum')
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 98 | 134 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:6:raw_corpus | raw_corpus | exports.remove = (store, notificationsData) ->
_id = notificationsData.get('_id')
_teamId = notificationsData.get('_teamId')
inTeam = _teamId is store.getIn(['device', '_teamId'])
store = store
.updateIn ['notifications', _teamId], (cursor) ->
if cursor and Immutable.List.isList(cursor)
curso... | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 136 | 155 | ||
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.remove = (store, notificationsData) ->
_id = notificationsData.get('_id')
_teamId = notificationsData.get('_teamId')
inTeam = _teamId is store.getIn(['device', '_teamId'])
store = store
.updateIn ['notifications', _teamId], (cursor) ->
... | exports.remove = function(store, notificationsData) {
var _id, _teamId, inTeam;
_id = notificationsData.get('_id');
_teamId = notificationsData.get('_teamId');
inTeam = _teamId === store.getIn(['device', '_teamId']);
store = store.updateIn(['notifications', _teamId], function(cursor) {
if (cursor && Immut... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 136 | 155 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.remove = function(store, notificationsData) {
var _id, _teamId, inTeam;
_id = notificationsData.get('_id');
_teamId = notificationsData.get('_teamId');
inTeam = _teamId === store.getIn(['device', '_teamId']);
store = store.updateIn(['notifications... | exports.remove = (store, notificationsData) ->
_id = notificationsData.get('_id')
_teamId = notificationsData.get('_teamId')
inTeam = _teamId is store.getIn(['device', '_teamId'])
store = store
.updateIn ['notifications', _teamId], (cursor) ->
if cursor and Immutable.List.isList(cursor)
curso... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 136 | 155 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:6:completion | completion | exports.remove = (store, notificationsData) ->
_id = notificationsData.get('_id')
_teamId = notificationsData.get('_teamId')
inTeam = _teamId is store.getIn(['device', '_teamId'])
store = store
.updateIn ['notifications', _teamId], (cursor) ->
if cursor and Immutable.List.isList(cursor)
curso... | else
cursor
.updateIn ['teams', _teamId, 'unread'], (currentUnread) ->
currentUnread or= 0
Math.max(currentUnread - notificationsData.get('unreadNum'), 0)
if inTeam
store = recountTeamUnread(store, _teamId)
sortNotifications(store, _teamId) | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 136 | 155 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:7:raw_corpus | raw_corpus | exports.preClearTeamUnread = (store, noty) ->
store
.updateIn ['teams', noty.get('_teamId'), 'unread'], (currentUnread) ->
currentUnread or= 0
Math.max(currentUnread - noty.get('unreadNum'), 0) | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 157 | 161 | ||
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:7:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.preClearTeamUnread = (store, noty) ->
store
.updateIn ['teams', noty.get('_teamId'), 'unread'], (currentUnread) ->
currentUnread or= 0
Math.max(currentUnread - noty.get('unreadNum'), 0)
``` | exports.preClearTeamUnread = function(store, noty) {
return store.updateIn(['teams', noty.get('_teamId'), 'unread'], function(currentUnread) {
currentUnread || (currentUnread = 0);
return Math.max(currentUnread - noty.get('unreadNum'), 0);
});
}; | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 157 | 161 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:7:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.preClearTeamUnread = function(store, noty) {
return store.updateIn(['teams', noty.get('_teamId'), 'unread'], function(currentUnread) {
currentUnread || (currentUnread = 0);
return Math.max(currentUnread - noty.get('unreadNum'), 0);
});
};
``` | exports.preClearTeamUnread = (store, noty) ->
store
.updateIn ['teams', noty.get('_teamId'), 'unread'], (currentUnread) ->
currentUnread or= 0
Math.max(currentUnread - noty.get('unreadNum'), 0) | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 157 | 161 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:7:completion | completion | exports.preClearTeamUnread = (store, noty) ->
store | .updateIn ['teams', noty.get('_teamId'), 'unread'], (currentUnread) ->
currentUnread or= 0
Math.max(currentUnread - noty.get('unreadNum'), 0) | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 157 | 161 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:8:raw_corpus | raw_corpus | exports.postClearTeamUnread = (store, noty) ->
store
.updateIn ['teams', noty.get('_teamId'), 'unread'], (currentUnread) ->
currentUnread + noty.get('unreadNum') | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 163 | 166 | ||
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:8:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.postClearTeamUnread = (store, noty) ->
store
.updateIn ['teams', noty.get('_teamId'), 'unread'], (currentUnread) ->
currentUnread + noty.get('unreadNum')
``` | exports.postClearTeamUnread = function(store, noty) {
return store.updateIn(['teams', noty.get('_teamId'), 'unread'], function(currentUnread) {
return currentUnread + noty.get('unreadNum');
});
}; | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 163 | 166 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:8:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.postClearTeamUnread = function(store, noty) {
return store.updateIn(['teams', noty.get('_teamId'), 'unread'], function(currentUnread) {
return currentUnread + noty.get('unreadNum');
});
};
``` | exports.postClearTeamUnread = (store, noty) ->
store
.updateIn ['teams', noty.get('_teamId'), 'unread'], (currentUnread) ->
currentUnread + noty.get('unreadNum') | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 163 | 166 |
jianliaoim/talk-os:talk-web/client/updater/notification.coffee:8:completion | completion | exports.postClearTeamUnread = (store, noty) ->
store | .updateIn ['teams', noty.get('_teamId'), 'unread'], (currentUnread) ->
currentUnread + noty.get('unreadNum') | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notification.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notification.coffee | 163 | 166 |
jianliaoim/talk-os:talk-web/test/spec/updater/unread.spec.coffee:1:raw_corpus | raw_corpus | Immutable = require 'immutable'
describe 'Updater: unread', ->
beforeEach ->
@unread = require 'updater/unread'
it 'should define methods', ->
expect(@unread.check).toBeDefined()
describe 'method: check', ->
store = null
checkData = null
_teamId1 = _targetId1 = _targetId2 = unread1 = null
... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/updater/unread.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/unread.spec.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-web/test/spec/updater/unread.spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Immutable = require 'immutable'
describe 'Updater: unread', ->
beforeEach ->
@unread = require 'updater/unread'
it 'should define methods', ->
expect(@unread.check).toBeDefined()
describe 'method: check', ->
store = null
checkData = null... | var Immutable;
Immutable = require('immutable');
describe('Updater: unread', function() {
beforeEach(function() {
return this.unread = require('updater/unread');
});
it('should define methods', function() {
return expect(this.unread.check).toBeDefined();
});
return describe('method: check', function... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/test/spec/updater/unread.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/unread.spec.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/test/spec/updater/unread.spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Immutable;
Immutable = require('immutable');
describe('Updater: unread', function() {
beforeEach(function() {
return this.unread = require('updater/unread');
});
it('should define methods', function() {
return expect(this.unread.check).toBeDefin... | Immutable = require 'immutable'
describe 'Updater: unread', ->
beforeEach ->
@unread = require 'updater/unread'
it 'should define methods', ->
expect(@unread.check).toBeDefined()
describe 'method: check', ->
store = null
checkData = null
_teamId1 = _targetId1 = _targetId2 = unread1 = null
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/updater/unread.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/unread.spec.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/test/spec/updater/unread.spec.coffee:1:completion | completion | Immutable = require 'immutable'
describe 'Updater: unread', ->
beforeEach ->
@unread = require 'updater/unread'
it 'should define methods', ->
expect(@unread.check).toBeDefined()
describe 'method: check', ->
store = null
checkData = null
_teamId1 = _targetId1 = _targetId2 = unread1 = null
... | getStore = (_teamId, _targetId) ->
notifications = {}
notifications[_teamId] = [
{_targetId: _targetId, unreadNum: 0, isMute: false}
{_targetId: _targetId2, unreadNum: 0, isMute: true}
]
Immutable.fromJS
notifications: notifications
beforeEach ->
_teamId1 = '_t... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/updater/unread.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/unread.spec.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/test/spec/updater/unread.spec.coffee:2:raw_corpus | raw_corpus | expect(unreadNum).toBe unread1
it 'should update teams unread', ->
newStore = @unread.check(store, checkData)
teamUnread = newStore.getIn ['teams', _teamId1, 'unread']
expect(teamUnread).toBe unread1
it 'should not update team unread if notifications is muted', ->
checkData = checkData... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/updater/unread.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/unread.spec.coffee | 51 | 69 | ||
jianliaoim/talk-os:talk-web/test/spec/updater/unread.spec.coffee:2:completion | completion | expect(unreadNum).toBe unread1
it 'should update teams unread', ->
newStore = @unread.check(store, checkData)
teamUnread = newStore.getIn ['teams', _teamId1, 'unread']
expect(teamUnread).toBe unread1
it 'should not update team unread if notifications is muted', ->
checkData = checkData... | newStore = @unread.check(store, checkData)
teamUnread = newStore.getIn ['teams', _teamId1, 'unread']
expect(teamUnread).toBe unread1
it 'should clear unread if unread data is an empty object', ->
store = store.updateIn ['notifications', _teamId1], (notifications) ->
notifications.push Imm... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/updater/unread.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/unread.spec.coffee | 51 | 69 |
jianliaoim/talk-os:talk-web/client/guest-app/container.coffee:1:raw_corpus | raw_corpus | module.exports = React.createClass
displayName: 'app-container'
propTypes:
store: React.PropTypes.instanceOf(Immutable.Map).isRequired
core: React.PropTypes.object.isRequired
getInitialState: ->
showDevtools: false
path: Immutable.List()
componentDidMount: ->
window.addEventListener 'resi... | CoffeeScript | jianliaoim/talk-os | talk-web/client/guest-app/container.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/container.coffee | 17 | 66 | ||
jianliaoim/talk-os:talk-web/client/guest-app/container.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = React.createClass
displayName: 'app-container'
propTypes:
store: React.PropTypes.instanceOf(Immutable.Map).isRequired
core: React.PropTypes.object.isRequired
getInitialState: ->
showDevtools: false
path: Immutable.List()
... | module.exports = React.createClass({
displayName: 'app-container',
propTypes: {
store: React.PropTypes.instanceOf(Immutable.Map).isRequired,
core: React.PropTypes.object.isRequired
},
getInitialState: function() {
return {
showDevtools: false,
path: Immutable.List()
};
},
compone... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/guest-app/container.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/container.coffee | 17 | 66 |
jianliaoim/talk-os:talk-web/client/guest-app/container.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = React.createClass({
displayName: 'app-container',
propTypes: {
store: React.PropTypes.instanceOf(Immutable.Map).isRequired,
core: React.PropTypes.object.isRequired
},
getInitialState: function() {
return {
showDevtools: fa... | module.exports = React.createClass
displayName: 'app-container'
propTypes:
store: React.PropTypes.instanceOf(Immutable.Map).isRequired
core: React.PropTypes.object.isRequired
getInitialState: ->
showDevtools: false
path: Immutable.List()
componentDidMount: ->
window.addEventListener 'resi... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/guest-app/container.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/container.coffee | 17 | 66 |
jianliaoim/talk-os:talk-web/client/guest-app/container.coffee:1:completion | completion | module.exports = React.createClass
displayName: 'app-container'
propTypes:
store: React.PropTypes.instanceOf(Immutable.Map).isRequired
core: React.PropTypes.object.isRequired
getInitialState: ->
showDevtools: false
path: Immutable.List()
componentDidMount: ->
window.addEventListener 'resi... | onWindowKeydown: (event) ->
if (event.metaKey or event.ctrlKey) and event.shiftKey and keycode(event.keyCode) is 'a'
@setState showDevtools: not @state.showDevtools
event.preventDefault()
onSignup: (user) ->
@setState user: user
@joinRoom()
renderDevtools: ->
div className: 'devtools-l... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/guest-app/container.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/container.coffee | 17 | 66 |
jianliaoim/talk-os:talk-web/client/guest-app/container.coffee:2:raw_corpus | raw_corpus | div className: 'app-container',
switch router.get('name')
when 'home'
ContainerWireframe
sentence: loadingSentences.get(new Date())
when 'room'
TopicPage router: router, _teamId: _teamId, _roomId: _roomId
when 'disabled'
Disabled()
when 'si... | CoffeeScript | jianliaoim/talk-os | talk-web/client/guest-app/container.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/container.coffee | 67 | 84 | ||
jianliaoim/talk-os:talk-web/client/guest-app/container.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
div className: 'app-container',
switch router.get('name')
when 'home'
ContainerWireframe
sentence: loadingSentences.get(new Date())
when 'room'
TopicPage router: router, _teamId: _teamId, _roomId: _roomId
... | div({
className: 'app-container'
}, (function() {
switch (router.get('name')) {
case 'home':
return ContainerWireframe({
sentence: loadingSentences.get(new Date())
});
case 'room':
return TopicPage({
router: router,
_teamId: _teamId,
_roomId: _roomId
}... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/guest-app/container.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/container.coffee | 67 | 84 |
jianliaoim/talk-os:talk-web/client/guest-app/container.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
div({
className: 'app-container'
}, (function() {
switch (router.get('name')) {
case 'home':
return ContainerWireframe({
sentence: loadingSentences.get(new Date())
});
case 'room':
return TopicPage({
router: router,
... | div className: 'app-container',
switch router.get('name')
when 'home'
ContainerWireframe
sentence: loadingSentences.get(new Date())
when 'room'
TopicPage router: router, _teamId: _teamId, _roomId: _roomId
when 'disabled'
Disabled()
when 'si... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/guest-app/container.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/container.coffee | 67 | 84 |
jianliaoim/talk-os:talk-web/client/guest-app/container.coffee:2:completion | completion | div className: 'app-container',
switch router.get('name')
when 'home'
ContainerWireframe
sentence: loadingSentences.get(new Date())
when 'room'
TopicPage router: router, _teamId: _teamId, _roomId: _roomId
when 'disabled'
Disabled() | when 'signup'
AppSignup onSignup: @onSignup, topics: topics
when '404'
AppMissing()
else
AppMissing()
NotifyCenter router: router
if @state.showDevtools
@renderDevtools() | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/guest-app/container.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/container.coffee | 67 | 84 |
jianliaoim/talk-os:talk-web/client/module/icon.coffee:1:raw_corpus | raw_corpus | cx = require 'classnames'
React = require 'react'
assign = require 'object-assign'
PureRenderMixin = require 'react-addons-pure-render-mixin'
{ i } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'Icon'
mixins: [ PureRenderMixin ]
propTypes:
name: T.string.isRequired
si... | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/icon.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/icon.coffee | 1 | 43 | ||
jianliaoim/talk-os:talk-web/client/module/icon.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
cx = require 'classnames'
React = require 'react'
assign = require 'object-assign'
PureRenderMixin = require 'react-addons-pure-render-mixin'
{ i } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'Icon'
mixins: [ PureRenderM... | var PureRenderMixin, React, T, assign, cx, i;
cx = require('classnames');
React = require('react');
assign = require('object-assign');
PureRenderMixin = require('react-addons-pure-render-mixin');
({i} = React.DOM);
T = React.PropTypes;
module.exports = React.createClass({
displayName: 'Icon',
mixins: [PureRe... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/module/icon.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/icon.coffee | 1 | 43 |
jianliaoim/talk-os:talk-web/client/module/icon.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PureRenderMixin, React, T, assign, cx, i;
cx = require('classnames');
React = require('react');
assign = require('object-assign');
PureRenderMixin = require('react-addons-pure-render-mixin');
({i} = React.DOM);
T = React.PropTypes;
module.exports = React... | cx = require 'classnames'
React = require 'react'
assign = require 'object-assign'
PureRenderMixin = require 'react-addons-pure-render-mixin'
{ i } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'Icon'
mixins: [ PureRenderMixin ]
propTypes:
name: T.string.isRequired
si... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/icon.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/icon.coffee | 1 | 43 |
jianliaoim/talk-os:talk-web/client/module/icon.coffee:1:completion | completion | cx = require 'classnames'
React = require 'react'
assign = require 'object-assign'
PureRenderMixin = require 'react-addons-pure-render-mixin'
{ i } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'Icon'
mixins: [ PureRenderMixin ]
propTypes:
name: T.string.isRequired
si... | getDefaultProps: ->
size: 16
type: 'ti'
onClick: (->)
className: ''
getStyle: ->
assign {},
{ color: @props.color } if @props.color
{ fontSize: @props.size }
{ backgroundColor: @props.backgroundColor } if @props.backgroundColor
onClick: (event) ->
@props.onClick event
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/icon.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/icon.coffee | 1 | 43 |
abe33/atom-pigments:lib/paths-loader.coffee:1:raw_corpus | raw_corpus | Task = null
module.exports =
startTask: (config, callback) ->
Task ?= require('atom').Task
dirtied = []
removed = []
taskPath = require.resolve('./tasks/load-paths-handler')
task = Task.once(
taskPath,
config,
-> callback({dirtied, removed})
)
task.on 'load-paths:path... | CoffeeScript | abe33/atom-pigments | lib/paths-loader.coffee | MIT | 4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4 | 518 | https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/paths-loader.coffee | 1 | 20 | ||
abe33/atom-pigments:lib/paths-loader.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Task = null
module.exports =
startTask: (config, callback) ->
Task ?= require('atom').Task
dirtied = []
removed = []
taskPath = require.resolve('./tasks/load-paths-handler')
task = Task.once(
taskPath,
config,
-> callbac... | var Task;
Task = null;
module.exports = {
startTask: function(config, callback) {
var dirtied, removed, task, taskPath;
if (Task == null) {
Task = require('atom').Task;
}
dirtied = [];
removed = [];
taskPath = require.resolve('./tasks/load-paths-handler');
task = Task.once(taskPath... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/paths-loader.coffee | MIT | 4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4 | 518 | https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/paths-loader.coffee | 1 | 20 |
abe33/atom-pigments:lib/paths-loader.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Task;
Task = null;
module.exports = {
startTask: function(config, callback) {
var dirtied, removed, task, taskPath;
if (Task == null) {
Task = require('atom').Task;
}
dirtied = [];
removed = [];
taskPath = require.resolve('./ta... | Task = null
module.exports =
startTask: (config, callback) ->
Task ?= require('atom').Task
dirtied = []
removed = []
taskPath = require.resolve('./tasks/load-paths-handler')
task = Task.once(
taskPath,
config,
-> callback({dirtied, removed})
)
task.on 'load-paths:path... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/paths-loader.coffee | MIT | 4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4 | 518 | https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/paths-loader.coffee | 1 | 20 |
abe33/atom-pigments:lib/paths-loader.coffee:1:completion | completion | Task = null
module.exports =
startTask: (config, callback) ->
Task ?= require('atom').Task
dirtied = []
removed = []
taskPath = require.resolve('./tasks/load-paths-handler') | task = Task.once(
taskPath,
config,
-> callback({dirtied, removed})
)
task.on 'load-paths:paths-found', (paths) -> dirtied.push(paths...)
task.on 'load-paths:paths-lost', (paths) -> removed.push(paths...)
task | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/paths-loader.coffee | MIT | 4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4 | 518 | https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/paths-loader.coffee | 1 | 20 |
abe33/atom-pigments:lib/paths-loader.coffee:1:raw_corpus | raw_corpus | {Task} = require 'atom'
module.exports =
startTask: (config, callback) ->
dirtied = []
removed = []
taskPath = require.resolve('./tasks/load-paths-handler')
task = Task.once(
taskPath,
config,
-> callback({dirtied, removed})
)
task.on 'load-paths:paths-found', (paths) -> d... | CoffeeScript | abe33/atom-pigments | lib/paths-loader.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/paths-loader.coffee | 1 | 18 | ||
abe33/atom-pigments:lib/paths-loader.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{Task} = require 'atom'
module.exports =
startTask: (config, callback) ->
dirtied = []
removed = []
taskPath = require.resolve('./tasks/load-paths-handler')
task = Task.once(
taskPath,
config,
-> callback({dirtied, removed})
... | var Task;
({Task} = require('atom'));
module.exports = {
startTask: function(config, callback) {
var dirtied, removed, task, taskPath;
dirtied = [];
removed = [];
taskPath = require.resolve('./tasks/load-paths-handler');
task = Task.once(taskPath, config, function() {
return callback({dirt... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/paths-loader.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/paths-loader.coffee | 1 | 18 |
abe33/atom-pigments:lib/paths-loader.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Task;
({Task} = require('atom'));
module.exports = {
startTask: function(config, callback) {
var dirtied, removed, task, taskPath;
dirtied = [];
removed = [];
taskPath = require.resolve('./tasks/load-paths-handler');
task = Task.once(tas... | {Task} = require 'atom'
module.exports =
startTask: (config, callback) ->
dirtied = []
removed = []
taskPath = require.resolve('./tasks/load-paths-handler')
task = Task.once(
taskPath,
config,
-> callback({dirtied, removed})
)
task.on 'load-paths:paths-found', (paths) -> d... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/paths-loader.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/paths-loader.coffee | 1 | 18 |
abe33/atom-pigments:lib/paths-loader.coffee:1:completion | completion | {Task} = require 'atom'
module.exports =
startTask: (config, callback) ->
dirtied = []
removed = []
taskPath = require.resolve('./tasks/load-paths-handler')
task = Task.once( | taskPath,
config,
-> callback({dirtied, removed})
)
task.on 'load-paths:paths-found', (paths) -> dirtied.push(paths...)
task.on 'load-paths:paths-lost', (paths) -> removed.push(paths...)
task | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/paths-loader.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/paths-loader.coffee | 1 | 18 |
jianliaoim/talk-os:talk-api2x/server/controllers/group.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
Err = require 'err1st'
Promise = require 'bluebird'
logger = require 'graceful-logger'
limbo = require 'limbo'
app = require '../server'
{
GroupModel
} = limbo.use 'talk'
module.exports = groupController = app.controller 'group', ->
editableFields = ['addMembers', 'removeMembers', 'name']
... | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/controllers/group.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/group.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-api2x/server/controllers/group.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
Err = require 'err1st'
Promise = require 'bluebird'
logger = require 'graceful-logger'
limbo = require 'limbo'
app = require '../server'
{
GroupModel
} = limbo.use 'talk'
module.exports = groupController = app.controller 'group', ->
ed... | var Err, GroupModel, Promise, _, app, groupController, limbo, logger,
indexOf = [].indexOf;
_ = require('lodash');
Err = require('err1st');
Promise = require('bluebird');
logger = require('graceful-logger');
limbo = require('limbo');
app = require('../server');
({GroupModel} = limbo.use('talk'));
module.expor... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/server/controllers/group.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/group.coffee | 1 | 50 |
jianliaoim/talk-os:talk-api2x/server/controllers/group.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Err, GroupModel, Promise, _, app, groupController, limbo, logger,
indexOf = [].indexOf;
_ = require('lodash');
Err = require('err1st');
Promise = require('bluebird');
logger = require('graceful-logger');
limbo = require('limbo');
app = require('../serve... | _ = require 'lodash'
Err = require 'err1st'
Promise = require 'bluebird'
logger = require 'graceful-logger'
limbo = require 'limbo'
app = require '../server'
{
GroupModel
} = limbo.use 'talk'
module.exports = groupController = app.controller 'group', ->
editableFields = ['addMembers', 'removeMembers', 'name']
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/controllers/group.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/group.coffee | 1 | 50 |
jianliaoim/talk-os:talk-api2x/server/controllers/group.coffee:1:completion | completion | _ = require 'lodash'
Err = require 'err1st'
Promise = require 'bluebird'
logger = require 'graceful-logger'
limbo = require 'limbo'
app = require '../server'
{
GroupModel
} = limbo.use 'talk'
module.exports = groupController = app.controller 'group', ->
editableFields = ['addMembers', 'removeMembers', 'name']
... | @before 'editableGroup', only: 'update remove'
@action 'read', (req, res, callback) ->
{_teamId} = req.get()
GroupModel.find team: _teamId, callback
@action 'create', (req, res, callback) ->
options =
creator: req.get '_sessionUserId'
team: req.get '_teamId'
name: req.get 'name'
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/controllers/group.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/group.coffee | 1 | 50 |
jianliaoim/talk-os:talk-api2x/server/controllers/group.coffee:2:raw_corpus | raw_corpus | group[key] = val for key, val of update
group.socketId = req.get('socketId')
group.updatedAt = new Date
group.$save().nodeify callback
@action 'remove', (req, res, callback) ->
{group} = req.get()
group.socketId = req.get('socketId')
group.$remove().nodeify callback | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/controllers/group.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/group.coffee | 51 | 61 | ||
jianliaoim/talk-os:talk-api2x/server/controllers/group.coffee:2:completion | completion | group[key] = val for key, val of update
group.socketId = req.get('socketId')
group.updatedAt = new Date
group.$save().nodeify callback | @action 'remove', (req, res, callback) ->
{group} = req.get()
group.socketId = req.get('socketId')
group.$remove().nodeify callback | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/controllers/group.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/group.coffee | 51 | 61 |
Glavin001/atom-beautify:src/beautifiers/yapf.coffee:1:raw_corpus | raw_corpus | ###
Requires https://github.com/google/yapf
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Yapf extends Beautifier
name: "yapf"
link: "https://github.com/google/yapf"
isPreInstalled: false
options: {
Python: false
}
beautify: (text, language, options) ->
@run("yapf... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/yapf.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/yapf.coffee | 1 | 41 | ||
Glavin001/atom-beautify:src/beautifiers/yapf.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
Requires https://github.com/google/yapf
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Yapf extends Beautifier
name: "yapf"
link: "https://github.com/google/yapf"
isPreInstalled: false
options: {
Python: false
}... | /*
Requires https://github.com/google/yapf
*/
"use strict";
var Beautifier, Yapf;
Beautifier = require('./beautifier');
module.exports = Yapf = (function() {
class Yapf extends Beautifier {
beautify(text, language, options) {
var tempFile;
return this.run("yapf", ["-i", tempFile = this.tempFile("inp... | CoffeeScript | JavaScript | Glavin001/atom-beautify | src/beautifiers/yapf.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/yapf.coffee | 1 | 41 |
Glavin001/atom-beautify:src/beautifiers/yapf.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
Requires https://github.com/google/yapf
*/
"use strict";
var Beautifier, Yapf;
Beautifier = require('./beautifier');
module.exports = Yapf = (function() {
class Yapf extends Beautifier {
beautify(text, language, options) {
var tempFile;
retur... | ###
Requires https://github.com/google/yapf
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Yapf extends Beautifier
name: "yapf"
link: "https://github.com/google/yapf"
isPreInstalled: false
options: {
Python: false
}
beautify: (text, language, options) ->
@run("yapf... | JavaScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/yapf.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/yapf.coffee | 1 | 41 |
Glavin001/atom-beautify:src/beautifiers/yapf.coffee:1:completion | completion | ###
Requires https://github.com/google/yapf
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Yapf extends Beautifier
name: "yapf"
link: "https://github.com/google/yapf"
isPreInstalled: false
options: {
Python: false
}
beautify: (text, language, options) ->
@run("yapf... | tempFile = @tempFile("input", text)
], help: {
link: "https://github.com/google/yapf"
}, ignoreReturnCode: true)
.then(=>
if options.sort_imports
editor = atom.workspace.getActiveTextEditor()
filePath = editor.getPath()
projectPath = atom.project.relativiz... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/yapf.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/yapf.coffee | 1 | 41 |
Glavin001/atom-beautify:src/beautifiers/yapf.coffee:1:raw_corpus | raw_corpus | ###
Requires https://github.com/google/yapf
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Yapf extends Beautifier
name: "yapf"
link: "https://github.com/google/yapf"
isPreInstalled: false
options: {
Python: false
}
beautify: (text, language, options) ->
@run("yapf... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/yapf.coffee | MIT | ba2198675cbcc1ecd05f18e28e97133cdd2d5319 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/yapf.coffee | 1 | 37 | ||
Glavin001/atom-beautify:src/beautifiers/yapf.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
Requires https://github.com/google/yapf
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Yapf extends Beautifier
name: "yapf"
link: "https://github.com/google/yapf"
isPreInstalled: false
options: {
Python: false
}... | /*
Requires https://github.com/google/yapf
*/
"use strict";
var Beautifier, Yapf;
Beautifier = require('./beautifier');
module.exports = Yapf = (function() {
class Yapf extends Beautifier {
beautify(text, language, options) {
var tempFile;
return this.run("yapf", ["-i", tempFile = this.tempFile("inp... | CoffeeScript | JavaScript | Glavin001/atom-beautify | src/beautifiers/yapf.coffee | MIT | ba2198675cbcc1ecd05f18e28e97133cdd2d5319 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/yapf.coffee | 1 | 37 |
Glavin001/atom-beautify:src/beautifiers/yapf.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
Requires https://github.com/google/yapf
*/
"use strict";
var Beautifier, Yapf;
Beautifier = require('./beautifier');
module.exports = Yapf = (function() {
class Yapf extends Beautifier {
beautify(text, language, options) {
var tempFile;
retur... | ###
Requires https://github.com/google/yapf
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Yapf extends Beautifier
name: "yapf"
link: "https://github.com/google/yapf"
isPreInstalled: false
options: {
Python: false
}
beautify: (text, language, options) ->
@run("yapf... | JavaScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/yapf.coffee | MIT | ba2198675cbcc1ecd05f18e28e97133cdd2d5319 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/yapf.coffee | 1 | 37 |
Glavin001/atom-beautify:src/beautifiers/yapf.coffee:1:completion | completion | ###
Requires https://github.com/google/yapf
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Yapf extends Beautifier
name: "yapf"
link: "https://github.com/google/yapf"
isPreInstalled: false
options: {
Python: false
}
beautify: (text, language, options) -> | @run("yapf", [
"-i"
tempFile = @tempFile("input", text)
], help: {
link: "https://github.com/google/yapf"
}, ignoreReturnCode: true)
.then(=>
if options.sort_imports
@run("isort",
[tempFile],
help: {
link: "https://github.com/... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/yapf.coffee | MIT | ba2198675cbcc1ecd05f18e28e97133cdd2d5319 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/yapf.coffee | 1 | 37 |
Glavin001/atom-beautify:src/beautifiers/yapf.coffee:1:raw_corpus | raw_corpus | ###
Requires https://github.com/google/yapf
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Yapf extends Beautifier
name: "yapf"
link: "https://github.com/google/yapf"
options: {
Python: false
}
beautify: (text, language, options) ->
@run("yapf", [
"-i"
te... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/yapf.coffee | MIT | 2285525c641592ff84db30975f9bee0461dd9ee3 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/2285525c641592ff84db30975f9bee0461dd9ee3/src/beautifiers/yapf.coffee | 1 | 40 | ||
Glavin001/atom-beautify:src/beautifiers/yapf.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
Requires https://github.com/google/yapf
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Yapf extends Beautifier
name: "yapf"
link: "https://github.com/google/yapf"
options: {
Python: false
}
beautify: (text, lan... | /*
Requires https://github.com/google/yapf
*/
"use strict";
var Beautifier, Yapf;
Beautifier = require('./beautifier');
module.exports = Yapf = (function() {
class Yapf extends Beautifier {
beautify(text, language, options) {
var tempFile;
return this.run("yapf", ["-i", tempFile = this.tempFile("inp... | CoffeeScript | JavaScript | Glavin001/atom-beautify | src/beautifiers/yapf.coffee | MIT | 2285525c641592ff84db30975f9bee0461dd9ee3 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/2285525c641592ff84db30975f9bee0461dd9ee3/src/beautifiers/yapf.coffee | 1 | 40 |
Glavin001/atom-beautify:src/beautifiers/yapf.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
Requires https://github.com/google/yapf
*/
"use strict";
var Beautifier, Yapf;
Beautifier = require('./beautifier');
module.exports = Yapf = (function() {
class Yapf extends Beautifier {
beautify(text, language, options) {
var tempFile;
retur... | ###
Requires https://github.com/google/yapf
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Yapf extends Beautifier
name: "yapf"
link: "https://github.com/google/yapf"
options: {
Python: false
}
beautify: (text, language, options) ->
@run("yapf", [
"-i"
te... | JavaScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/yapf.coffee | MIT | 2285525c641592ff84db30975f9bee0461dd9ee3 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/2285525c641592ff84db30975f9bee0461dd9ee3/src/beautifiers/yapf.coffee | 1 | 40 |
Glavin001/atom-beautify:src/beautifiers/yapf.coffee:1:completion | completion | ###
Requires https://github.com/google/yapf
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Yapf extends Beautifier
name: "yapf"
link: "https://github.com/google/yapf"
options: {
Python: false
}
beautify: (text, language, options) ->
@run("yapf", [
"-i"
te... | ], help: {
link: "https://github.com/google/yapf"
}, ignoreReturnCode: true)
.then(=>
if options.sort_imports
editor = atom.workspace.getActiveTextEditor()
filePath = editor.getPath()
projectPath = atom.project.relativizePath(filePath)[0]
@run("isort"... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/yapf.coffee | MIT | 2285525c641592ff84db30975f9bee0461dd9ee3 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/2285525c641592ff84db30975f9bee0461dd9ee3/src/beautifiers/yapf.coffee | 1 | 40 |
jeremyramin/terminal-plus:lib/panel-view.coffee:1:raw_corpus | raw_corpus | defaultHeight = do ->
height = atom.config.get('terminal-plus.style.defaultPanelHeight')
if height.indexOf('%') > 0
percent = Math.abs(Math.min(parseFloat(height) / 100.0, 1))
bottomHeight = $('atom-panel.bottom').children(".terminal-view").height() or 0
height = percent * ($('.item-views').height() + b... | CoffeeScript | jeremyramin/terminal-plus | lib/panel-view.coffee | MIT | 1e555ee3a49902b203134072ff079ae580fdff10 | 478 | https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/lib/panel-view.coffee | 8 | 14 | ||
jeremyramin/terminal-plus:lib/panel-view.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
defaultHeight = do ->
height = atom.config.get('terminal-plus.style.defaultPanelHeight')
if height.indexOf('%') > 0
percent = Math.abs(Math.min(parseFloat(height) / 100.0, 1))
bottomHeight = $('atom-panel.bottom').children(".terminal-view").height() o... | var defaultHeight;
defaultHeight = (function() {
var bottomHeight, height, percent;
height = atom.config.get('terminal-plus.style.defaultPanelHeight');
if (height.indexOf('%') > 0) {
percent = Math.abs(Math.min(parseFloat(height) / 100.0, 1));
bottomHeight = $('atom-panel.bottom').children(".terminal-vie... | CoffeeScript | JavaScript | jeremyramin/terminal-plus | lib/panel-view.coffee | MIT | 1e555ee3a49902b203134072ff079ae580fdff10 | 478 | https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/lib/panel-view.coffee | 8 | 14 |
jeremyramin/terminal-plus:lib/panel-view.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var defaultHeight;
defaultHeight = (function() {
var bottomHeight, height, percent;
height = atom.config.get('terminal-plus.style.defaultPanelHeight');
if (height.indexOf('%') > 0) {
percent = Math.abs(Math.min(parseFloat(height) / 100.0, 1));
bottom... | defaultHeight = do ->
height = atom.config.get('terminal-plus.style.defaultPanelHeight')
if height.indexOf('%') > 0
percent = Math.abs(Math.min(parseFloat(height) / 100.0, 1))
bottomHeight = $('atom-panel.bottom').children(".terminal-view").height() or 0
height = percent * ($('.item-views').height() + b... | JavaScript | CoffeeScript | jeremyramin/terminal-plus | lib/panel-view.coffee | MIT | 1e555ee3a49902b203134072ff079ae580fdff10 | 478 | https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/lib/panel-view.coffee | 8 | 14 |
jeremyramin/terminal-plus:lib/panel-view.coffee:1:completion | completion | defaultHeight = do ->
height = atom.config.get('terminal-plus.style.defaultPanelHeight')
if height.indexOf('%') > 0 | percent = Math.abs(Math.min(parseFloat(height) / 100.0, 1))
bottomHeight = $('atom-panel.bottom').children(".terminal-view").height() or 0
height = percent * ($('.item-views').height() + bottomHeight)
return height | CoffeeScript | CoffeeScript | jeremyramin/terminal-plus | lib/panel-view.coffee | MIT | 1e555ee3a49902b203134072ff079ae580fdff10 | 478 | https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/lib/panel-view.coffee | 8 | 14 |
jeremyramin/terminal-plus:lib/panel-view.coffee:3:raw_corpus | raw_corpus | class PanelView extends TerminalView
animating: false
windowHeight: atom.getSize().height
@getFocusedTerminal: ->
return TerminalView.getFocusedTerminal()
initialize: (options) ->
super(options)
@addDefaultButtons()
@terminal.showIcon()
@updateName(@terminal.getName())
@attachResize... | CoffeeScript | jeremyramin/terminal-plus | lib/panel-view.coffee | MIT | 1e555ee3a49902b203134072ff079ae580fdff10 | 478 | https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/lib/panel-view.coffee | 17 | 66 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.