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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cdglabs/apparatus:src/Storage/Serializer.coffee:1:completion | completion | module.exports = class Serializer
constructor: (builtInObjects) ->
@builtIn = {}
for object in builtInObjects
id = Util.getId(object)
@builtIn[id] = object
# ===========================================================================
# Serialization
# ======================================... | else if _.isObject(value)
return referenceTo(value)
else
return value
jsonifyArray = (array) =>
return (jsonifyValue(childValue) for childValue in array)
referenceTo = (object) =>
id = Util.getId(object)
if !@builtIn[id] and !objects[id]
# We'll need to jsonify ... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | a5d0fda468599b02ead67939236e58b5e5f7133e | 1,052 | https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Storage/Serializer.coffee | 5 | 54 |
cdglabs/apparatus:src/Storage/Serializer.coffee:2:raw_corpus | raw_corpus | unless proto == Object.prototype
result.__proto = jsonifyValue(proto)
return result
root = jsonifyValue(rootValue)
return {objects, root}
# ===========================================================================
# Deserialization
# =====================================================... | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | a5d0fda468599b02ead67939236e58b5e5f7133e | 1,052 | https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Storage/Serializer.coffee | 55 | 104 | ||
cdglabs/apparatus:src/Storage/Serializer.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
unless proto == Object.prototype
result.__proto = jsonifyValue(proto)
return result
root = jsonifyValue(rootValue)
return {objects, root}
# ===========================================================================
# Deserialization
... | var root,
hasProp = {}.hasOwnProperty;
if (proto !== Object.prototype) {
result.__proto = jsonifyValue(proto);
}
return result;
root = jsonifyValue(rootValue);
return {objects, root};
({
// ===========================================================================
// Deserialization
// =================... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | a5d0fda468599b02ead67939236e58b5e5f7133e | 1,052 | https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Storage/Serializer.coffee | 55 | 104 |
cdglabs/apparatus:src/Storage/Serializer.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var root,
hasProp = {}.hasOwnProperty;
if (proto !== Object.prototype) {
result.__proto = jsonifyValue(proto);
}
return result;
root = jsonifyValue(rootValue);
return {objects, root};
({
// ================================================================... | unless proto == Object.prototype
result.__proto = jsonifyValue(proto)
return result
root = jsonifyValue(rootValue)
return {objects, root}
# ===========================================================================
# Deserialization
# =====================================================... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | a5d0fda468599b02ead67939236e58b5e5f7133e | 1,052 | https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Storage/Serializer.coffee | 55 | 104 |
cdglabs/apparatus:src/Storage/Serializer.coffee:2:completion | completion | unless proto == Object.prototype
result.__proto = jsonifyValue(proto)
return result
root = jsonifyValue(rootValue)
return {objects, root}
# ===========================================================================
# Deserialization
# =====================================================... | else
constructedObject = {}
return constructedObjects[id] = constructedObject
for own id, object of objects
constructObject(id)
# Assign key/values.
assignKeyValues = (id, spec) =>
constructedObject = constructedObjects[id]
for own key, value of spec
continue if key... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | a5d0fda468599b02ead67939236e58b5e5f7133e | 1,052 | https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Storage/Serializer.coffee | 55 | 104 |
cdglabs/apparatus:src/Storage/Serializer.coffee:3:raw_corpus | raw_corpus | for own id, object of objects
assignKeyValues(id, object)
return deref(root) | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | a5d0fda468599b02ead67939236e58b5e5f7133e | 1,052 | https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Storage/Serializer.coffee | 105 | 109 | ||
cdglabs/apparatus:src/Storage/Serializer.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
for own id, object of objects
assignKeyValues(id, object)
return deref(root)
``` | var id, object,
hasProp = {}.hasOwnProperty;
for (id in objects) {
if (!hasProp.call(objects, id)) continue;
object = objects[id];
assignKeyValues(id, object);
}
return deref(root); | CoffeeScript | JavaScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | a5d0fda468599b02ead67939236e58b5e5f7133e | 1,052 | https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Storage/Serializer.coffee | 105 | 109 |
cdglabs/apparatus:src/Storage/Serializer.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var id, object,
hasProp = {}.hasOwnProperty;
for (id in objects) {
if (!hasProp.call(objects, id)) continue;
object = objects[id];
assignKeyValues(id, object);
}
return deref(root);
``` | for own id, object of objects
assignKeyValues(id, object)
return deref(root) | JavaScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | a5d0fda468599b02ead67939236e58b5e5f7133e | 1,052 | https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Storage/Serializer.coffee | 105 | 109 |
cdglabs/apparatus:src/Storage/Serializer.coffee:1:raw_corpus | raw_corpus | module.exports = class Serializer
constructor: (builtInObjects) ->
@builtIn = {}
for object in builtInObjects
id = Util.getId(object)
@builtIn[id] = object
# ===========================================================================
# Serialization
# ======================================... | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | f2c16084be529baaad7b33c65c21a3375b4971e8 | 1,052 | https://github.com/cdglabs/apparatus/blob/f2c16084be529baaad7b33c65c21a3375b4971e8/src/Storage/Serializer.coffee | 5 | 54 | ||
cdglabs/apparatus:src/Storage/Serializer.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class Serializer
constructor: (builtInObjects) ->
@builtIn = {}
for object in builtInObjects
id = Util.getId(object)
@builtIn[id] = object
# ===========================================================================
#... | var Serializer,
hasProp = {}.hasOwnProperty;
module.exports = Serializer = class Serializer {
constructor(builtInObjects) {
var i, id, len, object;
this.builtIn = {};
for (i = 0, len = builtInObjects.length; i < len; i++) {
object = builtInObjects[i];
id = Util.getId(object);
this.bui... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | f2c16084be529baaad7b33c65c21a3375b4971e8 | 1,052 | https://github.com/cdglabs/apparatus/blob/f2c16084be529baaad7b33c65c21a3375b4971e8/src/Storage/Serializer.coffee | 5 | 54 |
cdglabs/apparatus:src/Storage/Serializer.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Serializer,
hasProp = {}.hasOwnProperty;
module.exports = Serializer = class Serializer {
constructor(builtInObjects) {
var i, id, len, object;
this.builtIn = {};
for (i = 0, len = builtInObjects.length; i < len; i++) {
object = builtInOb... | module.exports = class Serializer
constructor: (builtInObjects) ->
@builtIn = {}
for object in builtInObjects
id = Util.getId(object)
@builtIn[id] = object
# ===========================================================================
# Serialization
# ======================================... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | f2c16084be529baaad7b33c65c21a3375b4971e8 | 1,052 | https://github.com/cdglabs/apparatus/blob/f2c16084be529baaad7b33c65c21a3375b4971e8/src/Storage/Serializer.coffee | 5 | 54 |
cdglabs/apparatus:src/Storage/Serializer.coffee:1:completion | completion | module.exports = class Serializer
constructor: (builtInObjects) ->
@builtIn = {}
for object in builtInObjects
id = Util.getId(object)
@builtIn[id] = object
# ===========================================================================
# Serialization
# ======================================... | else if _.isObject(value)
return referenceTo(value)
else
return value
jsonifyArray = (array) =>
return jsonifyValue(childValue) for childValue in array
referenceTo = (object) =>
id = Util.getId(object)
if !@builtIn[id] and !objects[id]
# We'll need to jsonify th... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | f2c16084be529baaad7b33c65c21a3375b4971e8 | 1,052 | https://github.com/cdglabs/apparatus/blob/f2c16084be529baaad7b33c65c21a3375b4971e8/src/Storage/Serializer.coffee | 5 | 54 |
cdglabs/apparatus:src/Storage/Serializer.coffee:1:raw_corpus | raw_corpus | module.exports = class Serializer
constructor: (builtInObjects) ->
@builtIn = {}
for object in builtInObjects
id = Util.getId(object)
@builtIn[id] = object
# ===========================================================================
# Serialization
# ======================================... | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 01d0628f253632c227bb0a7fc7afac851870213f | 1,052 | https://github.com/cdglabs/apparatus/blob/01d0628f253632c227bb0a7fc7afac851870213f/src/Storage/Serializer.coffee | 5 | 54 | ||
cdglabs/apparatus:src/Storage/Serializer.coffee:1:completion | completion | module.exports = class Serializer
constructor: (builtInObjects) ->
@builtIn = {}
for object in builtInObjects
id = Util.getId(object)
@builtIn[id] = object
# ===========================================================================
# Serialization
# ======================================... | else if _.isObject(value)
if force
return jsonifyObject(value)
else
return referenceTo(value)
else
return value
jsonifyArray = (array) =>
return _.map array, (childValue) => jsonifyValue(childValue)
referenceTo = (object) =>
id = Util.getId(object)... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 01d0628f253632c227bb0a7fc7afac851870213f | 1,052 | https://github.com/cdglabs/apparatus/blob/01d0628f253632c227bb0a7fc7afac851870213f/src/Storage/Serializer.coffee | 5 | 54 |
cdglabs/apparatus:src/Storage/Serializer.coffee:2:raw_corpus | raw_corpus | result[key] = jsonifyValue(value)
# Annotate prototype.
proto = Object.getPrototypeOf(object)
unless proto == Object.prototype
result.__proto = jsonifyValue(proto)
return result
root = jsonifyValue(rootValue)
return {objects, root}
# =========================================... | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 01d0628f253632c227bb0a7fc7afac851870213f | 1,052 | https://github.com/cdglabs/apparatus/blob/01d0628f253632c227bb0a7fc7afac851870213f/src/Storage/Serializer.coffee | 55 | 104 | ||
cdglabs/apparatus:src/Storage/Serializer.coffee:2:completion | completion | result[key] = jsonifyValue(value)
# Annotate prototype.
proto = Object.getPrototypeOf(object)
unless proto == Object.prototype
result.__proto = jsonifyValue(proto)
return result
root = jsonifyValue(rootValue)
return {objects, root}
# =========================================... | proto = constructObject(protoRef.__ref)
constructedObject = Object.create(proto)
constructedObject.constructor?()
else
constructedObject = {}
return constructedObjects[id] = constructedObject
for own id, object of objects
constructObject(id)
# Assign key/values.
a... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 01d0628f253632c227bb0a7fc7afac851870213f | 1,052 | https://github.com/cdglabs/apparatus/blob/01d0628f253632c227bb0a7fc7afac851870213f/src/Storage/Serializer.coffee | 55 | 104 |
cdglabs/apparatus:src/Storage/Serializer.coffee:3:raw_corpus | raw_corpus | return _.mapObject value, deref
else
return value
for own id, object of objects
assignKeyValues(id, object)
return deref(root) | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 01d0628f253632c227bb0a7fc7afac851870213f | 1,052 | https://github.com/cdglabs/apparatus/blob/01d0628f253632c227bb0a7fc7afac851870213f/src/Storage/Serializer.coffee | 105 | 112 | ||
cdglabs/apparatus:src/Storage/Serializer.coffee:3:completion | completion | return _.mapObject value, deref
else
return value | for own id, object of objects
assignKeyValues(id, object)
return deref(root) | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 01d0628f253632c227bb0a7fc7afac851870213f | 1,052 | https://github.com/cdglabs/apparatus/blob/01d0628f253632c227bb0a7fc7afac851870213f/src/Storage/Serializer.coffee | 105 | 112 |
cdglabs/apparatus:src/Storage/Serializer.coffee:1:raw_corpus | raw_corpus | module.exports = Serializer = new class
constructor: ->
@builtIn = {} # id : Object
loadBuiltInObjects: (builtInObjects) ->
for object in builtInObjects
id = Util.getId(object)
@builtIn[id] = object
# ===========================================================================
# Serializat... | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 983655b7730b689a8b9eb59e2739b2a58402d881 | 1,052 | https://github.com/cdglabs/apparatus/blob/983655b7730b689a8b9eb59e2739b2a58402d881/src/Storage/Serializer.coffee | 5 | 54 | ||
cdglabs/apparatus:src/Storage/Serializer.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = Serializer = new class
constructor: ->
@builtIn = {} # id : Object
loadBuiltInObjects: (builtInObjects) ->
for object in builtInObjects
id = Util.getId(object)
@builtIn[id] = object
# =================================... | var Serializer;
module.exports = Serializer = new (class {
constructor() {
this.builtIn = {}; // id : Object
}
loadBuiltInObjects(builtInObjects) {
var i, id, len, object, results;
results = [];
for (i = 0, len = builtInObjects.length; i < len; i++) {
object = builtInObjects[i];
id =... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 983655b7730b689a8b9eb59e2739b2a58402d881 | 1,052 | https://github.com/cdglabs/apparatus/blob/983655b7730b689a8b9eb59e2739b2a58402d881/src/Storage/Serializer.coffee | 5 | 54 |
cdglabs/apparatus:src/Storage/Serializer.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Serializer;
module.exports = Serializer = new (class {
constructor() {
this.builtIn = {}; // id : Object
}
loadBuiltInObjects(builtInObjects) {
var i, id, len, object, results;
results = [];
for (i = 0, len = builtInObjects.length; i < l... | module.exports = Serializer = new class
constructor: ->
@builtIn = {} # id : Object
loadBuiltInObjects: (builtInObjects) ->
for object in builtInObjects
id = Util.getId(object)
@builtIn[id] = object
# ===========================================================================
# Serializat... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 983655b7730b689a8b9eb59e2739b2a58402d881 | 1,052 | https://github.com/cdglabs/apparatus/blob/983655b7730b689a8b9eb59e2739b2a58402d881/src/Storage/Serializer.coffee | 5 | 54 |
cdglabs/apparatus:src/Storage/Serializer.coffee:1:completion | completion | module.exports = Serializer = new class
constructor: ->
@builtIn = {} # id : Object
loadBuiltInObjects: (builtInObjects) ->
for object in builtInObjects
id = Util.getId(object)
@builtIn[id] = object
# ===========================================================================
# Serializat... | if _.isArray(value)
return jsonifyArray(value)
else if _.isObject(value)
if force
return jsonifyObject(value)
else
return referenceTo(value)
else
return value
jsonifyArray = (array) =>
return _.map array, (childValue) => jsonifyValue(childValue)... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 983655b7730b689a8b9eb59e2739b2a58402d881 | 1,052 | https://github.com/cdglabs/apparatus/blob/983655b7730b689a8b9eb59e2739b2a58402d881/src/Storage/Serializer.coffee | 5 | 54 |
cdglabs/apparatus:src/Storage/Serializer.coffee:2:raw_corpus | raw_corpus | for own key, value of object
if @shouldSerializeProperty(key, value)
result[key] = jsonifyValue(value)
# Annotate prototype.
proto = Object.getPrototypeOf(object)
unless proto == Object.prototype
result.__proto = jsonifyValue(proto)
return result
root = jsonifyValu... | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 983655b7730b689a8b9eb59e2739b2a58402d881 | 1,052 | https://github.com/cdglabs/apparatus/blob/983655b7730b689a8b9eb59e2739b2a58402d881/src/Storage/Serializer.coffee | 55 | 104 | ||
cdglabs/apparatus:src/Storage/Serializer.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
for own key, value of object
if @shouldSerializeProperty(key, value)
result[key] = jsonifyValue(value)
# Annotate prototype.
proto = Object.getPrototypeOf(object)
unless proto == Object.prototype
result.__proto = jsonif... | var key, proto, root, value,
hasProp = {}.hasOwnProperty;
for (key in object) {
if (!hasProp.call(object, key)) continue;
value = object[key];
if (this.shouldSerializeProperty(key, value)) {
result[key] = jsonifyValue(value);
}
}
// Annotate prototype.
proto = Object.getPrototypeOf(object);
if (proto !... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 983655b7730b689a8b9eb59e2739b2a58402d881 | 1,052 | https://github.com/cdglabs/apparatus/blob/983655b7730b689a8b9eb59e2739b2a58402d881/src/Storage/Serializer.coffee | 55 | 104 |
cdglabs/apparatus:src/Storage/Serializer.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var key, proto, root, value,
hasProp = {}.hasOwnProperty;
for (key in object) {
if (!hasProp.call(object, key)) continue;
value = object[key];
if (this.shouldSerializeProperty(key, value)) {
result[key] = jsonifyValue(value);
}
}
// Annotate prototy... | for own key, value of object
if @shouldSerializeProperty(key, value)
result[key] = jsonifyValue(value)
# Annotate prototype.
proto = Object.getPrototypeOf(object)
unless proto == Object.prototype
result.__proto = jsonifyValue(proto)
return result
root = jsonifyValu... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 983655b7730b689a8b9eb59e2739b2a58402d881 | 1,052 | https://github.com/cdglabs/apparatus/blob/983655b7730b689a8b9eb59e2739b2a58402d881/src/Storage/Serializer.coffee | 55 | 104 |
cdglabs/apparatus:src/Storage/Serializer.coffee:2:completion | completion | for own key, value of object
if @shouldSerializeProperty(key, value)
result[key] = jsonifyValue(value)
# Annotate prototype.
proto = Object.getPrototypeOf(object)
unless proto == Object.prototype
result.__proto = jsonifyValue(proto)
return result
root = jsonifyValu... | protoRef = objectJson.__proto
if protoRef
proto = constructObject(protoRef.__ref)
constructedObject = Object.create(proto)
constructedObject.constructor?()
else
constructedObject = {}
return constructedObjects[id] = constructedObject
for own id, object of objects
... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 983655b7730b689a8b9eb59e2739b2a58402d881 | 1,052 | https://github.com/cdglabs/apparatus/blob/983655b7730b689a8b9eb59e2739b2a58402d881/src/Storage/Serializer.coffee | 55 | 104 |
cdglabs/apparatus:src/Storage/Serializer.coffee:3:raw_corpus | raw_corpus | return @builtIn[id] ? constructedObjects[id]
else
return _.mapObject value, deref
else
return value
for own id, object of objects
assignKeyValues(id, object)
return deref(root) | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 983655b7730b689a8b9eb59e2739b2a58402d881 | 1,052 | https://github.com/cdglabs/apparatus/blob/983655b7730b689a8b9eb59e2739b2a58402d881/src/Storage/Serializer.coffee | 105 | 114 | ||
cdglabs/apparatus:src/Storage/Serializer.coffee:3:completion | completion | return @builtIn[id] ? constructedObjects[id]
else
return _.mapObject value, deref
else
return value | for own id, object of objects
assignKeyValues(id, object)
return deref(root) | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 983655b7730b689a8b9eb59e2739b2a58402d881 | 1,052 | https://github.com/cdglabs/apparatus/blob/983655b7730b689a8b9eb59e2739b2a58402d881/src/Storage/Serializer.coffee | 105 | 114 |
cdglabs/apparatus:src/Storage/Serializer.coffee:1:raw_corpus | raw_corpus | _ = require "underscore"
Util = require "../Util/Util"
module.exports = Serializer = new class
constructor: ->
@builtIn = {} # id : Object
loadBuiltInObjects: (builtInObjects) ->
for object in builtInObjects
id = Util.getId(object)
@builtIn[id] = object
shouldSerializeProperty: (key, va... | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 11218c102717eb11b075ad0a8cb86180c175c690 | 1,052 | https://github.com/cdglabs/apparatus/blob/11218c102717eb11b075ad0a8cb86180c175c690/src/Storage/Serializer.coffee | 1 | 50 | ||
cdglabs/apparatus:src/Storage/Serializer.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require "underscore"
Util = require "../Util/Util"
module.exports = Serializer = new class
constructor: ->
@builtIn = {} # id : Object
loadBuiltInObjects: (builtInObjects) ->
for object in builtInObjects
id = Util.getId(object)
@bui... | var Serializer, Util, _;
_ = require("underscore");
Util = require("../Util/Util");
module.exports = Serializer = new (class {
constructor() {
this.builtIn = {}; // id : Object
}
loadBuiltInObjects(builtInObjects) {
var i, id, len, object, results;
results = [];
for (i = 0, len = builtInObject... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 11218c102717eb11b075ad0a8cb86180c175c690 | 1,052 | https://github.com/cdglabs/apparatus/blob/11218c102717eb11b075ad0a8cb86180c175c690/src/Storage/Serializer.coffee | 1 | 50 |
cdglabs/apparatus:src/Storage/Serializer.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Serializer, Util, _;
_ = require("underscore");
Util = require("../Util/Util");
module.exports = Serializer = new (class {
constructor() {
this.builtIn = {}; // id : Object
}
loadBuiltInObjects(builtInObjects) {
var i, id, len, object, results... | _ = require "underscore"
Util = require "../Util/Util"
module.exports = Serializer = new class
constructor: ->
@builtIn = {} # id : Object
loadBuiltInObjects: (builtInObjects) ->
for object in builtInObjects
id = Util.getId(object)
@builtIn[id] = object
shouldSerializeProperty: (key, va... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 11218c102717eb11b075ad0a8cb86180c175c690 | 1,052 | https://github.com/cdglabs/apparatus/blob/11218c102717eb11b075ad0a8cb86180c175c690/src/Storage/Serializer.coffee | 1 | 50 |
cdglabs/apparatus:src/Storage/Serializer.coffee:1:completion | completion | _ = require "underscore"
Util = require "../Util/Util"
module.exports = Serializer = new class
constructor: ->
@builtIn = {} # id : Object
loadBuiltInObjects: (builtInObjects) ->
for object in builtInObjects
id = Util.getId(object)
@builtIn[id] = object
shouldSerializeProperty: (key, va... | jsonifyValue = (value, force=false) =>
if _.isArray(value)
return jsonifyArray(value)
else if _.isObject(value)
if force
return jsonifyObject(value)
else
return referenceTo(value)
else
return value
jsonifyArray = (array) =>
return _.map ar... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 11218c102717eb11b075ad0a8cb86180c175c690 | 1,052 | https://github.com/cdglabs/apparatus/blob/11218c102717eb11b075ad0a8cb86180c175c690/src/Storage/Serializer.coffee | 1 | 50 |
cdglabs/apparatus:src/Storage/Serializer.coffee:2:raw_corpus | raw_corpus | result = {}
# Annotate key/values.
for own key, value of object
if @shouldSerializeProperty(key, value)
result[key] = jsonifyValue(value)
# Annotate prototype.
proto = Object.getPrototypeOf(object)
unless proto == Object.prototype
result.__proto = jsonifyValue(pro... | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 11218c102717eb11b075ad0a8cb86180c175c690 | 1,052 | https://github.com/cdglabs/apparatus/blob/11218c102717eb11b075ad0a8cb86180c175c690/src/Storage/Serializer.coffee | 51 | 63 | ||
cdglabs/apparatus:src/Storage/Serializer.coffee:2:completion | completion | result = {}
# Annotate key/values.
for own key, value of object
if @shouldSerializeProperty(key, value)
result[key] = jsonifyValue(value)
# Annotate prototype. | proto = Object.getPrototypeOf(object)
unless proto == Object.prototype
result.__proto = jsonifyValue(proto)
return result
root = jsonifyValue(rootValue)
return {objects, root} | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Storage/Serializer.coffee | MIT | 11218c102717eb11b075ad0a8cb86180c175c690 | 1,052 | https://github.com/cdglabs/apparatus/blob/11218c102717eb11b075ad0a8cb86180c175c690/src/Storage/Serializer.coffee | 51 | 63 |
jianliaoim/talk-os:talk-web/client/updater/timeline.coffee:1:raw_corpus | raw_corpus | moment = require 'moment'
Immutable = require 'immutable'
exports.init = (store, data) ->
_teamId = data.get '_teamId'
createdAt = data.get 'createdAt'
currentAt = data.get 'currentAt'
diffYears = currentAt.getYear() - createdAt.getYear()
diffMonths = currentAt.getMonth() - createdAt.getMonth()
count = d... | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/timeline.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/timeline.coffee | 1 | 32 | ||
jianliaoim/talk-os:talk-web/client/updater/timeline.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
moment = require 'moment'
Immutable = require 'immutable'
exports.init = (store, data) ->
_teamId = data.get '_teamId'
createdAt = data.get 'createdAt'
currentAt = data.get 'currentAt'
diffYears = currentAt.getYear() - createdAt.getYear()
diffMonths =... | var Immutable, moment;
moment = require('moment');
Immutable = require('immutable');
exports.init = function(store, data) {
var _teamId, count, createdAt, currentAt, diffMonths, diffYears, results;
_teamId = data.get('_teamId');
createdAt = data.get('createdAt');
currentAt = data.get('currentAt');
diffYear... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/updater/timeline.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/timeline.coffee | 1 | 32 |
jianliaoim/talk-os:talk-web/client/updater/timeline.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Immutable, moment;
moment = require('moment');
Immutable = require('immutable');
exports.init = function(store, data) {
var _teamId, count, createdAt, currentAt, diffMonths, diffYears, results;
_teamId = data.get('_teamId');
createdAt = data.get('creat... | moment = require 'moment'
Immutable = require 'immutable'
exports.init = (store, data) ->
_teamId = data.get '_teamId'
createdAt = data.get 'createdAt'
currentAt = data.get 'currentAt'
diffYears = currentAt.getYear() - createdAt.getYear()
diffMonths = currentAt.getMonth() - createdAt.getMonth()
count = d... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/timeline.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/timeline.coffee | 1 | 32 |
jianliaoim/talk-os:talk-web/client/updater/timeline.coffee:1:completion | completion | moment = require 'moment'
Immutable = require 'immutable'
exports.init = (store, data) ->
_teamId = data.get '_teamId'
createdAt = data.get 'createdAt'
currentAt = data.get 'currentAt'
diffYears = currentAt.getYear() - createdAt.getYear()
diffMonths = currentAt.getMonth() - createdAt.getMonth()
count = d... | .groupBy (v) ->
v.year()
.map (v) ->
v.map (v) ->
Immutable.Map
value: v.endOf('month').valueOf()
display: v.format('MMM')
.reverse()
.reverse()
.reduce (r, v, k) ->
r.push Immutable.Map
display: moment().year(k).format('Y')
months: v
,... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/timeline.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/timeline.coffee | 1 | 32 |
linemanjs/lineman:test/spec-e2e/helpers/lineman-project.coffee:1:raw_corpus | raw_corpus | grunt = require('grunt')
global.linemanProject = module.exports =
addFile: (path, contents) ->
grunt.file.write(pathFor(path), contents)
removeFile: (path) ->
grunt.file.delete(pathFor(path))
pathFor = (path) ->
"#{lineman.projectPath()}/#{path}" | CoffeeScript | linemanjs/lineman | test/spec-e2e/helpers/lineman-project.coffee | MIT | 61d681532d9621e578d319c279006bbb728ece4b | 1,168 | https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-e2e/helpers/lineman-project.coffee | 1 | 11 | ||
linemanjs/lineman:test/spec-e2e/helpers/lineman-project.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
grunt = require('grunt')
global.linemanProject = module.exports =
addFile: (path, contents) ->
grunt.file.write(pathFor(path), contents)
removeFile: (path) ->
grunt.file.delete(pathFor(path))
pathFor = (path) ->
"#{lineman.projectPath()}/#{path}"... | var grunt, pathFor;
grunt = require('grunt');
global.linemanProject = module.exports = {
addFile: function(path, contents) {
return grunt.file.write(pathFor(path), contents);
},
removeFile: function(path) {
return grunt.file.delete(pathFor(path));
}
};
pathFor = function(path) {
return `${lineman.p... | CoffeeScript | JavaScript | linemanjs/lineman | test/spec-e2e/helpers/lineman-project.coffee | MIT | 61d681532d9621e578d319c279006bbb728ece4b | 1,168 | https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-e2e/helpers/lineman-project.coffee | 1 | 11 |
linemanjs/lineman:test/spec-e2e/helpers/lineman-project.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var grunt, pathFor;
grunt = require('grunt');
global.linemanProject = module.exports = {
addFile: function(path, contents) {
return grunt.file.write(pathFor(path), contents);
},
removeFile: function(path) {
return grunt.file.delete(pathFor(path));
... | grunt = require('grunt')
global.linemanProject = module.exports =
addFile: (path, contents) ->
grunt.file.write(pathFor(path), contents)
removeFile: (path) ->
grunt.file.delete(pathFor(path))
pathFor = (path) ->
"#{lineman.projectPath()}/#{path}" | JavaScript | CoffeeScript | linemanjs/lineman | test/spec-e2e/helpers/lineman-project.coffee | MIT | 61d681532d9621e578d319c279006bbb728ece4b | 1,168 | https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-e2e/helpers/lineman-project.coffee | 1 | 11 |
linemanjs/lineman:test/spec-e2e/helpers/lineman-project.coffee:1:completion | completion | grunt = require('grunt')
global.linemanProject = module.exports =
addFile: (path, contents) ->
grunt.file.write(pathFor(path), contents) | removeFile: (path) ->
grunt.file.delete(pathFor(path))
pathFor = (path) ->
"#{lineman.projectPath()}/#{path}" | CoffeeScript | CoffeeScript | linemanjs/lineman | test/spec-e2e/helpers/lineman-project.coffee | MIT | 61d681532d9621e578d319c279006bbb728ece4b | 1,168 | https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-e2e/helpers/lineman-project.coffee | 1 | 11 |
linemanjs/lineman:test/spec-e2e/helpers/lineman-project.coffee:1:raw_corpus | raw_corpus | grunt = require('grunt')
global.linemanProject = module.exports =
addFile: (path, contents, done) ->
grunt.file.write(pathFor(path), contents)
setTimeout ->
done()
, 1000 if done?
removeFile: (path, done) ->
grunt.file.delete(pathFor(path))
setTimeout ->
done()
, 1000 if done?
... | CoffeeScript | linemanjs/lineman | test/spec-e2e/helpers/lineman-project.coffee | MIT | ccf8a96f9d1d80460794d6dbef05d91b440ab067 | 1,168 | https://github.com/linemanjs/lineman/blob/ccf8a96f9d1d80460794d6dbef05d91b440ab067/test/spec-e2e/helpers/lineman-project.coffee | 1 | 17 | ||
linemanjs/lineman:test/spec-e2e/helpers/lineman-project.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
grunt = require('grunt')
global.linemanProject = module.exports =
addFile: (path, contents, done) ->
grunt.file.write(pathFor(path), contents)
setTimeout ->
done()
, 1000 if done?
removeFile: (path, done) ->
grunt.file.delete(pathFor(p... | var grunt, pathFor;
grunt = require('grunt');
global.linemanProject = module.exports = {
addFile: function(path, contents, done) {
grunt.file.write(pathFor(path), contents);
if (done != null) {
return setTimeout(function() {
return done();
}, 1000);
}
},
removeFile: function(path... | CoffeeScript | JavaScript | linemanjs/lineman | test/spec-e2e/helpers/lineman-project.coffee | MIT | ccf8a96f9d1d80460794d6dbef05d91b440ab067 | 1,168 | https://github.com/linemanjs/lineman/blob/ccf8a96f9d1d80460794d6dbef05d91b440ab067/test/spec-e2e/helpers/lineman-project.coffee | 1 | 17 |
linemanjs/lineman:test/spec-e2e/helpers/lineman-project.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var grunt, pathFor;
grunt = require('grunt');
global.linemanProject = module.exports = {
addFile: function(path, contents, done) {
grunt.file.write(pathFor(path), contents);
if (done != null) {
return setTimeout(function() {
return done();... | grunt = require('grunt')
global.linemanProject = module.exports =
addFile: (path, contents, done) ->
grunt.file.write(pathFor(path), contents)
setTimeout ->
done()
, 1000 if done?
removeFile: (path, done) ->
grunt.file.delete(pathFor(path))
setTimeout ->
done()
, 1000 if done?
... | JavaScript | CoffeeScript | linemanjs/lineman | test/spec-e2e/helpers/lineman-project.coffee | MIT | ccf8a96f9d1d80460794d6dbef05d91b440ab067 | 1,168 | https://github.com/linemanjs/lineman/blob/ccf8a96f9d1d80460794d6dbef05d91b440ab067/test/spec-e2e/helpers/lineman-project.coffee | 1 | 17 |
linemanjs/lineman:test/spec-e2e/helpers/lineman-project.coffee:1:completion | completion | grunt = require('grunt')
global.linemanProject = module.exports =
addFile: (path, contents, done) ->
grunt.file.write(pathFor(path), contents)
setTimeout ->
done()
, 1000 if done? | removeFile: (path, done) ->
grunt.file.delete(pathFor(path))
setTimeout ->
done()
, 1000 if done?
pathFor = (path) ->
"#{lineman.projectPath()}/#{path}" | CoffeeScript | CoffeeScript | linemanjs/lineman | test/spec-e2e/helpers/lineman-project.coffee | MIT | ccf8a96f9d1d80460794d6dbef05d91b440ab067 | 1,168 | https://github.com/linemanjs/lineman/blob/ccf8a96f9d1d80460794d6dbef05d91b440ab067/test/spec-e2e/helpers/lineman-project.coffee | 1 | 17 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:1:raw_corpus | raw_corpus | newTagger = (id, options) ->
$('body').append("<div id='#{id}' class='tagger'></div>")
$("##{id}").tags options
describe "Bootstrap Tags", ->
afterEach ->
$('.tagger').remove()
describe "when using readOnly", ->
beforeEach ->
@initTagData = ['one', 'two', 'three']
@tags = newTagger "tagg... | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | c92a11fded5f946509cda985f888d9a4b225b383 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c92a11fded5f946509cda985f888d9a4b225b383/spec/bootstrap-tags-spec.coffee | 1 | 50 | ||
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
newTagger = (id, options) ->
$('body').append("<div id='#{id}' class='tagger'></div>")
$("##{id}").tags options
describe "Bootstrap Tags", ->
afterEach ->
$('.tagger').remove()
describe "when using readOnly", ->
beforeEach ->
@initTagDat... | var newTagger;
newTagger = function(id, options) {
$('body').append(`<div id='${id}' class='tagger'></div>`);
return $(`#${id}`).tags(options);
};
describe("Bootstrap Tags", function() {
afterEach(function() {
return $('.tagger').remove();
});
describe("when using readOnly", function() {
beforeEach(... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | c92a11fded5f946509cda985f888d9a4b225b383 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c92a11fded5f946509cda985f888d9a4b225b383/spec/bootstrap-tags-spec.coffee | 1 | 50 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var newTagger;
newTagger = function(id, options) {
$('body').append(`<div id='${id}' class='tagger'></div>`);
return $(`#${id}`).tags(options);
};
describe("Bootstrap Tags", function() {
afterEach(function() {
return $('.tagger').remove();
});
descr... | newTagger = (id, options) ->
$('body').append("<div id='#{id}' class='tagger'></div>")
$("##{id}").tags options
describe "Bootstrap Tags", ->
afterEach ->
$('.tagger').remove()
describe "when using readOnly", ->
beforeEach ->
@initTagData = ['one', 'two', 'three']
@tags = newTagger "tagg... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | c92a11fded5f946509cda985f888d9a4b225b383 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c92a11fded5f946509cda985f888d9a4b225b383/spec/bootstrap-tags-spec.coffee | 1 | 50 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:1:completion | completion | newTagger = (id, options) ->
$('body').append("<div id='#{id}' class='tagger'></div>")
$("##{id}").tags options
describe "Bootstrap Tags", ->
afterEach ->
$('.tagger').remove()
describe "when using readOnly", ->
beforeEach ->
@initTagData = ['one', 'two', 'three']
@tags = newTagger "tagg... | @tags.removeTag('one')
expect(@tags.hasTag('one')).toBeTruthy()
it "can't rename tag", ->
@tags.renameTag('one', 'new name')
expect(@tags.hasTag('new name')).toBeFalsy()
expect(@tags.hasTag('one')).toBeTruthy()
it "can get the list of tags", ->
expect(@tags.getTags()).toEqual @in... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | c92a11fded5f946509cda985f888d9a4b225b383 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c92a11fded5f946509cda985f888d9a4b225b383/spec/bootstrap-tags-spec.coffee | 1 | 50 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:2:raw_corpus | raw_corpus | beforeEach ->
@initTagData = ['one', 'two', 'three']
@tags = newTagger "tagger",
tagData: @initTagData
it "can add tag", ->
tagLength = @tags.getTags().length
@tags.addTag('new tag')
expect(@tags.getTags().length).toEqual tagLength + 1
expect(@tags.hasTag('new tag')).toB... | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | c92a11fded5f946509cda985f888d9a4b225b383 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c92a11fded5f946509cda985f888d9a4b225b383/spec/bootstrap-tags-spec.coffee | 51 | 100 | ||
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
beforeEach ->
@initTagData = ['one', 'two', 'three']
@tags = newTagger "tagger",
tagData: @initTagData
it "can add tag", ->
tagLength = @tags.getTags().length
@tags.addTag('new tag')
expect(@tags.getTags().length).toEqua... | beforeEach(function() {
this.initTagData = ['one', 'two', 'three'];
return this.tags = newTagger("tagger", {
tagData: this.initTagData
});
});
it("can add tag", function() {
var tagLength;
tagLength = this.tags.getTags().length;
this.tags.addTag('new tag');
expect(this.tags.getTags().length).toEqual(... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | c92a11fded5f946509cda985f888d9a4b225b383 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c92a11fded5f946509cda985f888d9a4b225b383/spec/bootstrap-tags-spec.coffee | 51 | 100 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
beforeEach(function() {
this.initTagData = ['one', 'two', 'three'];
return this.tags = newTagger("tagger", {
tagData: this.initTagData
});
});
it("can add tag", function() {
var tagLength;
tagLength = this.tags.getTags().length;
this.tags.addTag('n... | beforeEach ->
@initTagData = ['one', 'two', 'three']
@tags = newTagger "tagger",
tagData: @initTagData
it "can add tag", ->
tagLength = @tags.getTags().length
@tags.addTag('new tag')
expect(@tags.getTags().length).toEqual tagLength + 1
expect(@tags.hasTag('new tag')).toB... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | c92a11fded5f946509cda985f888d9a4b225b383 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c92a11fded5f946509cda985f888d9a4b225b383/spec/bootstrap-tags-spec.coffee | 51 | 100 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:2:completion | completion | beforeEach ->
@initTagData = ['one', 'two', 'three']
@tags = newTagger "tagger",
tagData: @initTagData
it "can add tag", ->
tagLength = @tags.getTags().length
@tags.addTag('new tag')
expect(@tags.getTags().length).toEqual tagLength + 1
expect(@tags.hasTag('new tag')).toB... | it "can add tag with popover content", ->
@tags.addTagWithContent('new tag', 'new content')
tagsWithContent = @tags.getTagsWithContent()
console.log tagsWithContent
expect(tagsWithContent[tagsWithContent.length-1].content).toEqual 'new content'
it "can change the popover content for a tag",... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | c92a11fded5f946509cda985f888d9a4b225b383 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c92a11fded5f946509cda985f888d9a4b225b383/spec/bootstrap-tags-spec.coffee | 51 | 100 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:3:raw_corpus | raw_corpus | describe "when providing before/after adding/deleting callbacks", ->
describe "when adding tags", ->
it "calls beforeAddingTag before a tag is added, providing the tag as first parameter", ->
wasCalled = false
tagAdded = "not this"
tags = newTagger "tagger2",
be... | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | c92a11fded5f946509cda985f888d9a4b225b383 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c92a11fded5f946509cda985f888d9a4b225b383/spec/bootstrap-tags-spec.coffee | 101 | 150 | ||
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe "when providing before/after adding/deleting callbacks", ->
describe "when adding tags", ->
it "calls beforeAddingTag before a tag is added, providing the tag as first parameter", ->
wasCalled = false
tagAdded = "not t... | describe("when providing before/after adding/deleting callbacks", function() {
describe("when adding tags", function() {
it("calls beforeAddingTag before a tag is added, providing the tag as first parameter", function() {
var tagAdded, tags, wasCalled;
wasCalled = false;
tagAdded = "not this";
... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | c92a11fded5f946509cda985f888d9a4b225b383 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c92a11fded5f946509cda985f888d9a4b225b383/spec/bootstrap-tags-spec.coffee | 101 | 150 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe("when providing before/after adding/deleting callbacks", function() {
describe("when adding tags", function() {
it("calls beforeAddingTag before a tag is added, providing the tag as first parameter", function() {
var tagAdded, tags, wasCalled;
... | describe "when providing before/after adding/deleting callbacks", ->
describe "when adding tags", ->
it "calls beforeAddingTag before a tag is added, providing the tag as first parameter", ->
wasCalled = false
tagAdded = "not this"
tags = newTagger "tagger2",
be... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | c92a11fded5f946509cda985f888d9a4b225b383 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c92a11fded5f946509cda985f888d9a4b225b383/spec/bootstrap-tags-spec.coffee | 101 | 150 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:3:completion | completion | describe "when providing before/after adding/deleting callbacks", ->
describe "when adding tags", ->
it "calls beforeAddingTag before a tag is added, providing the tag as first parameter", ->
wasCalled = false
tagAdded = "not this"
tags = newTagger "tagger2",
be... | tags = newTagger "tagger2",
afterAddingTag: (tag) ->
wasCalled = true
tagAdded = tag
tags.addTag "this"
expect(wasCalled and tagAdded == "this").toBeTruthy()
describe "when deleting tags", ->
it "calls beforeDeletingTag before a tag is removed,... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | c92a11fded5f946509cda985f888d9a4b225b383 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c92a11fded5f946509cda985f888d9a4b225b383/spec/bootstrap-tags-spec.coffee | 101 | 150 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:4:raw_corpus | raw_corpus | expect(tags.getTags()).toEqual ["a", "b", "c"]
it "calls afterDeletingTag after a tag is removed, providing the tag as first parameter", ->
wasCalled = false
tags = newTagger "tagger2",
tagData: ["a", "b", "c"]
afterDeletingTag: (tag) ->
wasCalled = tru... | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | c92a11fded5f946509cda985f888d9a4b225b383 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c92a11fded5f946509cda985f888d9a4b225b383/spec/bootstrap-tags-spec.coffee | 151 | 189 | ||
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:4:completion | completion | expect(tags.getTags()).toEqual ["a", "b", "c"]
it "calls afterDeletingTag after a tag is removed, providing the tag as first parameter", ->
wasCalled = false
tags = newTagger "tagger2",
tagData: ["a", "b", "c"]
afterDeletingTag: (tag) ->
wasCalled = tru... | $('#tagger2').remove()
describe "when providing exclusion options", ->
it "can exclude tags via the excludes function option", ->
excludesFunction = (tag) ->
return false if tag.indexOf('foo') > -1
true
tags = newTagger "tagger2",
excludes: excludesFunction
... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | c92a11fded5f946509cda985f888d9a4b225b383 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c92a11fded5f946509cda985f888d9a4b225b383/spec/bootstrap-tags-spec.coffee | 151 | 189 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:1:raw_corpus | raw_corpus | describe "Bootstrap Tags", ->
describe "Read only tag system", ->
beforeEach ->
@$domElement = $('body').append '<div id="tagger" class="tag-list"><div class="tags"></div></div>'
@initTagData = ['one', 'two', 'three']
@tags = $('#tagger', @$domElement).tags
tagData: @initTagData
... | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 660edd86cdb28765ef353476d0b394ae7c032ed3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/660edd86cdb28765ef353476d0b394ae7c032ed3/spec/bootstrap-tags-spec.coffee | 1 | 39 | ||
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe "Bootstrap Tags", ->
describe "Read only tag system", ->
beforeEach ->
@$domElement = $('body').append '<div id="tagger" class="tag-list"><div class="tags"></div></div>'
@initTagData = ['one', 'two', 'three']
@tags = $('#tagger'... | describe("Bootstrap Tags", function() {
describe("Read only tag system", function() {
beforeEach(function() {
this.$domElement = $('body').append('<div id="tagger" class="tag-list"><div class="tags"></div></div>');
this.initTagData = ['one', 'two', 'three'];
return this.tags = $('#tagger', this.... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 660edd86cdb28765ef353476d0b394ae7c032ed3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/660edd86cdb28765ef353476d0b394ae7c032ed3/spec/bootstrap-tags-spec.coffee | 1 | 39 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe("Bootstrap Tags", function() {
describe("Read only tag system", function() {
beforeEach(function() {
this.$domElement = $('body').append('<div id="tagger" class="tag-list"><div class="tags"></div></div>');
this.initTagData = ['one', 'two'... | describe "Bootstrap Tags", ->
describe "Read only tag system", ->
beforeEach ->
@$domElement = $('body').append '<div id="tagger" class="tag-list"><div class="tags"></div></div>'
@initTagData = ['one', 'two', 'three']
@tags = $('#tagger', @$domElement).tags
tagData: @initTagData
... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 660edd86cdb28765ef353476d0b394ae7c032ed3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/660edd86cdb28765ef353476d0b394ae7c032ed3/spec/bootstrap-tags-spec.coffee | 1 | 39 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:1:completion | completion | describe "Bootstrap Tags", ->
describe "Read only tag system", ->
beforeEach ->
@$domElement = $('body').append '<div id="tagger" class="tag-list"><div class="tags"></div></div>'
@initTagData = ['one', 'two', 'three']
@tags = $('#tagger', @$domElement).tags
tagData: @initTagData
... | it "can't remove tags", ->
tagLength = @tags.getTags().length
@tags.removeTag('one')
expect(@tags.hasTag('one')).toBeTruthy()
it "can't rename tag", ->
@tags.renameTag('one', 'new name')
expect(@tags.hasTag('new name')).toBeFalsy()
expect(@tags.hasTag('one')).toBeTruthy()
i... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 660edd86cdb28765ef353476d0b394ae7c032ed3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/660edd86cdb28765ef353476d0b394ae7c032ed3/spec/bootstrap-tags-spec.coffee | 1 | 39 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:2:raw_corpus | raw_corpus | afterEach ->
$('#tagger').remove()
it "can add tag", ->
tagLength = @tags.getTags().length
@tags.addTag('new tag')
expect(@tags.getTags().length).toEqual tagLength + 1
expect(@tags.hasTag('new tag')).toBeTruthy()
it "can get the list of tags", ->
expect(@tags.getTags()).toE... | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 660edd86cdb28765ef353476d0b394ae7c032ed3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/660edd86cdb28765ef353476d0b394ae7c032ed3/spec/bootstrap-tags-spec.coffee | 41 | 90 | ||
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
afterEach ->
$('#tagger').remove()
it "can add tag", ->
tagLength = @tags.getTags().length
@tags.addTag('new tag')
expect(@tags.getTags().length).toEqual tagLength + 1
expect(@tags.hasTag('new tag')).toBeTruthy()
it "can ge... | afterEach(function() {
return $('#tagger').remove();
});
it("can add tag", function() {
var tagLength;
tagLength = this.tags.getTags().length;
this.tags.addTag('new tag');
expect(this.tags.getTags().length).toEqual(tagLength + 1);
return expect(this.tags.hasTag('new tag')).toBeTruthy();
});
it("can get th... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 660edd86cdb28765ef353476d0b394ae7c032ed3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/660edd86cdb28765ef353476d0b394ae7c032ed3/spec/bootstrap-tags-spec.coffee | 41 | 90 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
afterEach(function() {
return $('#tagger').remove();
});
it("can add tag", function() {
var tagLength;
tagLength = this.tags.getTags().length;
this.tags.addTag('new tag');
expect(this.tags.getTags().length).toEqual(tagLength + 1);
return expect(this.ta... | afterEach ->
$('#tagger').remove()
it "can add tag", ->
tagLength = @tags.getTags().length
@tags.addTag('new tag')
expect(@tags.getTags().length).toEqual tagLength + 1
expect(@tags.hasTag('new tag')).toBeTruthy()
it "can get the list of tags", ->
expect(@tags.getTags()).toE... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 660edd86cdb28765ef353476d0b394ae7c032ed3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/660edd86cdb28765ef353476d0b394ae7c032ed3/spec/bootstrap-tags-spec.coffee | 41 | 90 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:2:completion | completion | afterEach ->
$('#tagger').remove()
it "can add tag", ->
tagLength = @tags.getTags().length
@tags.addTag('new tag')
expect(@tags.getTags().length).toEqual tagLength + 1
expect(@tags.hasTag('new tag')).toBeTruthy()
it "can get the list of tags", ->
expect(@tags.getTags()).toE... | tagsWithContent = @tags.getTagsWithContent()
console.log tagsWithContent
expect(tagsWithContent[tagsWithContent.length-1].content).toEqual 'new content'
it "can change the popover content for a tag", ->
content = 'new tag content for the first tag'
@tags.setPopover('one', content)
exp... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 660edd86cdb28765ef353476d0b394ae7c032ed3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/660edd86cdb28765ef353476d0b394ae7c032ed3/spec/bootstrap-tags-spec.coffee | 41 | 90 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:3:raw_corpus | raw_corpus | tags = $('#tagger2', @$domElement).tags
tagData: @initTagData
beforeAddingTag: beforeAddingTag
afterAddingTag: afterAddingTag
beforeDeletingTag: beforeDeletingTag
afterDeletingTag: afterDeletingTag
expect(beforeAddingTag and afterAddingTag and beforeDeletingTag and afterDel... | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 660edd86cdb28765ef353476d0b394ae7c032ed3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/660edd86cdb28765ef353476d0b394ae7c032ed3/spec/bootstrap-tags-spec.coffee | 91 | 98 | ||
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
tags = $('#tagger2', @$domElement).tags
tagData: @initTagData
beforeAddingTag: beforeAddingTag
afterAddingTag: afterAddingTag
beforeDeletingTag: beforeDeletingTag
afterDeletingTag: afterDeletingTag
expect(beforeAdding... | var tags;
tags = $('#tagger2', this.$domElement).tags({
tagData: this.initTagData,
beforeAddingTag: beforeAddingTag,
afterAddingTag: afterAddingTag,
beforeDeletingTag: beforeDeletingTag,
afterDeletingTag: afterDeletingTag
});
expect(beforeAddingTag && afterAddingTag && beforeDeletingTag && afterDeletingTag)... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 660edd86cdb28765ef353476d0b394ae7c032ed3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/660edd86cdb28765ef353476d0b394ae7c032ed3/spec/bootstrap-tags-spec.coffee | 91 | 98 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var tags;
tags = $('#tagger2', this.$domElement).tags({
tagData: this.initTagData,
beforeAddingTag: beforeAddingTag,
afterAddingTag: afterAddingTag,
beforeDeletingTag: beforeDeletingTag,
afterDeletingTag: afterDeletingTag
});
expect(beforeAddingTag && a... | tags = $('#tagger2', @$domElement).tags
tagData: @initTagData
beforeAddingTag: beforeAddingTag
afterAddingTag: afterAddingTag
beforeDeletingTag: beforeDeletingTag
afterDeletingTag: afterDeletingTag
expect(beforeAddingTag and afterAddingTag and beforeDeletingTag and afterDel... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 660edd86cdb28765ef353476d0b394ae7c032ed3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/660edd86cdb28765ef353476d0b394ae7c032ed3/spec/bootstrap-tags-spec.coffee | 91 | 98 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:3:completion | completion | tags = $('#tagger2', @$domElement).tags
tagData: @initTagData
beforeAddingTag: beforeAddingTag
afterAddingTag: afterAddingTag | beforeDeletingTag: beforeDeletingTag
afterDeletingTag: afterDeletingTag
expect(beforeAddingTag and afterAddingTag and beforeDeletingTag and afterDeletingTag).toBeTruthy()
$('#tagger2').remove() | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 660edd86cdb28765ef353476d0b394ae7c032ed3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/660edd86cdb28765ef353476d0b394ae7c032ed3/spec/bootstrap-tags-spec.coffee | 91 | 98 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:4:raw_corpus | raw_corpus | it "can exclude tags via the excludes function option", ->
$domElement = $('body').append '<div id="tagger2" class="tag-list"><div class="tags"></div></div>'
excludesFunction = (tag) ->
return false if tag.indexOf('foo') > -1
true
tags = $('#tagger2', @$domElement).tags
exclude... | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 660edd86cdb28765ef353476d0b394ae7c032ed3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/660edd86cdb28765ef353476d0b394ae7c032ed3/spec/bootstrap-tags-spec.coffee | 100 | 109 | ||
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it "can exclude tags via the excludes function option", ->
$domElement = $('body').append '<div id="tagger2" class="tag-list"><div class="tags"></div></div>'
excludesFunction = (tag) ->
return false if tag.indexOf('foo') > -1
true
... | it("can exclude tags via the excludes function option", function() {
var $domElement, excludesFunction, tags;
$domElement = $('body').append('<div id="tagger2" class="tag-list"><div class="tags"></div></div>');
excludesFunction = function(tag) {
if (tag.indexOf('foo') > -1) {
return false;
}
ret... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 660edd86cdb28765ef353476d0b394ae7c032ed3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/660edd86cdb28765ef353476d0b394ae7c032ed3/spec/bootstrap-tags-spec.coffee | 100 | 109 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it("can exclude tags via the excludes function option", function() {
var $domElement, excludesFunction, tags;
$domElement = $('body').append('<div id="tagger2" class="tag-list"><div class="tags"></div></div>');
excludesFunction = function(tag) {
if (tag.i... | it "can exclude tags via the excludes function option", ->
$domElement = $('body').append '<div id="tagger2" class="tag-list"><div class="tags"></div></div>'
excludesFunction = (tag) ->
return false if tag.indexOf('foo') > -1
true
tags = $('#tagger2', @$domElement).tags
exclude... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 660edd86cdb28765ef353476d0b394ae7c032ed3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/660edd86cdb28765ef353476d0b394ae7c032ed3/spec/bootstrap-tags-spec.coffee | 100 | 109 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:4:completion | completion | it "can exclude tags via the excludes function option", ->
$domElement = $('body').append '<div id="tagger2" class="tag-list"><div class="tags"></div></div>'
excludesFunction = (tag) ->
return false if tag.indexOf('foo') > -1
true | tags = $('#tagger2', @$domElement).tags
excludes: excludesFunction
tags.addTag('foo').addTag('bar').addTag('baz').addTag('foobarbaz')
expect(tags.getTags()).toEqual ['foo', 'foobarbaz']
$('#tagger2').remove() | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 660edd86cdb28765ef353476d0b394ae7c032ed3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/660edd86cdb28765ef353476d0b394ae7c032ed3/spec/bootstrap-tags-spec.coffee | 100 | 109 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:1:raw_corpus | raw_corpus | describe "Bootstrap Tags", ->
describe "Read only tag system", ->
beforeEach ->
@$domElement = $('body').append '<div id="tagger" class="tag-list"><div class="tags"></div></div>'
@initTagData = ['one', 'two', 'three']
@tags = $('#tagger', @$domElement).tags
tagData: @initTagData
... | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 958388738939210779e6174fba2b348bda5b288b | 543 | https://github.com/maxwells/bootstrap-tags/blob/958388738939210779e6174fba2b348bda5b288b/spec/bootstrap-tags-spec.coffee | 1 | 50 | ||
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe "Bootstrap Tags", ->
describe "Read only tag system", ->
beforeEach ->
@$domElement = $('body').append '<div id="tagger" class="tag-list"><div class="tags"></div></div>'
@initTagData = ['one', 'two', 'three']
@tags = $('#tagger'... | describe("Bootstrap Tags", function() {
describe("Read only tag system", function() {
beforeEach(function() {
this.$domElement = $('body').append('<div id="tagger" class="tag-list"><div class="tags"></div></div>');
this.initTagData = ['one', 'two', 'three'];
return this.tags = $('#tagger', this.... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 958388738939210779e6174fba2b348bda5b288b | 543 | https://github.com/maxwells/bootstrap-tags/blob/958388738939210779e6174fba2b348bda5b288b/spec/bootstrap-tags-spec.coffee | 1 | 50 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe("Bootstrap Tags", function() {
describe("Read only tag system", function() {
beforeEach(function() {
this.$domElement = $('body').append('<div id="tagger" class="tag-list"><div class="tags"></div></div>');
this.initTagData = ['one', 'two'... | describe "Bootstrap Tags", ->
describe "Read only tag system", ->
beforeEach ->
@$domElement = $('body').append '<div id="tagger" class="tag-list"><div class="tags"></div></div>'
@initTagData = ['one', 'two', 'three']
@tags = $('#tagger', @$domElement).tags
tagData: @initTagData
... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 958388738939210779e6174fba2b348bda5b288b | 543 | https://github.com/maxwells/bootstrap-tags/blob/958388738939210779e6174fba2b348bda5b288b/spec/bootstrap-tags-spec.coffee | 1 | 50 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:1:completion | completion | describe "Bootstrap Tags", ->
describe "Read only tag system", ->
beforeEach ->
@$domElement = $('body').append '<div id="tagger" class="tag-list"><div class="tags"></div></div>'
@initTagData = ['one', 'two', 'three']
@tags = $('#tagger', @$domElement).tags
tagData: @initTagData
... | @tags.renameTag('one', 'new name')
expect(@tags.hasTag('new name')).toBeFalsy()
expect(@tags.hasTag('one')).toBeTruthy()
it "can get the list of tags", ->
expect(@tags.getTags()).toEqual @initTagData
describe "Full tag system", ->
beforeEach ->
@$domElement = $('body').append '<div ... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 958388738939210779e6174fba2b348bda5b288b | 543 | https://github.com/maxwells/bootstrap-tags/blob/958388738939210779e6174fba2b348bda5b288b/spec/bootstrap-tags-spec.coffee | 1 | 50 |
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:2:raw_corpus | raw_corpus | expect(@tags.getTags()).toEqual @initTagData
it "can remove tag, specified by string", ->
expect(@tags.hasTag('one')).toBeTruthy()
@tags.removeTag('one')
expect(@tags.hasTag('one')).toBeFalsy()
it "can remove the last tag", ->
tagList = @tags.getTags()
lastTag = tagList[tagList.l... | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 958388738939210779e6174fba2b348bda5b288b | 543 | https://github.com/maxwells/bootstrap-tags/blob/958388738939210779e6174fba2b348bda5b288b/spec/bootstrap-tags-spec.coffee | 51 | 78 | ||
maxwells/bootstrap-tags:spec/bootstrap-tags-spec.coffee:2:completion | completion | expect(@tags.getTags()).toEqual @initTagData
it "can remove tag, specified by string", ->
expect(@tags.hasTag('one')).toBeTruthy()
@tags.removeTag('one')
expect(@tags.hasTag('one')).toBeFalsy()
it "can remove the last tag", ->
tagList = @tags.getTags()
lastTag = tagList[tagList.l... | @tags.addTagWithContent('new tag', 'new content')
tagsWithContent = @tags.getTagsWithContent()
console.log tagsWithContent
expect(tagsWithContent[tagsWithContent.length-1].content).toEqual 'new content'
it "can change the popover content for a tag", ->
content = 'new tag content for the fir... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | spec/bootstrap-tags-spec.coffee | MIT | 958388738939210779e6174fba2b348bda5b288b | 543 | https://github.com/maxwells/bootstrap-tags/blob/958388738939210779e6174fba2b348bda5b288b/spec/bootstrap-tags-spec.coffee | 51 | 78 |
gss/engine:src/domains/Linear.coffee:1:raw_corpus | raw_corpus | class Linear extends Domain
priority: 0
Solver: c
setup: () ->
super
unless @solver
@solver = new c.SimplexSolver()
@solver.autoSolve = false
@solver._store = []
if @console.level > 2
c.debug = true
c.trace = true
c.Strength.require = c.Strength.required
... | CoffeeScript | gss/engine | src/domains/Linear.coffee | MIT | 0d8461e55d1aa2d2da9bebe951e437f0a32fade1 | 2,854 | https://github.com/gss/engine/blob/0d8461e55d1aa2d2da9bebe951e437f0a32fade1/src/domains/Linear.coffee | 6 | 55 | ||
gss/engine:src/domains/Linear.coffee:1:completion | completion | class Linear extends Domain
priority: 0
Solver: c
setup: () ->
super
unless @solver
@solver = new c.SimplexSolver()
@solver.autoSolve = false
@solver._store = []
if @console.level > 2
c.debug = true
c.trace = true
c.Strength.require = c.Strength.required
... | @suggested = undefined
@solver.resolve()
return @solver._changed
unedit: (variable) ->
if constraint = @editing?['%' + (variable.name || variable)]
#@solver.removeConstraint(constraint)
cei = @solver._editVarMap.get(constraint.variable)
@solver.removeColumn(cei.editMinus)
@sol... | CoffeeScript | CoffeeScript | gss/engine | src/domains/Linear.coffee | MIT | 0d8461e55d1aa2d2da9bebe951e437f0a32fade1 | 2,854 | https://github.com/gss/engine/blob/0d8461e55d1aa2d2da9bebe951e437f0a32fade1/src/domains/Linear.coffee | 6 | 55 |
gss/engine:src/domains/Linear.coffee:2:raw_corpus | raw_corpus | variable.value = 0
#if full
#@solver.rows.delete(variable)
suggest: (path, value, strength, weight, continuation) ->
if typeof path == 'string'
unless variable = @variables[path]
variable = @Variable::declare(@, path)
else
variable = path
@edit(variable, strength, weight, con... | CoffeeScript | gss/engine | src/domains/Linear.coffee | MIT | 0d8461e55d1aa2d2da9bebe951e437f0a32fade1 | 2,854 | https://github.com/gss/engine/blob/0d8461e55d1aa2d2da9bebe951e437f0a32fade1/src/domains/Linear.coffee | 56 | 84 | ||
gss/engine:src/domains/Linear.coffee:2:completion | completion | variable.value = 0
#if full
#@solver.rows.delete(variable)
suggest: (path, value, strength, weight, continuation) ->
if typeof path == 'string'
unless variable = @variables[path]
variable = @Variable::declare(@, path)
else
variable = path
@edit(variable, strength, weight, con... | @suggested = true
return variable
variable: (name) ->
return new c.Variable name: name
strength: (strength, byDefault = 'medium') ->
return strength && c.Strength[strength] || c.Strength[byDefault]
weight: (weight, operation) ->
#if index = operation?.parent[0].index
# return index / 1000
... | CoffeeScript | CoffeeScript | gss/engine | src/domains/Linear.coffee | MIT | 0d8461e55d1aa2d2da9bebe951e437f0a32fade1 | 2,854 | https://github.com/gss/engine/blob/0d8461e55d1aa2d2da9bebe951e437f0a32fade1/src/domains/Linear.coffee | 56 | 84 |
gss/engine:src/domains/Linear.coffee:3:raw_corpus | raw_corpus | Linear.Mixin =
yield: (result, engine, operation, continuation, scope, ascender) ->
if typeof result == 'number'
return operation.parent.domain.suggest('%' + operation.command.toExpression(operation), result, 'require')
Linear::Constraint = Constraint.extend {
before: (args, engine, operation, continua... | CoffeeScript | gss/engine | src/domains/Linear.coffee | MIT | 0d8461e55d1aa2d2da9bebe951e437f0a32fade1 | 2,854 | https://github.com/gss/engine/blob/0d8461e55d1aa2d2da9bebe951e437f0a32fade1/src/domains/Linear.coffee | 85 | 134 | ||
gss/engine:src/domains/Linear.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Linear.Mixin =
yield: (result, engine, operation, continuation, scope, ascender) ->
if typeof result == 'number'
return operation.parent.domain.suggest('%' + operation.command.toExpression(operation), result, 'require')
Linear::Constraint = Constrai... | Linear.Mixin = {
yield: function(result, engine, operation, continuation, scope, ascender) {
if (typeof result === 'number') {
return operation.parent.domain.suggest('%' + operation.command.toExpression(operation), result, 'require');
}
}
};
Linear.prototype.Constraint = Constraint.extend({
before:... | CoffeeScript | JavaScript | gss/engine | src/domains/Linear.coffee | MIT | 0d8461e55d1aa2d2da9bebe951e437f0a32fade1 | 2,854 | https://github.com/gss/engine/blob/0d8461e55d1aa2d2da9bebe951e437f0a32fade1/src/domains/Linear.coffee | 85 | 134 |
gss/engine:src/domains/Linear.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Linear.Mixin = {
yield: function(result, engine, operation, continuation, scope, ascender) {
if (typeof result === 'number') {
return operation.parent.domain.suggest('%' + operation.command.toExpression(operation), result, 'require');
}
}
};
Line... | Linear.Mixin =
yield: (result, engine, operation, continuation, scope, ascender) ->
if typeof result == 'number'
return operation.parent.domain.suggest('%' + operation.command.toExpression(operation), result, 'require')
Linear::Constraint = Constraint.extend {
before: (args, engine, operation, continua... | JavaScript | CoffeeScript | gss/engine | src/domains/Linear.coffee | MIT | 0d8461e55d1aa2d2da9bebe951e437f0a32fade1 | 2,854 | https://github.com/gss/engine/blob/0d8461e55d1aa2d2da9bebe951e437f0a32fade1/src/domains/Linear.coffee | 85 | 134 |
gss/engine:src/domains/Linear.coffee:3:completion | completion | Linear.Mixin =
yield: (result, engine, operation, continuation, scope, ascender) ->
if typeof result == 'number'
return operation.parent.domain.suggest('%' + operation.command.toExpression(operation), result, 'require')
Linear::Constraint = Constraint.extend {
before: (args, engine, operation, continua... | eject: (engine, constraint) ->
engine.solver.removeConstraint(constraint)
},
'==': (left, right, strength, weight, engine, operation) ->
return new c.Equation(left, right, engine.strength(strength), engine.weight(weight, operation))
'<=': (left, right, strength, weight, engine, operation) ->
return ne... | CoffeeScript | CoffeeScript | gss/engine | src/domains/Linear.coffee | MIT | 0d8461e55d1aa2d2da9bebe951e437f0a32fade1 | 2,854 | https://github.com/gss/engine/blob/0d8461e55d1aa2d2da9bebe951e437f0a32fade1/src/domains/Linear.coffee | 85 | 134 |
gss/engine:src/domains/Linear.coffee:4:raw_corpus | raw_corpus | Linear::Variable.Expression = Variable.Expression.extend Linear.Mixin,
'+': (left, right) ->
return c.plus(left, right)
'-': (left, right) ->
return c.minus(left, right)
'*': (left, right) ->
return c.times(left, right)
'/': (left, right) ->
return c.divide(left, right)
# Handle constraints... | CoffeeScript | gss/engine | src/domains/Linear.coffee | MIT | 0d8461e55d1aa2d2da9bebe951e437f0a32fade1 | 2,854 | https://github.com/gss/engine/blob/0d8461e55d1aa2d2da9bebe951e437f0a32fade1/src/domains/Linear.coffee | 135 | 184 | ||
gss/engine:src/domains/Linear.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Linear::Variable.Expression = Variable.Expression.extend Linear.Mixin,
'+': (left, right) ->
return c.plus(left, right)
'-': (left, right) ->
return c.minus(left, right)
'*': (left, right) ->
return c.times(left, right)
'/': (left, right) ... | var splice = [].splice;
Linear.prototype.Variable.Expression = Variable.Expression.extend(Linear.Mixin, {
'+': function(left, right) {
return c.plus(left, right);
},
'-': function(left, right) {
return c.minus(left, right);
},
'*': function(left, right) {
return c.times(left, right);
},
'/': ... | CoffeeScript | JavaScript | gss/engine | src/domains/Linear.coffee | MIT | 0d8461e55d1aa2d2da9bebe951e437f0a32fade1 | 2,854 | https://github.com/gss/engine/blob/0d8461e55d1aa2d2da9bebe951e437f0a32fade1/src/domains/Linear.coffee | 135 | 184 |
gss/engine:src/domains/Linear.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var splice = [].splice;
Linear.prototype.Variable.Expression = Variable.Expression.extend(Linear.Mixin, {
'+': function(left, right) {
return c.plus(left, right);
},
'-': function(left, right) {
return c.minus(left, right);
},
'*': function(left,... | Linear::Variable.Expression = Variable.Expression.extend Linear.Mixin,
'+': (left, right) ->
return c.plus(left, right)
'-': (left, right) ->
return c.minus(left, right)
'*': (left, right) ->
return c.times(left, right)
'/': (left, right) ->
return c.divide(left, right)
# Handle constraints... | JavaScript | CoffeeScript | gss/engine | src/domains/Linear.coffee | MIT | 0d8461e55d1aa2d2da9bebe951e437f0a32fade1 | 2,854 | https://github.com/gss/engine/blob/0d8461e55d1aa2d2da9bebe951e437f0a32fade1/src/domains/Linear.coffee | 135 | 184 |
gss/engine:src/domains/Linear.coffee:4:completion | completion | Linear::Variable.Expression = Variable.Expression.extend Linear.Mixin,
'+': (left, right) ->
return c.plus(left, right)
'-': (left, right) ->
return c.minus(left, right)
'*': (left, right) ->
return c.times(left, right)
'/': (left, right) ->
return c.divide(left, right)
# Handle constraints... | [
operation[1].command.solve(engine, operation[1], '', undefined, undefined, operation[0])
engine,
operation
]
Linear::Stay = Command.extend {
signature: [
value: ['Variable']
]
},
stay: (value, engine, operation) ->
engine.suggested = true
engine.solver.addStay(value)
... | CoffeeScript | CoffeeScript | gss/engine | src/domains/Linear.coffee | MIT | 0d8461e55d1aa2d2da9bebe951e437f0a32fade1 | 2,854 | https://github.com/gss/engine/blob/0d8461e55d1aa2d2da9bebe951e437f0a32fade1/src/domains/Linear.coffee | 135 | 184 |
gss/engine:src/domains/Linear.coffee:6:raw_corpus | raw_corpus | Linear.hack = ->
unless c.isUnordered?
obj = {10: 1, 9: 1}
for property of obj
break
if c.isUnordered = (property > 9)
set = c.HashTable.prototype.set
c.HashTable.prototype.set = ->
if !@_store.push
store = @_store
@_store = []
for property of store
... | CoffeeScript | gss/engine | src/domains/Linear.coffee | MIT | 0d8461e55d1aa2d2da9bebe951e437f0a32fade1 | 2,854 | https://github.com/gss/engine/blob/0d8461e55d1aa2d2da9bebe951e437f0a32fade1/src/domains/Linear.coffee | 189 | 203 | ||
gss/engine:src/domains/Linear.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Linear.hack = ->
unless c.isUnordered?
obj = {10: 1, 9: 1}
for property of obj
break
if c.isUnordered = (property > 9)
set = c.HashTable.prototype.set
c.HashTable.prototype.set = ->
if !@_store.push
store = @_stor... | Linear.hack = function() {
var obj, property, set;
if (c.isUnordered == null) {
obj = {
10: 1,
9: 1
};
for (property in obj) {
break;
}
if (c.isUnordered = property > 9) {
set = c.HashTable.prototype.set;
return c.HashTable.prototype.set = function() {
var s... | CoffeeScript | JavaScript | gss/engine | src/domains/Linear.coffee | MIT | 0d8461e55d1aa2d2da9bebe951e437f0a32fade1 | 2,854 | https://github.com/gss/engine/blob/0d8461e55d1aa2d2da9bebe951e437f0a32fade1/src/domains/Linear.coffee | 189 | 203 |
gss/engine:src/domains/Linear.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Linear.hack = function() {
var obj, property, set;
if (c.isUnordered == null) {
obj = {
10: 1,
9: 1
};
for (property in obj) {
break;
}
if (c.isUnordered = property > 9) {
set = c.HashTable.prototype.set;
return... | Linear.hack = ->
unless c.isUnordered?
obj = {10: 1, 9: 1}
for property of obj
break
if c.isUnordered = (property > 9)
set = c.HashTable.prototype.set
c.HashTable.prototype.set = ->
if !@_store.push
store = @_store
@_store = []
for property of store
... | JavaScript | CoffeeScript | gss/engine | src/domains/Linear.coffee | MIT | 0d8461e55d1aa2d2da9bebe951e437f0a32fade1 | 2,854 | https://github.com/gss/engine/blob/0d8461e55d1aa2d2da9bebe951e437f0a32fade1/src/domains/Linear.coffee | 189 | 203 |
gss/engine:src/domains/Linear.coffee:6:completion | completion | Linear.hack = ->
unless c.isUnordered?
obj = {10: 1, 9: 1}
for property of obj
break
if c.isUnordered = (property > 9)
set = c.HashTable.prototype.set | c.HashTable.prototype.set = ->
if !@_store.push
store = @_store
@_store = []
for property of store
@_store[property] = store[property]
return set.apply(@, arguments) | CoffeeScript | CoffeeScript | gss/engine | src/domains/Linear.coffee | MIT | 0d8461e55d1aa2d2da9bebe951e437f0a32fade1 | 2,854 | https://github.com/gss/engine/blob/0d8461e55d1aa2d2da9bebe951e437f0a32fade1/src/domains/Linear.coffee | 189 | 203 |
gss/engine:src/domains/Linear.coffee:1:raw_corpus | raw_corpus | class Linear extends Domain
priority: 0
Solver: require('cassowary')
setup: () ->
super
unless @solver
@solver = new c.SimplexSolver()
@solver.autoSolve = false
@solver._store = []
if @console.level > 2
c.debug = true
c.trace = true
c.Strength.require = c.S... | CoffeeScript | gss/engine | src/domains/Linear.coffee | MIT | fbe4b4a9d1baf5edd4f1f809ed2b2824e3d23864 | 2,854 | https://github.com/gss/engine/blob/fbe4b4a9d1baf5edd4f1f809ed2b2824e3d23864/src/domains/Linear.coffee | 6 | 55 | ||
gss/engine:src/domains/Linear.coffee:1:completion | completion | class Linear extends Domain
priority: 0
Solver: require('cassowary')
setup: () ->
super
unless @solver
@solver = new c.SimplexSolver()
@solver.autoSolve = false
@solver._store = []
if @console.level > 2
c.debug = true
c.trace = true
c.Strength.require = c.S... | @suggested = undefined
@solver.resolve()
return @solver._changed
unedit: (variable) ->
if constraint = @editing?['%' + (variable.name || variable)]
#@solver.removeConstraint(constraint)
cei = @solver._editVarMap.get(constraint.variable)
@solver.removeColumn(cei.editMinus)
@sol... | CoffeeScript | CoffeeScript | gss/engine | src/domains/Linear.coffee | MIT | fbe4b4a9d1baf5edd4f1f809ed2b2824e3d23864 | 2,854 | https://github.com/gss/engine/blob/fbe4b4a9d1baf5edd4f1f809ed2b2824e3d23864/src/domains/Linear.coffee | 6 | 55 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.