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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
discolabs/cartjs:src/core.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Que... | // CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function(options = {}) {
options.type = 'GET';
options.updateCart = true;
return CartJS.Queue.add('/cart.js', {
v: new Dat... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/core.coffee | 1 | 39 |
discolabs/cartjs:src/core.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function(options = {}) {
options.type = 'GET';
options.updateCart = true;
... | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js', {v: new Date().getTime()}, options
... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/core.coffee | 1 | 39 |
discolabs/cartjs:src/core.coffee:1:completion | completion | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js', {v: new Date().getTime()}, options
... | # Add multiple new line items to the cart.
addItems: (items, options = {}) ->
data =
items: items
CartJS.Queue.add '/cart/add.js', data, options
CartJS.Core.getCart()
# Update an existing line item.
updateItem: (line, quantity, properties = {}, options = {}) ->
data = CartJS.Utils.wrapKeys(... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/core.coffee | 1 | 39 |
discolabs/cartjs:src/core.coffee:2:raw_corpus | raw_corpus | # Update item by ID
updateItemById: (id, quantity, properties = {}, options = {}) ->
data = CartJS.Utils.wrapKeys(properties, null, null, ['selling_plan'])
data.id = id
if quantity?
data.quantity = quantity
options.updateCart = true
CartJS.Queue.add '/cart/change.js', data, options
# Set ... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/core.coffee | 41 | 80 | ||
discolabs/cartjs:src/core.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Update item by ID
updateItemById: (id, quantity, properties = {}, options = {}) ->
data = CartJS.Utils.wrapKeys(properties, null, null, ['selling_plan'])
data.id = id
if quantity?
data.quantity = quantity
options.updateCart = true
Ca... | // Update item by ID
({
updateItemById: function(id, quantity, properties = {}, options = {}) {
var data;
data = CartJS.Utils.wrapKeys(properties, null, null, ['selling_plan']);
data.id = id;
if (quantity != null) {
data.quantity = quantity;
}
options.updateCart = true;
return CartJS... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/core.coffee | 41 | 80 |
discolabs/cartjs:src/core.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Update item by ID
({
updateItemById: function(id, quantity, properties = {}, options = {}) {
var data;
data = CartJS.Utils.wrapKeys(properties, null, null, ['selling_plan']);
data.id = id;
if (quantity != null) {
data.quantity = quantity;... | # Update item by ID
updateItemById: (id, quantity, properties = {}, options = {}) ->
data = CartJS.Utils.wrapKeys(properties, null, null, ['selling_plan'])
data.id = id
if quantity?
data.quantity = quantity
options.updateCart = true
CartJS.Queue.add '/cart/change.js', data, options
# Set ... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/core.coffee | 41 | 80 |
discolabs/cartjs:src/core.coffee:2:completion | completion | # Update item by ID
updateItemById: (id, quantity, properties = {}, options = {}) ->
data = CartJS.Utils.wrapKeys(properties, null, null, ['selling_plan'])
data.id = id
if quantity?
data.quantity = quantity
options.updateCart = true
CartJS.Queue.add '/cart/change.js', data, options
# Set ... | CartJS.Queue.add '/cart/change.js', data, options
# Clear all items from the cart.
clear: (options = {}) ->
options.updateCart = true
CartJS.Queue.add '/cart/clear.js', {}, options
# Get a cart attribute.
getAttribute: (attributeName, defaultValue) ->
if attributeName of CartJS.cart.attributes the... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/core.coffee | 41 | 80 |
discolabs/cartjs:src/core.coffee:3:raw_corpus | raw_corpus | # Set multiple cart attributes using a hash.
setAttributes: (attributes = {}, options = {}) ->
options.updateCart = true
CartJS.Queue.add '/cart/update.js', CartJS.Utils.wrapKeys(attributes, 'attributes'), options
# Clear all attributes.
clearAttributes: (options = {}) ->
options.updateCart = true
... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/core.coffee | 82 | 99 | ||
discolabs/cartjs:src/core.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Set multiple cart attributes using a hash.
setAttributes: (attributes = {}, options = {}) ->
options.updateCart = true
CartJS.Queue.add '/cart/update.js', CartJS.Utils.wrapKeys(attributes, 'attributes'), options
# Clear all attributes.
clearAttri... | // Set multiple cart attributes using a hash.
({
setAttributes: function(attributes = {}, options = {}) {
options.updateCart = true;
return CartJS.Queue.add('/cart/update.js', CartJS.Utils.wrapKeys(attributes, 'attributes'), options);
},
// Clear all attributes.
clearAttributes: function(options = {}) {... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/core.coffee | 82 | 99 |
discolabs/cartjs:src/core.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Set multiple cart attributes using a hash.
({
setAttributes: function(attributes = {}, options = {}) {
options.updateCart = true;
return CartJS.Queue.add('/cart/update.js', CartJS.Utils.wrapKeys(attributes, 'attributes'), options);
},
// Clear all ... | # Set multiple cart attributes using a hash.
setAttributes: (attributes = {}, options = {}) ->
options.updateCart = true
CartJS.Queue.add '/cart/update.js', CartJS.Utils.wrapKeys(attributes, 'attributes'), options
# Clear all attributes.
clearAttributes: (options = {}) ->
options.updateCart = true
... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/core.coffee | 82 | 99 |
discolabs/cartjs:src/core.coffee:3:completion | completion | # Set multiple cart attributes using a hash.
setAttributes: (attributes = {}, options = {}) ->
options.updateCart = true
CartJS.Queue.add '/cart/update.js', CartJS.Utils.wrapKeys(attributes, 'attributes'), options
# Clear all attributes.
clearAttributes: (options = {}) ->
options.updateCart = true
... | # Get the cart note.
getNote: () ->
CartJS.cart.note
# Set the cart note.
setNote: (note, options = {}) ->
options.updateCart = true
CartJS.Queue.add '/cart/update.js', { note: note }, options | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/core.coffee | 82 | 99 |
discolabs/cartjs:src/core.coffee:1:raw_corpus | raw_corpus | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js', {v: new Date().getTime()}, options
... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | a4dfc038c015a9079080cde9a70be7cf610b07d4 | 493 | https://github.com/discolabs/cartjs/blob/a4dfc038c015a9079080cde9a70be7cf610b07d4/src/core.coffee | 1 | 41 | ||
discolabs/cartjs:src/core.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Que... | // CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function(options = {}) {
options.type = 'GET';
options.updateCart = true;
return CartJS.Queue.add('/cart.js', {
v: new Dat... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | a4dfc038c015a9079080cde9a70be7cf610b07d4 | 493 | https://github.com/discolabs/cartjs/blob/a4dfc038c015a9079080cde9a70be7cf610b07d4/src/core.coffee | 1 | 41 |
discolabs/cartjs:src/core.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function(options = {}) {
options.type = 'GET';
options.updateCart = true;
... | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js', {v: new Date().getTime()}, options
... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | a4dfc038c015a9079080cde9a70be7cf610b07d4 | 493 | https://github.com/discolabs/cartjs/blob/a4dfc038c015a9079080cde9a70be7cf610b07d4/src/core.coffee | 1 | 41 |
discolabs/cartjs:src/core.coffee:1:completion | completion | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js', {v: new Date().getTime()}, options
... | CartJS.Core.getCart()
# Add multiple new line items to the cart.
addItems: (items, options = {}) ->
data =
items: items
CartJS.Queue.add '/cart/add.js', data, options
CartJS.Core.getCart()
# Update an existing line item.
updateItem: (line, quantity, properties = {}, options = {}) ->
data... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | a4dfc038c015a9079080cde9a70be7cf610b07d4 | 493 | https://github.com/discolabs/cartjs/blob/a4dfc038c015a9079080cde9a70be7cf610b07d4/src/core.coffee | 1 | 41 |
discolabs/cartjs:src/core.coffee:2:raw_corpus | raw_corpus | # Update item by ID
updateItemById: (id, quantity, properties = {}, options = {}) ->
data = CartJS.Utils.wrapKeys(properties)
data.id = id
if quantity?
data.quantity = quantity
options.updateCart = true
CartJS.Queue.add '/cart/change.js', data, options
# Set the quantities of a number of ... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | a4dfc038c015a9079080cde9a70be7cf610b07d4 | 493 | https://github.com/discolabs/cartjs/blob/a4dfc038c015a9079080cde9a70be7cf610b07d4/src/core.coffee | 43 | 82 | ||
discolabs/cartjs:src/core.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Update item by ID
updateItemById: (id, quantity, properties = {}, options = {}) ->
data = CartJS.Utils.wrapKeys(properties)
data.id = id
if quantity?
data.quantity = quantity
options.updateCart = true
CartJS.Queue.add '/cart/change.j... | // Update item by ID
({
updateItemById: function(id, quantity, properties = {}, options = {}) {
var data;
data = CartJS.Utils.wrapKeys(properties);
data.id = id;
if (quantity != null) {
data.quantity = quantity;
}
options.updateCart = true;
return CartJS.Queue.add('/cart/change.js', ... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | a4dfc038c015a9079080cde9a70be7cf610b07d4 | 493 | https://github.com/discolabs/cartjs/blob/a4dfc038c015a9079080cde9a70be7cf610b07d4/src/core.coffee | 43 | 82 |
discolabs/cartjs:src/core.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Update item by ID
({
updateItemById: function(id, quantity, properties = {}, options = {}) {
var data;
data = CartJS.Utils.wrapKeys(properties);
data.id = id;
if (quantity != null) {
data.quantity = quantity;
}
options.updateCart ... | # Update item by ID
updateItemById: (id, quantity, properties = {}, options = {}) ->
data = CartJS.Utils.wrapKeys(properties)
data.id = id
if quantity?
data.quantity = quantity
options.updateCart = true
CartJS.Queue.add '/cart/change.js', data, options
# Set the quantities of a number of ... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | a4dfc038c015a9079080cde9a70be7cf610b07d4 | 493 | https://github.com/discolabs/cartjs/blob/a4dfc038c015a9079080cde9a70be7cf610b07d4/src/core.coffee | 43 | 82 |
discolabs/cartjs:src/core.coffee:2:completion | completion | # Update item by ID
updateItemById: (id, quantity, properties = {}, options = {}) ->
data = CartJS.Utils.wrapKeys(properties)
data.id = id
if quantity?
data.quantity = quantity
options.updateCart = true
CartJS.Queue.add '/cart/change.js', data, options
# Set the quantities of a number of ... | CartJS.Queue.add '/cart/change.js', data, options
# Clear all items from the cart.
clear: (options = {}) ->
options.updateCart = true
CartJS.Queue.add '/cart/clear.js', {}, options
# Get a cart attribute.
getAttribute: (attributeName, defaultValue) ->
if attributeName of CartJS.cart.attributes the... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | a4dfc038c015a9079080cde9a70be7cf610b07d4 | 493 | https://github.com/discolabs/cartjs/blob/a4dfc038c015a9079080cde9a70be7cf610b07d4/src/core.coffee | 43 | 82 |
discolabs/cartjs:src/core.coffee:1:raw_corpus | raw_corpus | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js', {v: new Date().getTime()}, options
... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | f3acc7a415fda333d2c6c2a72f5b38c6c0dd4a94 | 493 | https://github.com/discolabs/cartjs/blob/f3acc7a415fda333d2c6c2a72f5b38c6c0dd4a94/src/core.coffee | 1 | 39 | ||
discolabs/cartjs:src/core.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Que... | // CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function(options = {}) {
options.type = 'GET';
options.updateCart = true;
return CartJS.Queue.add('/cart.js', {
v: new Dat... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | f3acc7a415fda333d2c6c2a72f5b38c6c0dd4a94 | 493 | https://github.com/discolabs/cartjs/blob/f3acc7a415fda333d2c6c2a72f5b38c6c0dd4a94/src/core.coffee | 1 | 39 |
discolabs/cartjs:src/core.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function(options = {}) {
options.type = 'GET';
options.updateCart = true;
... | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js', {v: new Date().getTime()}, options
... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | f3acc7a415fda333d2c6c2a72f5b38c6c0dd4a94 | 493 | https://github.com/discolabs/cartjs/blob/f3acc7a415fda333d2c6c2a72f5b38c6c0dd4a94/src/core.coffee | 1 | 39 |
discolabs/cartjs:src/core.coffee:1:completion | completion | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js', {v: new Date().getTime()}, options
... | # Add multiple new line items to the cart.
addItems: (items, options = {}) ->
data =
items: items
CartJS.Queue.add '/cart/add.js', data, options
CartJS.Core.getCart()
# Update an existing line item.
updateItem: (line, quantity, properties = {}, options = {}) ->
data = CartJS.Utils.wrapKeys(... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | f3acc7a415fda333d2c6c2a72f5b38c6c0dd4a94 | 493 | https://github.com/discolabs/cartjs/blob/f3acc7a415fda333d2c6c2a72f5b38c6c0dd4a94/src/core.coffee | 1 | 39 |
discolabs/cartjs:src/core.coffee:1:raw_corpus | raw_corpus | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js?v=' + new Date().getTime(), {}, options
... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | db376dc73a18a45f951069de362d37f297eb69b1 | 493 | https://github.com/discolabs/cartjs/blob/db376dc73a18a45f951069de362d37f297eb69b1/src/core.coffee | 1 | 39 | ||
discolabs/cartjs:src/core.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Que... | // CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function(options = {}) {
options.type = 'GET';
options.updateCart = true;
return CartJS.Queue.add('/cart.js?v=' + new Date().get... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | db376dc73a18a45f951069de362d37f297eb69b1 | 493 | https://github.com/discolabs/cartjs/blob/db376dc73a18a45f951069de362d37f297eb69b1/src/core.coffee | 1 | 39 |
discolabs/cartjs:src/core.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function(options = {}) {
options.type = 'GET';
options.updateCart = true;
... | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js?v=' + new Date().getTime(), {}, options
... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | db376dc73a18a45f951069de362d37f297eb69b1 | 493 | https://github.com/discolabs/cartjs/blob/db376dc73a18a45f951069de362d37f297eb69b1/src/core.coffee | 1 | 39 |
discolabs/cartjs:src/core.coffee:1:completion | completion | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js?v=' + new Date().getTime(), {}, options
... | # Add multiple new line items to the cart.
addItems: (items, options = {}) ->
data =
items: items
CartJS.Queue.add '/cart/add.js', data, options
CartJS.Core.getCart()
# Update an existing line item.
updateItem: (line, quantity, properties = {}, options = {}) ->
data = CartJS.Utils.wrapKeys(... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | db376dc73a18a45f951069de362d37f297eb69b1 | 493 | https://github.com/discolabs/cartjs/blob/db376dc73a18a45f951069de362d37f297eb69b1/src/core.coffee | 1 | 39 |
discolabs/cartjs:src/core.coffee:1:raw_corpus | raw_corpus | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js', {}, options
# Add a new line item t... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 9e3a0907e607688603df9ec9f6c639f3388a9e9c | 493 | https://github.com/discolabs/cartjs/blob/9e3a0907e607688603df9ec9f6c639f3388a9e9c/src/core.coffee | 1 | 39 | ||
discolabs/cartjs:src/core.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Que... | // CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function(options = {}) {
options.type = 'GET';
options.updateCart = true;
return CartJS.Queue.add('/cart.js', {}, options);
},... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 9e3a0907e607688603df9ec9f6c639f3388a9e9c | 493 | https://github.com/discolabs/cartjs/blob/9e3a0907e607688603df9ec9f6c639f3388a9e9c/src/core.coffee | 1 | 39 |
discolabs/cartjs:src/core.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function(options = {}) {
options.type = 'GET';
options.updateCart = true;
... | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js', {}, options
# Add a new line item t... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 9e3a0907e607688603df9ec9f6c639f3388a9e9c | 493 | https://github.com/discolabs/cartjs/blob/9e3a0907e607688603df9ec9f6c639f3388a9e9c/src/core.coffee | 1 | 39 |
discolabs/cartjs:src/core.coffee:1:completion | completion | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js', {}, options
# Add a new line item t... | # Add multiple new line items to the cart.
addItems: (items, options = {}) ->
data =
items: items
CartJS.Queue.add '/cart/add.js', data, options
CartJS.Core.getCart()
# Update an existing line item.
updateItem: (line, quantity, properties = {}, options = {}) ->
data = CartJS.Utils.wrapKeys(... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 9e3a0907e607688603df9ec9f6c639f3388a9e9c | 493 | https://github.com/discolabs/cartjs/blob/9e3a0907e607688603df9ec9f6c639f3388a9e9c/src/core.coffee | 1 | 39 |
discolabs/cartjs:src/core.coffee:1:raw_corpus | raw_corpus | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js', {}, options
# Add a new line item t... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3c7f3a800d678736a623a7068165f9c6625b99a3 | 493 | https://github.com/discolabs/cartjs/blob/3c7f3a800d678736a623a7068165f9c6625b99a3/src/core.coffee | 1 | 41 | ||
discolabs/cartjs:src/core.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Que... | // CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function(options = {}) {
options.type = 'GET';
options.updateCart = true;
return CartJS.Queue.add('/cart.js', {}, options);
},... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 3c7f3a800d678736a623a7068165f9c6625b99a3 | 493 | https://github.com/discolabs/cartjs/blob/3c7f3a800d678736a623a7068165f9c6625b99a3/src/core.coffee | 1 | 41 |
discolabs/cartjs:src/core.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function(options = {}) {
options.type = 'GET';
options.updateCart = true;
... | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js', {}, options
# Add a new line item t... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3c7f3a800d678736a623a7068165f9c6625b99a3 | 493 | https://github.com/discolabs/cartjs/blob/3c7f3a800d678736a623a7068165f9c6625b99a3/src/core.coffee | 1 | 41 |
discolabs/cartjs:src/core.coffee:1:completion | completion | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js', {}, options
# Add a new line item t... | # Update an existing line item.
updateItem: (line, quantity, properties = {}, options = {}) ->
data = CartJS.Utils.wrapKeys(properties)
data.line = line
if quantity?
data.quantity = quantity
options.updateCart = true
CartJS.Queue.add '/cart/change.js', data, options
# Remove an existing l... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3c7f3a800d678736a623a7068165f9c6625b99a3 | 493 | https://github.com/discolabs/cartjs/blob/3c7f3a800d678736a623a7068165f9c6625b99a3/src/core.coffee | 1 | 41 |
discolabs/cartjs:src/core.coffee:2:raw_corpus | raw_corpus | # Set the quantities of a number of items in the cart with an ID/Quantity "updates" mapping.
updateItemQuantitiesById: (updates = {}, options = {}) ->
options.updateCart = true
CartJS.Queue.add '/cart/update.js', {updates: updates}, options
# Remove all line items for the given variant ID.
removeItemById... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3c7f3a800d678736a623a7068165f9c6625b99a3 | 493 | https://github.com/discolabs/cartjs/blob/3c7f3a800d678736a623a7068165f9c6625b99a3/src/core.coffee | 43 | 83 | ||
discolabs/cartjs:src/core.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Set the quantities of a number of items in the cart with an ID/Quantity "updates" mapping.
updateItemQuantitiesById: (updates = {}, options = {}) ->
options.updateCart = true
CartJS.Queue.add '/cart/update.js', {updates: updates}, options
# Remove ... | // Set the quantities of a number of items in the cart with an ID/Quantity "updates" mapping.
({
updateItemQuantitiesById: function(updates = {}, options = {}) {
options.updateCart = true;
return CartJS.Queue.add('/cart/update.js', {
updates: updates
}, options);
},
// Remove all line items for ... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 3c7f3a800d678736a623a7068165f9c6625b99a3 | 493 | https://github.com/discolabs/cartjs/blob/3c7f3a800d678736a623a7068165f9c6625b99a3/src/core.coffee | 43 | 83 |
discolabs/cartjs:src/core.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Set the quantities of a number of items in the cart with an ID/Quantity "updates" mapping.
({
updateItemQuantitiesById: function(updates = {}, options = {}) {
options.updateCart = true;
return CartJS.Queue.add('/cart/update.js', {
updates: update... | # Set the quantities of a number of items in the cart with an ID/Quantity "updates" mapping.
updateItemQuantitiesById: (updates = {}, options = {}) ->
options.updateCart = true
CartJS.Queue.add '/cart/update.js', {updates: updates}, options
# Remove all line items for the given variant ID.
removeItemById... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3c7f3a800d678736a623a7068165f9c6625b99a3 | 493 | https://github.com/discolabs/cartjs/blob/3c7f3a800d678736a623a7068165f9c6625b99a3/src/core.coffee | 43 | 83 |
discolabs/cartjs:src/core.coffee:2:completion | completion | # Set the quantities of a number of items in the cart with an ID/Quantity "updates" mapping.
updateItemQuantitiesById: (updates = {}, options = {}) ->
options.updateCart = true
CartJS.Queue.add '/cart/update.js', {updates: updates}, options
# Remove all line items for the given variant ID.
removeItemById... | if attributeName of CartJS.cart.attributes then CartJS.cart.attributes[attributeName] else defaultValue
# Set a cart attribute.
setAttribute: (attributeName, value, options = {}) ->
attributes = {}
attributes[attributeName] = value
CartJS.Core.setAttributes(attributes, options)
# Get all cart attrib... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3c7f3a800d678736a623a7068165f9c6625b99a3 | 493 | https://github.com/discolabs/cartjs/blob/3c7f3a800d678736a623a7068165f9c6625b99a3/src/core.coffee | 43 | 83 |
discolabs/cartjs:src/core.coffee:3:raw_corpus | raw_corpus | # Get the cart note.
getNote: () ->
CartJS.cart.note
# Set the cart note.
setNote: (note, options = {}) ->
options.updateCart = true
CartJS.Queue.add '/cart/update.js', { note: note }, options | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3c7f3a800d678736a623a7068165f9c6625b99a3 | 493 | https://github.com/discolabs/cartjs/blob/3c7f3a800d678736a623a7068165f9c6625b99a3/src/core.coffee | 85 | 92 | ||
discolabs/cartjs:src/core.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Get the cart note.
getNote: () ->
CartJS.cart.note
# Set the cart note.
setNote: (note, options = {}) ->
options.updateCart = true
CartJS.Queue.add '/cart/update.js', { note: note }, options
``` | // Get the cart note.
({
getNote: function() {
return CartJS.cart.note;
},
// Set the cart note.
setNote: function(note, options = {}) {
options.updateCart = true;
return CartJS.Queue.add('/cart/update.js', {
note: note
}, options);
}
}); | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 3c7f3a800d678736a623a7068165f9c6625b99a3 | 493 | https://github.com/discolabs/cartjs/blob/3c7f3a800d678736a623a7068165f9c6625b99a3/src/core.coffee | 85 | 92 |
discolabs/cartjs:src/core.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Get the cart note.
({
getNote: function() {
return CartJS.cart.note;
},
// Set the cart note.
setNote: function(note, options = {}) {
options.updateCart = true;
return CartJS.Queue.add('/cart/update.js', {
note: note
}, options);
... | # Get the cart note.
getNote: () ->
CartJS.cart.note
# Set the cart note.
setNote: (note, options = {}) ->
options.updateCart = true
CartJS.Queue.add '/cart/update.js', { note: note }, options | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3c7f3a800d678736a623a7068165f9c6625b99a3 | 493 | https://github.com/discolabs/cartjs/blob/3c7f3a800d678736a623a7068165f9c6625b99a3/src/core.coffee | 85 | 92 |
discolabs/cartjs:src/core.coffee:3:completion | completion | # Get the cart note.
getNote: () ->
CartJS.cart.note | # Set the cart note.
setNote: (note, options = {}) ->
options.updateCart = true
CartJS.Queue.add '/cart/update.js', { note: note }, options | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3c7f3a800d678736a623a7068165f9c6625b99a3 | 493 | https://github.com/discolabs/cartjs/blob/3c7f3a800d678736a623a7068165f9c6625b99a3/src/core.coffee | 85 | 92 |
discolabs/cartjs:src/core.coffee:1:raw_corpus | raw_corpus | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 4e8330da9f70c1cb5a2af50e2e0982144db31538 | 493 | https://github.com/discolabs/cartjs/blob/4e8330da9f70c1cb5a2af50e2e0982144db31538/src/core.coffee | 1 | 41 | ||
discolabs/cartjs:src/core.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new lin... | // CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function() {
return CartJS.Queue.add('/cart.js', {}, CartJS.cart.update, 'GET');
},
// Add a new line item to the cart.
addItem: f... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 4e8330da9f70c1cb5a2af50e2e0982144db31538 | 493 | https://github.com/discolabs/cartjs/blob/4e8330da9f70c1cb5a2af50e2e0982144db31538/src/core.coffee | 1 | 41 |
discolabs/cartjs:src/core.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function() {
return CartJS.Queue.add('/cart.js', {}, CartJS.cart.update, 'GET');
... | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 4e8330da9f70c1cb5a2af50e2e0982144db31538 | 493 | https://github.com/discolabs/cartjs/blob/4e8330da9f70c1cb5a2af50e2e0982144db31538/src/core.coffee | 1 | 41 |
discolabs/cartjs:src/core.coffee:1:completion | completion | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | data = CartJS.Utils.wrapKeys(properties)
data.line = line
if quantity?
data.quantity = quantity
CartJS.Queue.add '/cart/change.js', data, CartJS.cart.update
# Remove an existing line item.
removeItem: (line) ->
CartJS.Core.updateItem line, 0
# Update item by ID
updateItemById: (id, quant... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 4e8330da9f70c1cb5a2af50e2e0982144db31538 | 493 | https://github.com/discolabs/cartjs/blob/4e8330da9f70c1cb5a2af50e2e0982144db31538/src/core.coffee | 1 | 41 |
discolabs/cartjs:src/core.coffee:2:raw_corpus | raw_corpus | # Remove all line items for the given variant ID.
removeItemById: (id) ->
data =
id: id
quantity: 0
CartJS.Queue.add '/cart/change.js', data, CartJS.cart.update
# Clear all items from the cart.
clear: () ->
CartJS.Queue.add '/cart/clear.js', {}, CartJS.cart.update
# Get a cart attribut... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 4e8330da9f70c1cb5a2af50e2e0982144db31538 | 493 | https://github.com/discolabs/cartjs/blob/4e8330da9f70c1cb5a2af50e2e0982144db31538/src/core.coffee | 43 | 82 | ||
discolabs/cartjs:src/core.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Remove all line items for the given variant ID.
removeItemById: (id) ->
data =
id: id
quantity: 0
CartJS.Queue.add '/cart/change.js', data, CartJS.cart.update
# Clear all items from the cart.
clear: () ->
CartJS.Queue.add '/cart/c... | // Remove all line items for the given variant ID.
({
removeItemById: function(id) {
var data;
data = {
id: id,
quantity: 0
};
return CartJS.Queue.add('/cart/change.js', data, CartJS.cart.update);
},
// Clear all items from the cart.
clear: function() {
return CartJS.Queue.add('/... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 4e8330da9f70c1cb5a2af50e2e0982144db31538 | 493 | https://github.com/discolabs/cartjs/blob/4e8330da9f70c1cb5a2af50e2e0982144db31538/src/core.coffee | 43 | 82 |
discolabs/cartjs:src/core.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Remove all line items for the given variant ID.
({
removeItemById: function(id) {
var data;
data = {
id: id,
quantity: 0
};
return CartJS.Queue.add('/cart/change.js', data, CartJS.cart.update);
},
// Clear all items from the car... | # Remove all line items for the given variant ID.
removeItemById: (id) ->
data =
id: id
quantity: 0
CartJS.Queue.add '/cart/change.js', data, CartJS.cart.update
# Clear all items from the cart.
clear: () ->
CartJS.Queue.add '/cart/clear.js', {}, CartJS.cart.update
# Get a cart attribut... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 4e8330da9f70c1cb5a2af50e2e0982144db31538 | 493 | https://github.com/discolabs/cartjs/blob/4e8330da9f70c1cb5a2af50e2e0982144db31538/src/core.coffee | 43 | 82 |
discolabs/cartjs:src/core.coffee:2:completion | completion | # Remove all line items for the given variant ID.
removeItemById: (id) ->
data =
id: id
quantity: 0
CartJS.Queue.add '/cart/change.js', data, CartJS.cart.update
# Clear all items from the cart.
clear: () ->
CartJS.Queue.add '/cart/clear.js', {}, CartJS.cart.update
# Get a cart attribut... | # Get all cart attributes as a hash.
getAttributes: () ->
CartJS.cart.attributes
# Set multiple cart attributes using a hash.
setAttributes: (attributes = {}) ->
CartJS.Queue.add '/cart/update.js', CartJS.Utils.wrapKeys(attributes, 'attributes'), CartJS.cart.update
# Clear all attributes.
clearAttri... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 4e8330da9f70c1cb5a2af50e2e0982144db31538 | 493 | https://github.com/discolabs/cartjs/blob/4e8330da9f70c1cb5a2af50e2e0982144db31538/src/core.coffee | 43 | 82 |
discolabs/cartjs:src/core.coffee:1:raw_corpus | raw_corpus | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 2e36669f613f67ac87f6f1a3c68cc0660064493c | 493 | https://github.com/discolabs/cartjs/blob/2e36669f613f67ac87f6f1a3c68cc0660064493c/src/core.coffee | 1 | 50 | ||
discolabs/cartjs:src/core.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new lin... | // CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function() {
return CartJS.Queue.add('/cart.js', {}, CartJS.cart.update, 'GET');
},
// Add a new line item to the cart.
addItem: f... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 2e36669f613f67ac87f6f1a3c68cc0660064493c | 493 | https://github.com/discolabs/cartjs/blob/2e36669f613f67ac87f6f1a3c68cc0660064493c/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function() {
return CartJS.Queue.add('/cart.js', {}, CartJS.cart.update, 'GET');
... | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 2e36669f613f67ac87f6f1a3c68cc0660064493c | 493 | https://github.com/discolabs/cartjs/blob/2e36669f613f67ac87f6f1a3c68cc0660064493c/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:1:completion | completion | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | # Remove an existing line item.
removeItem: (line) ->
CartJS.Core.updateItem line, 0
# Update item by ID
updateItemById: (id, quantity, properties = {}) ->
data = CartJS.Utils.wrapKeys(properties)
data.id = id
if quantity?
data.quantity = quantity
CartJS.Queue.add '/cart/change.js', dat... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 2e36669f613f67ac87f6f1a3c68cc0660064493c | 493 | https://github.com/discolabs/cartjs/blob/2e36669f613f67ac87f6f1a3c68cc0660064493c/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:2:raw_corpus | raw_corpus | getAttribute: (attributeName, defaultValue) ->
if attributeName of CartJS.cart.attributes then CartJS.cart.attributes[attributeName] else defaultValue
# Set a cart attribute.
setAttribute: (attributeName, value) ->
attributes = {}
attributes[attributeName] = value
CartJS.Core.setAttributes(attribut... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 2e36669f613f67ac87f6f1a3c68cc0660064493c | 493 | https://github.com/discolabs/cartjs/blob/2e36669f613f67ac87f6f1a3c68cc0660064493c/src/core.coffee | 51 | 78 | ||
discolabs/cartjs:src/core.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
getAttribute: (attributeName, defaultValue) ->
if attributeName of CartJS.cart.attributes then CartJS.cart.attributes[attributeName] else defaultValue
# Set a cart attribute.
setAttribute: (attributeName, value) ->
attributes = {}
attributes[attr... | ({
getAttribute: function(attributeName, defaultValue) {
if (attributeName in CartJS.cart.attributes) {
return CartJS.cart.attributes[attributeName];
} else {
return defaultValue;
}
},
// Set a cart attribute.
setAttribute: function(attributeName, value) {
var attributes;
attribu... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 2e36669f613f67ac87f6f1a3c68cc0660064493c | 493 | https://github.com/discolabs/cartjs/blob/2e36669f613f67ac87f6f1a3c68cc0660064493c/src/core.coffee | 51 | 78 |
discolabs/cartjs:src/core.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
getAttribute: function(attributeName, defaultValue) {
if (attributeName in CartJS.cart.attributes) {
return CartJS.cart.attributes[attributeName];
} else {
return defaultValue;
}
},
// Set a cart attribute.
setAttribute: function(... | getAttribute: (attributeName, defaultValue) ->
if attributeName of CartJS.cart.attributes then CartJS.cart.attributes[attributeName] else defaultValue
# Set a cart attribute.
setAttribute: (attributeName, value) ->
attributes = {}
attributes[attributeName] = value
CartJS.Core.setAttributes(attribut... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 2e36669f613f67ac87f6f1a3c68cc0660064493c | 493 | https://github.com/discolabs/cartjs/blob/2e36669f613f67ac87f6f1a3c68cc0660064493c/src/core.coffee | 51 | 78 |
discolabs/cartjs:src/core.coffee:2:completion | completion | getAttribute: (attributeName, defaultValue) ->
if attributeName of CartJS.cart.attributes then CartJS.cart.attributes[attributeName] else defaultValue
# Set a cart attribute.
setAttribute: (attributeName, value) ->
attributes = {}
attributes[attributeName] = value
CartJS.Core.setAttributes(attribut... | setAttributes: (attributes = {}) ->
CartJS.Queue.add '/cart/update.js', CartJS.Utils.wrapKeys(attributes, 'attributes'), CartJS.cart.update
# Clear all attributes.
clearAttributes: () ->
CartJS.Queue.add '/cart/update.js', CartJS.Utils.wrapKeys(CartJS.Core.getAttributes(), 'attributes', ''), CartJS.cart.up... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 2e36669f613f67ac87f6f1a3c68cc0660064493c | 493 | https://github.com/discolabs/cartjs/blob/2e36669f613f67ac87f6f1a3c68cc0660064493c/src/core.coffee | 51 | 78 |
discolabs/cartjs:src/core.coffee:1:raw_corpus | raw_corpus | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 797e7e557a5cf830f20ffdba900f6e13d1b3f052 | 493 | https://github.com/discolabs/cartjs/blob/797e7e557a5cf830f20ffdba900f6e13d1b3f052/src/core.coffee | 1 | 50 | ||
discolabs/cartjs:src/core.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new lin... | // CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function() {
return CartJS.Queue.add('/cart.js', {}, CartJS.cart.update, 'GET');
},
// Add a new line item to the cart.
addItem: f... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 797e7e557a5cf830f20ffdba900f6e13d1b3f052 | 493 | https://github.com/discolabs/cartjs/blob/797e7e557a5cf830f20ffdba900f6e13d1b3f052/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function() {
return CartJS.Queue.add('/cart.js', {}, CartJS.cart.update, 'GET');
... | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 797e7e557a5cf830f20ffdba900f6e13d1b3f052 | 493 | https://github.com/discolabs/cartjs/blob/797e7e557a5cf830f20ffdba900f6e13d1b3f052/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:1:completion | completion | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | # Remove an existing line item.
removeItem: (line) ->
CartJS.Core.updateItem line, 0
# Update item by ID
updateItemById: (id, quantity = 1, properties = {}) ->
data = CartJS.Utils.wrapKeys(properties)
data.id = id
data.quantity = quantity
CartJS.Queue.add '/cart/change.js', data, CartJS.cart.... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 797e7e557a5cf830f20ffdba900f6e13d1b3f052 | 493 | https://github.com/discolabs/cartjs/blob/797e7e557a5cf830f20ffdba900f6e13d1b3f052/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:2:raw_corpus | raw_corpus | # Set a cart attribute.
setAttribute: (attributeName, value) ->
attributes = {}
attributes[attributeName] = value
CartJS.Core.setAttributes(attributes)
# Get all cart attributes as a hash.
getAttributes: () ->
CartJS.cart.attributes
# Set multiple cart attributes using a hash.
setAttributes:... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 797e7e557a5cf830f20ffdba900f6e13d1b3f052 | 493 | https://github.com/discolabs/cartjs/blob/797e7e557a5cf830f20ffdba900f6e13d1b3f052/src/core.coffee | 51 | 76 | ||
discolabs/cartjs:src/core.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Set a cart attribute.
setAttribute: (attributeName, value) ->
attributes = {}
attributes[attributeName] = value
CartJS.Core.setAttributes(attributes)
# Get all cart attributes as a hash.
getAttributes: () ->
CartJS.cart.attributes
# Se... | // Set a cart attribute.
({
setAttribute: function(attributeName, value) {
var attributes;
attributes = {};
attributes[attributeName] = value;
return CartJS.Core.setAttributes(attributes);
},
// Get all cart attributes as a hash.
getAttributes: function() {
return CartJS.cart.attributes;
}... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 797e7e557a5cf830f20ffdba900f6e13d1b3f052 | 493 | https://github.com/discolabs/cartjs/blob/797e7e557a5cf830f20ffdba900f6e13d1b3f052/src/core.coffee | 51 | 76 |
discolabs/cartjs:src/core.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Set a cart attribute.
({
setAttribute: function(attributeName, value) {
var attributes;
attributes = {};
attributes[attributeName] = value;
return CartJS.Core.setAttributes(attributes);
},
// Get all cart attributes as a hash.
getAttribut... | # Set a cart attribute.
setAttribute: (attributeName, value) ->
attributes = {}
attributes[attributeName] = value
CartJS.Core.setAttributes(attributes)
# Get all cart attributes as a hash.
getAttributes: () ->
CartJS.cart.attributes
# Set multiple cart attributes using a hash.
setAttributes:... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 797e7e557a5cf830f20ffdba900f6e13d1b3f052 | 493 | https://github.com/discolabs/cartjs/blob/797e7e557a5cf830f20ffdba900f6e13d1b3f052/src/core.coffee | 51 | 76 |
discolabs/cartjs:src/core.coffee:2:completion | completion | # Set a cart attribute.
setAttribute: (attributeName, value) ->
attributes = {}
attributes[attributeName] = value
CartJS.Core.setAttributes(attributes)
# Get all cart attributes as a hash.
getAttributes: () ->
CartJS.cart.attributes
# Set multiple cart attributes using a hash.
setAttributes:... | CartJS.Queue.add '/cart/update.js', CartJS.Utils.wrapKeys(attributes, 'attributes'), CartJS.cart.update
# Clear all attributes.
clearAttributes: () ->
CartJS.Queue.add '/cart/update.js', CartJS.Utils.wrapKeys(CartJS.Core.getAttributes(), 'attributes', ''), CartJS.cart.update
# Get the cart note.
getNote: ... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 797e7e557a5cf830f20ffdba900f6e13d1b3f052 | 493 | https://github.com/discolabs/cartjs/blob/797e7e557a5cf830f20ffdba900f6e13d1b3f052/src/core.coffee | 51 | 76 |
discolabs/cartjs:src/core.coffee:1:raw_corpus | raw_corpus | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 7f255275796500c08c07c15aff09cdae6ae14de6 | 493 | https://github.com/discolabs/cartjs/blob/7f255275796500c08c07c15aff09cdae6ae14de6/src/core.coffee | 1 | 50 | ||
discolabs/cartjs:src/core.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new lin... | // CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function() {
return CartJS.Queue.add('/cart.js', {}, CartJS.cart.update, 'GET');
},
// Add a new line item to the cart.
addItem: f... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 7f255275796500c08c07c15aff09cdae6ae14de6 | 493 | https://github.com/discolabs/cartjs/blob/7f255275796500c08c07c15aff09cdae6ae14de6/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function() {
return CartJS.Queue.add('/cart.js', {}, CartJS.cart.update, 'GET');
... | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 7f255275796500c08c07c15aff09cdae6ae14de6 | 493 | https://github.com/discolabs/cartjs/blob/7f255275796500c08c07c15aff09cdae6ae14de6/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:1:completion | completion | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | # Remove an existing line item.
removeItem: (line) ->
CartJS.Core.updateItem line, 0
# Update item by ID
updateItemById: (id, quantity = 1, properties = {}) ->
data = CartJS.Utils.wrapKeys(properties)
data.id = id
data.quantity = quantity
CartJS.Queue.add '/cart/change.js', data, CartJS.cart.... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 7f255275796500c08c07c15aff09cdae6ae14de6 | 493 | https://github.com/discolabs/cartjs/blob/7f255275796500c08c07c15aff09cdae6ae14de6/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:1:raw_corpus | raw_corpus | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | deb7f2f9f0b533183c1011d1fe09a40dd4dc410d | 493 | https://github.com/discolabs/cartjs/blob/deb7f2f9f0b533183c1011d1fe09a40dd4dc410d/src/core.coffee | 1 | 50 | ||
discolabs/cartjs:src/core.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new lin... | // CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function() {
return CartJS.Queue.add('/cart.js', {}, CartJS.cart.update, 'GET');
},
// Add a new line item to the cart.
addItem: f... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | deb7f2f9f0b533183c1011d1fe09a40dd4dc410d | 493 | https://github.com/discolabs/cartjs/blob/deb7f2f9f0b533183c1011d1fe09a40dd4dc410d/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function() {
return CartJS.Queue.add('/cart.js', {}, CartJS.cart.update, 'GET');
... | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | deb7f2f9f0b533183c1011d1fe09a40dd4dc410d | 493 | https://github.com/discolabs/cartjs/blob/deb7f2f9f0b533183c1011d1fe09a40dd4dc410d/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:1:completion | completion | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | # Remove an existing line item.
removeItem: (line) ->
CartJS.Core.updateItem line, 0
# Update item by id
updateItemById: (id, quantity = 1, properties = {}) ->
data = CartJS.Utils.wrapKeys(properties)
data.id = id
data.quantity = quantity
CartJS.Queue.add '/cart/change.js', data, CartJS.cart.... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | deb7f2f9f0b533183c1011d1fe09a40dd4dc410d | 493 | https://github.com/discolabs/cartjs/blob/deb7f2f9f0b533183c1011d1fe09a40dd4dc410d/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:1:raw_corpus | raw_corpus | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 98f749525ffc5b713c647ae0b4f024cf904fd8c1 | 493 | https://github.com/discolabs/cartjs/blob/98f749525ffc5b713c647ae0b4f024cf904fd8c1/src/core.coffee | 1 | 50 | ||
discolabs/cartjs:src/core.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new lin... | // CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function() {
return CartJS.Queue.add('/cart.js', {}, CartJS.cart.update, 'GET');
},
// Add a new line item to the cart.
addItem: f... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 98f749525ffc5b713c647ae0b4f024cf904fd8c1 | 493 | https://github.com/discolabs/cartjs/blob/98f749525ffc5b713c647ae0b4f024cf904fd8c1/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function() {
return CartJS.Queue.add('/cart.js', {}, CartJS.cart.update, 'GET');
... | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 98f749525ffc5b713c647ae0b4f024cf904fd8c1 | 493 | https://github.com/discolabs/cartjs/blob/98f749525ffc5b713c647ae0b4f024cf904fd8c1/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:1:completion | completion | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, CartJS.cart.update, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, propert... | # Remove an existing line item.
removeItem: (line) ->
CartJS.Core.updateItem line, 0
# Clear all items from the cart.
clear: () ->
CartJS.Queue.add '/cart/clear.js', {}, CartJS.cart.update
# Get a cart attribute.
getAttribute: (attributeName, defaultValue) ->
if attributeName of CartJS.cart.attr... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 98f749525ffc5b713c647ae0b4f024cf904fd8c1 | 493 | https://github.com/discolabs/cartjs/blob/98f749525ffc5b713c647ae0b4f024cf904fd8c1/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:2:raw_corpus | raw_corpus | # Get the cart note.
getNote: () ->
CartJS.cart.note
# Set the cart note.
setNote: (note) ->
CartJS.Queue.add '/cart/update.js', { note: note }, CartJS.cart.update
#716986707 | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 98f749525ffc5b713c647ae0b4f024cf904fd8c1 | 493 | https://github.com/discolabs/cartjs/blob/98f749525ffc5b713c647ae0b4f024cf904fd8c1/src/core.coffee | 51 | 60 | ||
discolabs/cartjs:src/core.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Get the cart note.
getNote: () ->
CartJS.cart.note
# Set the cart note.
setNote: (note) ->
CartJS.Queue.add '/cart/update.js', { note: note }, CartJS.cart.update
#716986707
``` | // Get the cart note.
({
getNote: function() {
return CartJS.cart.note;
},
// Set the cart note.
setNote: function(note) {
return CartJS.Queue.add('/cart/update.js', {
note: note
}, CartJS.cart.update);
}
});
//716986707 | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 98f749525ffc5b713c647ae0b4f024cf904fd8c1 | 493 | https://github.com/discolabs/cartjs/blob/98f749525ffc5b713c647ae0b4f024cf904fd8c1/src/core.coffee | 51 | 60 |
discolabs/cartjs:src/core.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Get the cart note.
({
getNote: function() {
return CartJS.cart.note;
},
// Set the cart note.
setNote: function(note) {
return CartJS.Queue.add('/cart/update.js', {
note: note
}, CartJS.cart.update);
}
});
//716986707
``` | # Get the cart note.
getNote: () ->
CartJS.cart.note
# Set the cart note.
setNote: (note) ->
CartJS.Queue.add '/cart/update.js', { note: note }, CartJS.cart.update
#716986707 | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 98f749525ffc5b713c647ae0b4f024cf904fd8c1 | 493 | https://github.com/discolabs/cartjs/blob/98f749525ffc5b713c647ae0b4f024cf904fd8c1/src/core.coffee | 51 | 60 |
discolabs/cartjs:src/core.coffee:2:completion | completion | # Get the cart note.
getNote: () ->
CartJS.cart.note | # Set the cart note.
setNote: (note) ->
CartJS.Queue.add '/cart/update.js', { note: note }, CartJS.cart.update
#716986707 | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 98f749525ffc5b713c647ae0b4f024cf904fd8c1 | 493 | https://github.com/discolabs/cartjs/blob/98f749525ffc5b713c647ae0b4f024cf904fd8c1/src/core.coffee | 51 | 60 |
discolabs/cartjs:src/core.coffee:1:raw_corpus | raw_corpus | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, undefined, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, properties = {})... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 0241b35820e1dcecd0154552b444d3c2fe8422d0 | 493 | https://github.com/discolabs/cartjs/blob/0241b35820e1dcecd0154552b444d3c2fe8422d0/src/core.coffee | 1 | 50 | ||
discolabs/cartjs:src/core.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, undefined, 'GET'
# Add a new line item to... | // CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function() {
return CartJS.Queue.add('/cart.js', {}, void 0, 'GET');
},
// Add a new line item to the cart.
addItem: function(id, ... | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 0241b35820e1dcecd0154552b444d3c2fe8422d0 | 493 | https://github.com/discolabs/cartjs/blob/0241b35820e1dcecd0154552b444d3c2fe8422d0/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// CartJS.Core
// Core API methods for manipulating carts.
// ----------------------------------------
CartJS.Core = {
// Fetch updated cart object from API endpoint.
getCart: function() {
return CartJS.Queue.add('/cart.js', {}, void 0, 'GET');
},
// Ad... | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, undefined, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, properties = {})... | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 0241b35820e1dcecd0154552b444d3c2fe8422d0 | 493 | https://github.com/discolabs/cartjs/blob/0241b35820e1dcecd0154552b444d3c2fe8422d0/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:1:completion | completion | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: () ->
CartJS.Queue.add '/cart.js', {}, undefined, 'GET'
# Add a new line item to the cart.
addItem: (id, quantity = 1, properties = {})... | # Remove an existing line item.
removeItem: (line) ->
CartJS.Core.updateItem line, 0
# Clear all items from the cart.
clear: () ->
CartJS.Queue.add '/cart/clear.js'
# Get a cart attribute.
getAttribute: (attributeName, defaultValue) ->
if attributeName of CartJS.cart.attributes then CartJS.cart.... | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 0241b35820e1dcecd0154552b444d3c2fe8422d0 | 493 | https://github.com/discolabs/cartjs/blob/0241b35820e1dcecd0154552b444d3c2fe8422d0/src/core.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:2:raw_corpus | raw_corpus | # Get the cart note.
getNote: () ->
CartJS.cart.note
# Set the cart note.
setNote: (note) ->
CartJS.Queue.add '/cart/update.js', { note: note } | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 0241b35820e1dcecd0154552b444d3c2fe8422d0 | 493 | https://github.com/discolabs/cartjs/blob/0241b35820e1dcecd0154552b444d3c2fe8422d0/src/core.coffee | 51 | 57 | ||
discolabs/cartjs:src/core.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Get the cart note.
getNote: () ->
CartJS.cart.note
# Set the cart note.
setNote: (note) ->
CartJS.Queue.add '/cart/update.js', { note: note }
``` | // Get the cart note.
({
getNote: function() {
return CartJS.cart.note;
},
// Set the cart note.
setNote: function(note) {
return CartJS.Queue.add('/cart/update.js', {
note: note
});
}
}); | CoffeeScript | JavaScript | discolabs/cartjs | src/core.coffee | MIT | 0241b35820e1dcecd0154552b444d3c2fe8422d0 | 493 | https://github.com/discolabs/cartjs/blob/0241b35820e1dcecd0154552b444d3c2fe8422d0/src/core.coffee | 51 | 57 |
discolabs/cartjs:src/core.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Get the cart note.
({
getNote: function() {
return CartJS.cart.note;
},
// Set the cart note.
setNote: function(note) {
return CartJS.Queue.add('/cart/update.js', {
note: note
});
}
});
``` | # Get the cart note.
getNote: () ->
CartJS.cart.note
# Set the cart note.
setNote: (note) ->
CartJS.Queue.add '/cart/update.js', { note: note } | JavaScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 0241b35820e1dcecd0154552b444d3c2fe8422d0 | 493 | https://github.com/discolabs/cartjs/blob/0241b35820e1dcecd0154552b444d3c2fe8422d0/src/core.coffee | 51 | 57 |
discolabs/cartjs:src/core.coffee:2:completion | completion | # Get the cart note.
getNote: () ->
CartJS.cart.note | # Set the cart note.
setNote: (note) ->
CartJS.Queue.add '/cart/update.js', { note: note } | CoffeeScript | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 0241b35820e1dcecd0154552b444d3c2fe8422d0 | 493 | https://github.com/discolabs/cartjs/blob/0241b35820e1dcecd0154552b444d3c2fe8422d0/src/core.coffee | 51 | 57 |
jianliaoim/talk-os:talk-web/test/spec/updater/team-unread.spec.coffee:1:raw_corpus | raw_corpus | Immutable = require 'immutable'
describe 'Updater: unread and state', ->
store = _teamId = null
beforeEach ->
@unread = require 'updater/unread'
@notification = require 'updater/notification'
_teamId = '_teamId1'
store = Immutable.fromJS
device:
_teamId: '_teamId1'
teams:
... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/updater/team-unread.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/team-unread.spec.coffee | 1 | 47 | ||
jianliaoim/talk-os:talk-web/test/spec/updater/team-unread.spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Immutable = require 'immutable'
describe 'Updater: unread and state', ->
store = _teamId = null
beforeEach ->
@unread = require 'updater/unread'
@notification = require 'updater/notification'
_teamId = '_teamId1'
store = Immutable.fromJS
... | var Immutable;
Immutable = require('immutable');
describe('Updater: unread and state', function() {
var _teamId, store;
store = _teamId = null;
beforeEach(function() {
this.unread = require('updater/unread');
this.notification = require('updater/notification');
_teamId = '_teamId1';
return store... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/test/spec/updater/team-unread.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/team-unread.spec.coffee | 1 | 47 |
jianliaoim/talk-os:talk-web/test/spec/updater/team-unread.spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Immutable;
Immutable = require('immutable');
describe('Updater: unread and state', function() {
var _teamId, store;
store = _teamId = null;
beforeEach(function() {
this.unread = require('updater/unread');
this.notification = require('updater/not... | Immutable = require 'immutable'
describe 'Updater: unread and state', ->
store = _teamId = null
beforeEach ->
@unread = require 'updater/unread'
@notification = require 'updater/notification'
_teamId = '_teamId1'
store = Immutable.fromJS
device:
_teamId: '_teamId1'
teams:
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/updater/team-unread.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/team-unread.spec.coffee | 1 | 47 |
jianliaoim/talk-os:talk-web/test/spec/updater/team-unread.spec.coffee:1:completion | completion | Immutable = require 'immutable'
describe 'Updater: unread and state', ->
store = _teamId = null
beforeEach ->
@unread = require 'updater/unread'
@notification = require 'updater/notification'
_teamId = '_teamId1'
store = Immutable.fromJS
device:
_teamId: '_teamId1'
teams:
... | it 'should match unread num', ->
noty = store.getIn ['notifications', _teamId, 0]
resp = Immutable.fromJS
_id: '_id1'
_teamId: _teamId
unreadNum: 0
oldUnreadNum: 2
stateUnreadData = Immutable.fromJS
_teamId: _teamId
data:
_targetId1: 2
_targetId2: 8
s... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/updater/team-unread.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/updater/team-unread.spec.coffee | 1 | 47 |
jianliaoim/talk-os:talk-web/client/module/code-editor.coffee:1:raw_corpus | raw_corpus | cx = require 'classnames'
React = require 'react'
if typeof window isnt 'undefined'
codemirror = require 'codemirror'
require 'codemirror/addon/display/placeholder'
div = React.createFactory 'div'
textarea = React.createFactory 'textarea'
T = React.PropTypes
module.exports = React.createClass
displayName: 'li... | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/code-editor.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/code-editor.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-web/client/module/code-editor.coffee:1:completion | completion | cx = require 'classnames'
React = require 'react'
if typeof window isnt 'undefined'
codemirror = require 'codemirror'
require 'codemirror/addon/display/placeholder'
div = React.createFactory 'div'
textarea = React.createFactory 'textarea'
T = React.PropTypes
module.exports = React.createClass
displayName: 'li... | placeholder: 'Code goes here...'
readOnly: false
text: ''
componentDidMount: ->
@initEditor()
componentWillReceiveProps: (nextProps) ->
if @editor.getOption('mode') isnt nextProps.codeType
@editor.setOption 'mode', nextProps.codeType
initEditor: ->
@option =
indentUnit: 2
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/code-editor.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/code-editor.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/module/code-editor.coffee:2:raw_corpus | raw_corpus | 'Tab': (cm) ->
cm.replaceSelection ' ', 'end'
editor = @refs.editor
@editor = codemirror.fromTextArea editor, @option
@editor.on 'change', @onEditorChange
onEditorChange: ->
value = @editor.getValue()
@props.onChange value
renderEditor: ->
textarea
className: 'editor'
... | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/code-editor.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/code-editor.coffee | 51 | 75 | ||
jianliaoim/talk-os:talk-web/client/module/code-editor.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
'Tab': (cm) ->
cm.replaceSelection ' ', 'end'
editor = @refs.editor
@editor = codemirror.fromTextArea editor, @option
@editor.on 'change', @onEditorChange
onEditorChange: ->
value = @editor.getValue()
@props.onChange value
ren... | var editor;
({
'Tab': function(cm) {
return cm.replaceSelection(' ', 'end');
}
});
editor = this.refs.editor;
this.editor = codemirror.fromTextArea(editor, this.option);
this.editor.on('change', this.onEditorChange);
({
onEditorChange: function() {
var value;
value = this.editor.getValue();
... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/module/code-editor.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/code-editor.coffee | 51 | 75 |
jianliaoim/talk-os:talk-web/client/module/code-editor.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var editor;
({
'Tab': function(cm) {
return cm.replaceSelection(' ', 'end');
}
});
editor = this.refs.editor;
this.editor = codemirror.fromTextArea(editor, this.option);
this.editor.on('change', this.onEditorChange);
({
onEditorChange: function() {
... | 'Tab': (cm) ->
cm.replaceSelection ' ', 'end'
editor = @refs.editor
@editor = codemirror.fromTextArea editor, @option
@editor.on 'change', @onEditorChange
onEditorChange: ->
value = @editor.getValue()
@props.onChange value
renderEditor: ->
textarea
className: 'editor'
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/code-editor.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/code-editor.coffee | 51 | 75 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.