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
Nedomas/databound:src/databound.coffee:4:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class DataboundError constructor: (text) -> @message = "Databound: #{text}" DataboundError:: = new Error() ```
var DataboundError; DataboundError = class DataboundError { constructor(text) { this.message = `Databound: ${text}`; } }; DataboundError.prototype = new Error();
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
5eead32708a5601ade8a110b12b4e5726d4de2d6
452
https://github.com/Nedomas/databound/blob/5eead32708a5601ade8a110b12b4e5726d4de2d6/src/databound.coffee
164
168
Nedomas/databound:src/databound.coffee:4:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var DataboundError; DataboundError = class DataboundError { constructor(text) { this.message = `Databound: ${text}`; } }; DataboundError.prototype = new Error(); ```
class DataboundError constructor: (text) -> @message = "Databound: #{text}" DataboundError:: = new Error()
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
5eead32708a5601ade8a110b12b4e5726d4de2d6
452
https://github.com/Nedomas/databound/blob/5eead32708a5601ade8a110b12b4e5726d4de2d6/src/databound.coffee
164
168
Nedomas/databound:src/databound.coffee:4:completion
completion
class DataboundError constructor: (text) ->
@message = "Databound: #{text}" DataboundError:: = new Error()
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
5eead32708a5601ade8a110b12b4e5726d4de2d6
452
https://github.com/Nedomas/databound/blob/5eead32708a5601ade8a110b12b4e5726d4de2d6/src/databound.coffee
164
168
Nedomas/databound:src/databound.coffee:1:raw_corpus
raw_corpus
class Databound constructor: (@endpoint, @scope = {}, @options = {}) -> @extra_where_scopes = @options.extra_where_scopes or [] @records = [] @seeds = [] @properties = [] # ## Start of Configs # Functions ``request`` and ``promise`` are overritable Databound.API_URL = "" # Does a POST reques...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e
452
https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/src/databound.coffee
16
65
Nedomas/databound:src/databound.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class Databound constructor: (@endpoint, @scope = {}, @options = {}) -> @extra_where_scopes = @options.extra_where_scopes or [] @records = [] @seeds = [] @properties = [] # ## Start of Configs # Functions ``request`` and ``promise`` are ove...
var Databound; Databound = (function() { class Databound { constructor(endpoint, scope = {}, options = {}) { this.endpoint = endpoint; this.scope = scope; this.options = options; this.extra_where_scopes = this.options.extra_where_scopes || []; this.records = []; this.seeds = [...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e
452
https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/src/databound.coffee
16
65
Nedomas/databound:src/databound.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Databound; Databound = (function() { class Databound { constructor(endpoint, scope = {}, options = {}) { this.endpoint = endpoint; this.scope = scope; this.options = options; this.extra_where_scopes = this.options.extra_where_scop...
class Databound constructor: (@endpoint, @scope = {}, @options = {}) -> @extra_where_scopes = @options.extra_where_scopes or [] @records = [] @seeds = [] @properties = [] # ## Start of Configs # Functions ``request`` and ``promise`` are overritable Databound.API_URL = "" # Does a POST reques...
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e
452
https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/src/databound.coffee
16
65
Nedomas/databound:src/databound.coffee:1:completion
completion
class Databound constructor: (@endpoint, @scope = {}, @options = {}) -> @extra_where_scopes = @options.extra_where_scopes or [] @records = [] @seeds = [] @properties = [] # ## Start of Configs # Functions ``request`` and ``promise`` are overritable Databound.API_URL = "" # Does a POST reques...
@request(args...).then((resp) -> throw new Error 'Error in the backend' unless resp?.success _this.promise(resp) ).fail((e) -> if e.status == 405 throw new DataboundError(e.responseJSON.message) else throw new Error "Error in the backend with status #{e.status}" ) whe...
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e
452
https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/src/databound.coffee
16
65
Nedomas/databound:src/databound.coffee:2:raw_corpus
raw_corpus
find: (id) -> _this = @ @where(id: id).then -> _this.promise _this.take(id) # Return a single record by ``params`` # # ```coffeescript # User.findBy(name: 'John', city: 'New York').then (user) -> # alert "I'm John from New York" # ``` findBy: (params) -> _this = @ @where(params)...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e
452
https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript find: (id) -> _this = @ @where(id: id).then -> _this.promise _this.take(id) # Return a single record by ``params`` # # ```coffeescript # User.findBy(name: 'John', city: 'New York').then (user) -> # alert "I'm John from New York" # ``...
({ find: function(id) { var _this; _this = this; return this.where({ id: id }).then(function() { return _this.promise(_this.take(id)); }); }, // Return a single record by ``params`` // ```coffeescript // User.findBy(name: 'John', city: 'New York').then (user) -> // alert "...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e
452
https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript ({ find: function(id) { var _this; _this = this; return this.where({ id: id }).then(function() { return _this.promise(_this.take(id)); }); }, // Return a single record by ``params`` // ```coffeescript // User.findBy(name: ...
find: (id) -> _this = @ @where(id: id).then -> _this.promise _this.take(id) # Return a single record by ``params`` # # ```coffeescript # User.findBy(name: 'John', city: 'New York').then (user) -> # alert "I'm John from New York" # ``` findBy: (params) -> _this = @ @where(params)...
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e
452
https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:completion
completion
find: (id) -> _this = @ @where(id: id).then -> _this.promise _this.take(id) # Return a single record by ``params`` # # ```coffeescript # User.findBy(name: 'John', city: 'New York').then (user) -> # alert "I'm John from New York" # ``` findBy: (params) -> _this = @ @where(params)...
# User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated_user) -> # alert updated_user # # User.destroy(15).then (resp) -> # alert resp.success # ``` update: (params) -> @requestAndRefresh 'update', params destroy: (id) -> @requestAndRefresh 'des...
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e
452
https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:3:raw_corpus
raw_corpus
requestAndRefresh: (action, params) -> _this = @ # backend responds with: # # ```javascript # { # success: true, # id: record.id, # scoped_records: [] # } # ``` @wrappedRequest(action, params).then (resp) -> records = JSON.parse(resp.scoped_records) ...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e
452
https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/src/databound.coffee
116
147
Nedomas/databound:src/databound.coffee:3:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript requestAndRefresh: (action, params) -> _this = @ # backend responds with: # # ```javascript # { # success: true, # id: record.id, # scoped_records: [] # } # ``` @wrappedRequest(action, params).then (res...
({ requestAndRefresh: function(action, params) { var _this; _this = this; // backend responds with: // ```javascript // { // success: true, // id: record.id, // scoped_records: [] // } // ``` return this.wrappedRequest(action, params).then(function(resp) { ...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e
452
https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/src/databound.coffee
116
147
Nedomas/databound:src/databound.coffee:3:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript ({ requestAndRefresh: function(action, params) { var _this; _this = this; // backend responds with: // ```javascript // { // success: true, // id: record.id, // scoped_records: [] // } // ``` return thi...
requestAndRefresh: (action, params) -> _this = @ # backend responds with: # # ```javascript # { # success: true, # id: record.id, # scoped_records: [] # } # ``` @wrappedRequest(action, params).then (resp) -> records = JSON.parse(resp.scoped_records) ...
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e
452
https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/src/databound.coffee
116
147
Nedomas/databound:src/databound.coffee:3:completion
completion
requestAndRefresh: (action, params) -> _this = @ # backend responds with: # # ```javascript # { # success: true, # id: record.id, # scoped_records: [] # } # ``` @wrappedRequest(action, params).then (resp) -> records = JSON.parse(resp.scoped_records) ...
if resp.id _this.promise _this.take(resp.id) else _this.promise resp.success url: (action) -> if _.isEmpty(Databound.API_URL) "#{@endpoint}/#{action}" else "#{Databound.API_URL}/#{@endpoint}/#{action}" data: (params) -> scope: JSON.stringify(@scope) extra_where_sc...
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e
452
https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/src/databound.coffee
116
147
Nedomas/databound:src/databound.coffee:4:raw_corpus
raw_corpus
class DataboundError constructor: (text) -> @message = "DATABOUND ERROR - #{text}" DataboundError:: = new Error()
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e
452
https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/src/databound.coffee
149
153
Nedomas/databound:src/databound.coffee:4:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class DataboundError constructor: (text) -> @message = "DATABOUND ERROR - #{text}" DataboundError:: = new Error() ```
var DataboundError; DataboundError = class DataboundError { constructor(text) { this.message = `DATABOUND ERROR - ${text}`; } }; DataboundError.prototype = new Error();
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e
452
https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/src/databound.coffee
149
153
Nedomas/databound:src/databound.coffee:4:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var DataboundError; DataboundError = class DataboundError { constructor(text) { this.message = `DATABOUND ERROR - ${text}`; } }; DataboundError.prototype = new Error(); ```
class DataboundError constructor: (text) -> @message = "DATABOUND ERROR - #{text}" DataboundError:: = new Error()
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e
452
https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/src/databound.coffee
149
153
Nedomas/databound:src/databound.coffee:4:completion
completion
class DataboundError constructor: (text) ->
@message = "DATABOUND ERROR - #{text}" DataboundError:: = new Error()
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e
452
https://github.com/Nedomas/databound/blob/e8ca7dd05ec89ef852eb0f13e8cb6bf0b39f661e/src/databound.coffee
149
153
Nedomas/databound:src/databound.coffee:1:raw_corpus
raw_corpus
class Databound constructor: (@endpoint, @scope = {}, @options = {}) -> @extra_where_scopes = @options.extra_where_scopes or [] @records = [] @seeds = [] @properties = [] # ## Start of Configs # Functions ``request`` and ``promise`` are overritable Databound.API_URL = "" # Does a POST reques...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
846d707846a536119b33346588745bd183d80c1c
452
https://github.com/Nedomas/databound/blob/846d707846a536119b33346588745bd183d80c1c/src/databound.coffee
16
65
Nedomas/databound:src/databound.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class Databound constructor: (@endpoint, @scope = {}, @options = {}) -> @extra_where_scopes = @options.extra_where_scopes or [] @records = [] @seeds = [] @properties = [] # ## Start of Configs # Functions ``request`` and ``promise`` are ove...
var Databound; Databound = (function() { class Databound { constructor(endpoint, scope = {}, options = {}) { this.endpoint = endpoint; this.scope = scope; this.options = options; this.extra_where_scopes = this.options.extra_where_scopes || []; this.records = []; this.seeds = [...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
846d707846a536119b33346588745bd183d80c1c
452
https://github.com/Nedomas/databound/blob/846d707846a536119b33346588745bd183d80c1c/src/databound.coffee
16
65
Nedomas/databound:src/databound.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Databound; Databound = (function() { class Databound { constructor(endpoint, scope = {}, options = {}) { this.endpoint = endpoint; this.scope = scope; this.options = options; this.extra_where_scopes = this.options.extra_where_scop...
class Databound constructor: (@endpoint, @scope = {}, @options = {}) -> @extra_where_scopes = @options.extra_where_scopes or [] @records = [] @seeds = [] @properties = [] # ## Start of Configs # Functions ``request`` and ``promise`` are overritable Databound.API_URL = "" # Does a POST reques...
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
846d707846a536119b33346588745bd183d80c1c
452
https://github.com/Nedomas/databound/blob/846d707846a536119b33346588745bd183d80c1c/src/databound.coffee
16
65
Nedomas/databound:src/databound.coffee:1:completion
completion
class Databound constructor: (@endpoint, @scope = {}, @options = {}) -> @extra_where_scopes = @options.extra_where_scopes or [] @records = [] @seeds = [] @properties = [] # ## Start of Configs # Functions ``request`` and ``promise`` are overritable Databound.API_URL = "" # Does a POST reques...
@request(args...).then((resp) -> throw new Error 'Error in the backend' unless resp?.success _this.promise(resp) ).fail((e) -> if e.status == 405 throw new DataboundError(e.responseJSON.message) else throw new Error "Error in the backend with status #{e.status}" ) wh...
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
846d707846a536119b33346588745bd183d80c1c
452
https://github.com/Nedomas/databound/blob/846d707846a536119b33346588745bd183d80c1c/src/databound.coffee
16
65
Nedomas/databound:src/databound.coffee:2:raw_corpus
raw_corpus
# ``` find: (id) -> _this = @ @where(id: id).then -> _this.promise _this.take(id) # Return a single record by ``params`` # # ```coffeescript # User.findBy(name: 'John', city: 'New York').then (user) -> # alert "I'm John from New York" # ``` findBy: (params) -> _this = @ @where...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
846d707846a536119b33346588745bd183d80c1c
452
https://github.com/Nedomas/databound/blob/846d707846a536119b33346588745bd183d80c1c/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript # ``` find: (id) -> _this = @ @where(id: id).then -> _this.promise _this.take(id) # Return a single record by ``params`` # # ```coffeescript # User.findBy(name: 'John', city: 'New York').then (user) -> # alert "I'm John from New York...
// ``` ({ find: function(id) { var _this; _this = this; return this.where({ id: id }).then(function() { return _this.promise(_this.take(id)); }); }, // Return a single record by ``params`` // ```coffeescript // User.findBy(name: 'John', city: 'New York').then (user) -> // ...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
846d707846a536119b33346588745bd183d80c1c
452
https://github.com/Nedomas/databound/blob/846d707846a536119b33346588745bd183d80c1c/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript // ``` ({ find: function(id) { var _this; _this = this; return this.where({ id: id }).then(function() { return _this.promise(_this.take(id)); }); }, // Return a single record by ``params`` // ```coffeescript // User.findBy...
# ``` find: (id) -> _this = @ @where(id: id).then -> _this.promise _this.take(id) # Return a single record by ``params`` # # ```coffeescript # User.findBy(name: 'John', city: 'New York').then (user) -> # alert "I'm John from New York" # ``` findBy: (params) -> _this = @ @where...
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
846d707846a536119b33346588745bd183d80c1c
452
https://github.com/Nedomas/databound/blob/846d707846a536119b33346588745bd183d80c1c/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:completion
completion
# ``` find: (id) -> _this = @ @where(id: id).then -> _this.promise _this.take(id) # Return a single record by ``params`` # # ```coffeescript # User.findBy(name: 'John', city: 'New York').then (user) -> # alert "I'm John from New York" # ``` findBy: (params) -> _this = @ @where...
# User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated_user) -> # alert updated_user # # User.destroy(15).then (resp) -> # alert resp.success # ``` update: (params) -> @requestAndRefresh 'update', params destroy: (id) -> @requestAndRefresh 'des...
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
846d707846a536119b33346588745bd183d80c1c
452
https://github.com/Nedomas/databound/blob/846d707846a536119b33346588745bd183d80c1c/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:1:raw_corpus
raw_corpus
class Databound constructor: (@endpoint, @scope = {}, @options = {}) -> @extra_where_scopes = @options.extra_where_scopes or [] @records = [] @seeds = [] @properties = [] # ## Start of Configs # Functions ``request`` and ``promise`` are overritable Databound.API_URL = "" # Does a POST reques...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
eeb814be21f128412d2d138a0b55b09e2af1ef5b
452
https://github.com/Nedomas/databound/blob/eeb814be21f128412d2d138a0b55b09e2af1ef5b/src/databound.coffee
16
65
Nedomas/databound:src/databound.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class Databound constructor: (@endpoint, @scope = {}, @options = {}) -> @extra_where_scopes = @options.extra_where_scopes or [] @records = [] @seeds = [] @properties = [] # ## Start of Configs # Functions ``request`` and ``promise`` are ove...
var Databound; Databound = (function() { class Databound { constructor(endpoint, scope = {}, options = {}) { this.endpoint = endpoint; this.scope = scope; this.options = options; this.extra_where_scopes = this.options.extra_where_scopes || []; this.records = []; this.seeds = [...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
eeb814be21f128412d2d138a0b55b09e2af1ef5b
452
https://github.com/Nedomas/databound/blob/eeb814be21f128412d2d138a0b55b09e2af1ef5b/src/databound.coffee
16
65
Nedomas/databound:src/databound.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Databound; Databound = (function() { class Databound { constructor(endpoint, scope = {}, options = {}) { this.endpoint = endpoint; this.scope = scope; this.options = options; this.extra_where_scopes = this.options.extra_where_scop...
class Databound constructor: (@endpoint, @scope = {}, @options = {}) -> @extra_where_scopes = @options.extra_where_scopes or [] @records = [] @seeds = [] @properties = [] # ## Start of Configs # Functions ``request`` and ``promise`` are overritable Databound.API_URL = "" # Does a POST reques...
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
eeb814be21f128412d2d138a0b55b09e2af1ef5b
452
https://github.com/Nedomas/databound/blob/eeb814be21f128412d2d138a0b55b09e2af1ef5b/src/databound.coffee
16
65
Nedomas/databound:src/databound.coffee:1:completion
completion
class Databound constructor: (@endpoint, @scope = {}, @options = {}) -> @extra_where_scopes = @options.extra_where_scopes or [] @records = [] @seeds = [] @properties = [] # ## Start of Configs # Functions ``request`` and ``promise`` are overritable Databound.API_URL = "" # Does a POST reques...
@request('where', params).then (records) -> records = records.concat(_this.seeds) _this.records = _.sortBy(records, 'id') _this.promise _this.records # Return a single record by ``id`` # # ```coffeescript # User.find(15).then (user) -> # alert "Yo, #{user.name}" # ``` find: (id) -> ...
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
eeb814be21f128412d2d138a0b55b09e2af1ef5b
452
https://github.com/Nedomas/databound/blob/eeb814be21f128412d2d138a0b55b09e2af1ef5b/src/databound.coffee
16
65
Nedomas/databound:src/databound.coffee:2:raw_corpus
raw_corpus
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
eeb814be21f128412d2d138a0b55b09e2af1ef5b
452
https://github.com/Nedomas/databound/blob/eeb814be21f128412d2d138a0b55b09e2af1ef5b/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript @where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # ...
this.where(params).then(function(resp) { return _this.promise(_.first(_.values(resp))); }); ({ create: function(params) { return this.requestAndRefresh('create', params); }, // Specify ``id`` when updating or destroying the record. // ```coffeescript // User = new Databound '/users' // User.upd...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
eeb814be21f128412d2d138a0b55b09e2af1ef5b
452
https://github.com/Nedomas/databound/blob/eeb814be21f128412d2d138a0b55b09e2af1ef5b/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript this.where(params).then(function(resp) { return _this.promise(_.first(_.values(resp))); }); ({ create: function(params) { return this.requestAndRefresh('create', params); }, // Specify ``id`` when updating or destroying the record. // ```coffeescrip...
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
eeb814be21f128412d2d138a0b55b09e2af1ef5b
452
https://github.com/Nedomas/databound/blob/eeb814be21f128412d2d138a0b55b09e2af1ef5b/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:completion
completion
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
take: (id) -> _.detect @records, (record) -> id.toString() == record.id.toString() takeAll: -> @records # f.e. Have default records injectSeedRecords: (records) -> @seeds = records requestAndRefresh: (action, params) -> _this = @ # backend responds with: # # ```javascript ...
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
eeb814be21f128412d2d138a0b55b09e2af1ef5b
452
https://github.com/Nedomas/databound/blob/eeb814be21f128412d2d138a0b55b09e2af1ef5b/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:3:raw_corpus
raw_corpus
records = JSON.parse(resp.scoped_records) records_with_seeds = records.concat(_this.seeds) _this.records = _.sortBy(records_with_seeds, 'id') if resp.id _this.promise _this.take(resp.id) else _this.promise resp.success url: (action) -> if _.isEmpty(Databound.API_URL) ...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
eeb814be21f128412d2d138a0b55b09e2af1ef5b
452
https://github.com/Nedomas/databound/blob/eeb814be21f128412d2d138a0b55b09e2af1ef5b/src/databound.coffee
116
135
Nedomas/databound:src/databound.coffee:3:completion
completion
records = JSON.parse(resp.scoped_records) records_with_seeds = records.concat(_this.seeds) _this.records = _.sortBy(records_with_seeds, 'id') if resp.id _this.promise _this.take(resp.id) else _this.promise resp.success
url: (action) -> if _.isEmpty(Databound.API_URL) "#{@endpoint}/#{action}" else "#{Databound.API_URL}/#{@endpoint}/#{action}" data: (params) -> scope: JSON.stringify(@scope) extra_where_scopes: JSON.stringify(@extra_where_scopes) data: JSON.stringify(params)
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
eeb814be21f128412d2d138a0b55b09e2af1ef5b
452
https://github.com/Nedomas/databound/blob/eeb814be21f128412d2d138a0b55b09e2af1ef5b/src/databound.coffee
116
135
Nedomas/databound:src/databound.coffee:2:raw_corpus
raw_corpus
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
0f3980cbc78931dcc587a771558f3a3e9f712227
452
https://github.com/Nedomas/databound/blob/0f3980cbc78931dcc587a771558f3a3e9f712227/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript @where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # ...
this.where(params).then(function(resp) { return _this.promise(_.first(_.values(resp))); }); ({ create: function(params) { return this.requestAndRefresh('create', params); }, // Specify ``id`` when updating or destroying the record. // ```coffeescript // User = new Databound '/users' // User.upd...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
0f3980cbc78931dcc587a771558f3a3e9f712227
452
https://github.com/Nedomas/databound/blob/0f3980cbc78931dcc587a771558f3a3e9f712227/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript this.where(params).then(function(resp) { return _this.promise(_.first(_.values(resp))); }); ({ create: function(params) { return this.requestAndRefresh('create', params); }, // Specify ``id`` when updating or destroying the record. // ```coffeescrip...
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
0f3980cbc78931dcc587a771558f3a3e9f712227
452
https://github.com/Nedomas/databound/blob/0f3980cbc78931dcc587a771558f3a3e9f712227/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:completion
completion
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
take: (id) -> _.detect @records, (record) -> id.toString() == record.id.toString() takeAll: -> @records # f.e. Have default records injectSeedRecords: (records) -> @seeds = records requestAndRefresh: (action, params) -> _this = @ # backend responds with: # # ```javascript ...
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
0f3980cbc78931dcc587a771558f3a3e9f712227
452
https://github.com/Nedomas/databound/blob/0f3980cbc78931dcc587a771558f3a3e9f712227/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:1:raw_corpus
raw_corpus
class Databound constructor: (@endpoint, @scope = {}, @options = {}) -> @extra_find_scopes = @options.extra_find_scopes or [] @records = [] @seeds = [] @properties = [] # ## Start of Configs # Functions ``request`` and ``promise`` are overritable Databound.API_URL = "" # Does a POST request ...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
7295e25e39881e8c235c283fc8972da5a9d236a2
452
https://github.com/Nedomas/databound/blob/7295e25e39881e8c235c283fc8972da5a9d236a2/src/databound.coffee
16
65
Nedomas/databound:src/databound.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class Databound constructor: (@endpoint, @scope = {}, @options = {}) -> @extra_find_scopes = @options.extra_find_scopes or [] @records = [] @seeds = [] @properties = [] # ## Start of Configs # Functions ``request`` and ``promise`` are overr...
var Databound; Databound = (function() { class Databound { constructor(endpoint, scope = {}, options = {}) { this.endpoint = endpoint; this.scope = scope; this.options = options; this.extra_find_scopes = this.options.extra_find_scopes || []; this.records = []; this.seeds = [];...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
7295e25e39881e8c235c283fc8972da5a9d236a2
452
https://github.com/Nedomas/databound/blob/7295e25e39881e8c235c283fc8972da5a9d236a2/src/databound.coffee
16
65
Nedomas/databound:src/databound.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Databound; Databound = (function() { class Databound { constructor(endpoint, scope = {}, options = {}) { this.endpoint = endpoint; this.scope = scope; this.options = options; this.extra_find_scopes = this.options.extra_find_scopes...
class Databound constructor: (@endpoint, @scope = {}, @options = {}) -> @extra_find_scopes = @options.extra_find_scopes or [] @records = [] @seeds = [] @properties = [] # ## Start of Configs # Functions ``request`` and ``promise`` are overritable Databound.API_URL = "" # Does a POST request ...
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
7295e25e39881e8c235c283fc8972da5a9d236a2
452
https://github.com/Nedomas/databound/blob/7295e25e39881e8c235c283fc8972da5a9d236a2/src/databound.coffee
16
65
Nedomas/databound:src/databound.coffee:1:completion
completion
class Databound constructor: (@endpoint, @scope = {}, @options = {}) -> @extra_find_scopes = @options.extra_find_scopes or [] @records = [] @seeds = [] @properties = [] # ## Start of Configs # Functions ``request`` and ``promise`` are overritable Databound.API_URL = "" # Does a POST request ...
@request('where', params).then (records) -> records = records.concat(_this.seeds) _this.records = _.sortBy(records, 'id') _this.promise _this.records # Return a single record by ``id`` # # ```coffeescript # User.find(15).then (user) -> # alert "Yo, #{user.name}" # ``` find: (id) -> ...
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
7295e25e39881e8c235c283fc8972da5a9d236a2
452
https://github.com/Nedomas/databound/blob/7295e25e39881e8c235c283fc8972da5a9d236a2/src/databound.coffee
16
65
Nedomas/databound:src/databound.coffee:2:raw_corpus
raw_corpus
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
7295e25e39881e8c235c283fc8972da5a9d236a2
452
https://github.com/Nedomas/databound/blob/7295e25e39881e8c235c283fc8972da5a9d236a2/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript @where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # ...
this.where(params).then(function(resp) { return _this.promise(_.first(_.values(resp))); }); ({ create: function(params) { return this.requestAndRefresh('create', params); }, // Specify ``id`` when updating or destroying the record. // ```coffeescript // User = new Databound '/users' // User.upd...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
7295e25e39881e8c235c283fc8972da5a9d236a2
452
https://github.com/Nedomas/databound/blob/7295e25e39881e8c235c283fc8972da5a9d236a2/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript this.where(params).then(function(resp) { return _this.promise(_.first(_.values(resp))); }); ({ create: function(params) { return this.requestAndRefresh('create', params); }, // Specify ``id`` when updating or destroying the record. // ```coffeescrip...
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
7295e25e39881e8c235c283fc8972da5a9d236a2
452
https://github.com/Nedomas/databound/blob/7295e25e39881e8c235c283fc8972da5a9d236a2/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:completion
completion
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
take: (id) -> _.detect @records, (record) -> id.toString() == record.id.toString() takeAll: -> @records # F.e. Have default records injectSeedRecords: (records) -> @seeds = records requestAndRefresh: (action, params) -> _this = @ # backend responds with: # # ```javascript ...
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
7295e25e39881e8c235c283fc8972da5a9d236a2
452
https://github.com/Nedomas/databound/blob/7295e25e39881e8c235c283fc8972da5a9d236a2/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:3:raw_corpus
raw_corpus
records = JSON.parse(resp.scoped_records) records_with_seeds = records.concat(_this.seeds) _this.records = _.sortBy(records_with_seeds, 'id') if resp.id _this.promise _this.take(resp.id) else _this.promise resp.success url: (action) -> if _.isEmpty(Databound.API_URL) ...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
7295e25e39881e8c235c283fc8972da5a9d236a2
452
https://github.com/Nedomas/databound/blob/7295e25e39881e8c235c283fc8972da5a9d236a2/src/databound.coffee
116
135
Nedomas/databound:src/databound.coffee:3:completion
completion
records = JSON.parse(resp.scoped_records) records_with_seeds = records.concat(_this.seeds) _this.records = _.sortBy(records_with_seeds, 'id') if resp.id _this.promise _this.take(resp.id) else _this.promise resp.success
url: (action) -> if _.isEmpty(Databound.API_URL) "#{@endpoint}/#{action}" else "#{Databound.API_URL}/#{@endpoint}/#{action}" data: (params) -> scope: JSON.stringify(@scope) extra_find_scopes: JSON.stringify(@extra_find_scopes) data: JSON.stringify(params)
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
7295e25e39881e8c235c283fc8972da5a9d236a2
452
https://github.com/Nedomas/databound/blob/7295e25e39881e8c235c283fc8972da5a9d236a2/src/databound.coffee
116
135
Nedomas/databound:src/databound.coffee:2:raw_corpus
raw_corpus
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
e3a1f36882b7418b5a264267f1bcff8d70fdae65
452
https://github.com/Nedomas/databound/blob/e3a1f36882b7418b5a264267f1bcff8d70fdae65/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript @where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # ...
this.where(params).then(function(resp) { return _this.promise(_.first(_.values(resp))); }); ({ create: function(params) { return this.requestAndRefresh('create', params); }, // Specify ``id`` when updating or destroying the record. // ```coffeescript // User = new Databound '/users' // User.upd...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
e3a1f36882b7418b5a264267f1bcff8d70fdae65
452
https://github.com/Nedomas/databound/blob/e3a1f36882b7418b5a264267f1bcff8d70fdae65/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript this.where(params).then(function(resp) { return _this.promise(_.first(_.values(resp))); }); ({ create: function(params) { return this.requestAndRefresh('create', params); }, // Specify ``id`` when updating or destroying the record. // ```coffeescrip...
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
e3a1f36882b7418b5a264267f1bcff8d70fdae65
452
https://github.com/Nedomas/databound/blob/e3a1f36882b7418b5a264267f1bcff8d70fdae65/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:completion
completion
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
take: (id) -> _.detect @records, (record) -> id.toString() == record.id.toString() takeAll: -> @records # F.e. Have default records injectSeedRecords: (records) -> @seeds = records requestAndRefresh: (action, params) -> _this = @ # backend responds with: # # ```javascript ...
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
e3a1f36882b7418b5a264267f1bcff8d70fdae65
452
https://github.com/Nedomas/databound/blob/e3a1f36882b7418b5a264267f1bcff8d70fdae65/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:raw_corpus
raw_corpus
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
29e8962502b90b1af2520122e849311e02ebfb5e
452
https://github.com/Nedomas/databound/blob/29e8962502b90b1af2520122e849311e02ebfb5e/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript @where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # ...
this.where(params).then(function(resp) { return _this.promise(_.first(_.values(resp))); }); ({ create: function(params) { return this.requestAndRefresh('create', params); }, // Specify ``id`` when updating or destroying the record. // ```coffeescript // User = new Databound '/users' // User.upd...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
29e8962502b90b1af2520122e849311e02ebfb5e
452
https://github.com/Nedomas/databound/blob/29e8962502b90b1af2520122e849311e02ebfb5e/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript this.where(params).then(function(resp) { return _this.promise(_.first(_.values(resp))); }); ({ create: function(params) { return this.requestAndRefresh('create', params); }, // Specify ``id`` when updating or destroying the record. // ```coffeescrip...
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
29e8962502b90b1af2520122e849311e02ebfb5e
452
https://github.com/Nedomas/databound/blob/29e8962502b90b1af2520122e849311e02ebfb5e/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:completion
completion
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
take: (id) -> _.detect @records, (record) -> id.toString() == record.id.toString() takeAll: -> @records # F.e. Have default records injectSeedRecords: (records) -> @seeds = records requestAndRefresh: (action, params) -> _this = @ # backend responds with: # ```javascript # {...
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
29e8962502b90b1af2520122e849311e02ebfb5e
452
https://github.com/Nedomas/databound/blob/29e8962502b90b1af2520122e849311e02ebfb5e/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:raw_corpus
raw_corpus
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
4d74700fb97fbe50add84dce2a5ca482a5e686cd
452
https://github.com/Nedomas/databound/blob/4d74700fb97fbe50add84dce2a5ca482a5e686cd/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript @where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # ...
this.where(params).then(function(resp) { return _this.promise(_.first(_.values(resp))); }); ({ create: function(params) { return this.requestAndRefresh('create', params); }, // Specify ``id`` when updating or destroying the record. // ```coffeescript // User = new Databound '/users' // User.upd...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
4d74700fb97fbe50add84dce2a5ca482a5e686cd
452
https://github.com/Nedomas/databound/blob/4d74700fb97fbe50add84dce2a5ca482a5e686cd/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript this.where(params).then(function(resp) { return _this.promise(_.first(_.values(resp))); }); ({ create: function(params) { return this.requestAndRefresh('create', params); }, // Specify ``id`` when updating or destroying the record. // ```coffeescrip...
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
4d74700fb97fbe50add84dce2a5ca482a5e686cd
452
https://github.com/Nedomas/databound/blob/4d74700fb97fbe50add84dce2a5ca482a5e686cd/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:2:completion
completion
@where(params).then (resp) -> _this.promise _.first(_.values(resp)) create: (params) -> @requestAndRefresh 'create', params # Specify ``id`` when updating or destroying the record. # # ```coffeescript # User = new Databound '/users' # # User.update(id: 15, name: 'Saint John').then (updated...
take: (id) -> _.detect @records, (record) -> id.toString() == record.id.toString() takeAll: -> @records # F.e. Have default records injectSeedRecords: (records) -> @seeds = records requestAndRefresh: (action, params) -> _this = @ # backend responds with: # { # success: tr...
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
4d74700fb97fbe50add84dce2a5ca482a5e686cd
452
https://github.com/Nedomas/databound/blob/4d74700fb97fbe50add84dce2a5ca482a5e686cd/src/databound.coffee
66
115
Nedomas/databound:src/databound.coffee:3:raw_corpus
raw_corpus
_this.records = _.sortBy(records_with_seeds, 'id') if resp.id _this.promise _this.take(resp.id) else _this.promise resp.success url: (action) -> if _.isEmpty(Databound.API_URL) "#{@endpoint}/#{action}" else "#{Databound.API_URL}/#{@endpoint}/#{action}" data: (param...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
4d74700fb97fbe50add84dce2a5ca482a5e686cd
452
https://github.com/Nedomas/databound/blob/4d74700fb97fbe50add84dce2a5ca482a5e686cd/src/databound.coffee
116
132
Nedomas/databound:src/databound.coffee:3:completion
completion
_this.records = _.sortBy(records_with_seeds, 'id') if resp.id _this.promise _this.take(resp.id) else _this.promise resp.success url: (action) ->
if _.isEmpty(Databound.API_URL) "#{@endpoint}/#{action}" else "#{Databound.API_URL}/#{@endpoint}/#{action}" data: (params) -> scope: JSON.stringify(@scope) extra_find_scopes: JSON.stringify(@extra_find_scopes) data: JSON.stringify(params)
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
4d74700fb97fbe50add84dce2a5ca482a5e686cd
452
https://github.com/Nedomas/databound/blob/4d74700fb97fbe50add84dce2a5ca482a5e686cd/src/databound.coffee
116
132
Nedomas/databound:src/databound.coffee:1:raw_corpus
raw_corpus
Databound = (endpoint, scope, options) -> @endpoint = endpoint @scope = scope or {} @options = options or {} @extra_find_scopes = @options.extra_find_scopes or [] @records = [] @seeds = [] @properties = [] return # ## Configs # Functions ``request`` and ``promise`` are overritable Databound.API_URL = ...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
16
31
Nedomas/databound:src/databound.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript Databound = (endpoint, scope, options) -> @endpoint = endpoint @scope = scope or {} @options = options or {} @extra_find_scopes = @options.extra_find_scopes or [] @records = [] @seeds = [] @properties = [] return # ## Configs # Functions ``reque...
var Databound; Databound = function(endpoint, scope, options) { this.endpoint = endpoint; this.scope = scope || {}; this.options = options || {}; this.extra_find_scopes = this.options.extra_find_scopes || []; this.records = []; this.seeds = []; this.properties = []; }; // ## Configs // Functions ``requ...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
16
31
Nedomas/databound:src/databound.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Databound; Databound = function(endpoint, scope, options) { this.endpoint = endpoint; this.scope = scope || {}; this.options = options || {}; this.extra_find_scopes = this.options.extra_find_scopes || []; this.records = []; this.seeds = []; this....
Databound = (endpoint, scope, options) -> @endpoint = endpoint @scope = scope or {} @options = options or {} @extra_find_scopes = @options.extra_find_scopes or [] @records = [] @seeds = [] @properties = [] return # ## Configs # Functions ``request`` and ``promise`` are overritable Databound.API_URL = ...
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
16
31
Nedomas/databound:src/databound.coffee:1:completion
completion
Databound = (endpoint, scope, options) -> @endpoint = endpoint @scope = scope or {} @options = options or {} @extra_find_scopes = @options.extra_find_scopes or [] @records = [] @seeds = [] @properties = []
return # ## Configs # Functions ``request`` and ``promise`` are overritable Databound.API_URL = "" # Does a POST request and returns a ``promise``
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
16
31
Nedomas/databound:src/databound.coffee:2:raw_corpus
raw_corpus
Databound::request = (action, params) -> jQuery.post @url(action), @data(params), 'json' # Returns a ``promise`` which resolves with ``result``
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
32
35
Nedomas/databound:src/databound.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript Databound::request = (action, params) -> jQuery.post @url(action), @data(params), 'json' # Returns a ``promise`` which resolves with ``result`` ```
Databound.prototype.request = function(action, params) { return jQuery.post(this.url(action), this.data(params), 'json'); }; // Returns a ``promise`` which resolves with ``result``
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
32
35
Nedomas/databound:src/databound.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript Databound.prototype.request = function(action, params) { return jQuery.post(this.url(action), this.data(params), 'json'); }; // Returns a ``promise`` which resolves with ``result`` ```
Databound::request = (action, params) -> jQuery.post @url(action), @data(params), 'json' # Returns a ``promise`` which resolves with ``result``
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
32
35
Nedomas/databound:src/databound.coffee:3:raw_corpus
raw_corpus
Databound::promise = (result) -> deferred = jQuery.Deferred() deferred.resolve result deferred.promise()
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
36
39
Nedomas/databound:src/databound.coffee:3:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript Databound::promise = (result) -> deferred = jQuery.Deferred() deferred.resolve result deferred.promise() ```
Databound.prototype.promise = function(result) { var deferred; deferred = jQuery.Deferred(); deferred.resolve(result); return deferred.promise(); };
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
36
39
Nedomas/databound:src/databound.coffee:3:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript Databound.prototype.promise = function(result) { var deferred; deferred = jQuery.Deferred(); deferred.resolve(result); return deferred.promise(); }; ```
Databound::promise = (result) -> deferred = jQuery.Deferred() deferred.resolve result deferred.promise()
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
36
39
Nedomas/databound:src/databound.coffee:3:completion
completion
Databound::promise = (result) -> deferred = jQuery.Deferred()
deferred.resolve result deferred.promise()
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
36
39
Nedomas/databound:src/databound.coffee:4:raw_corpus
raw_corpus
Databound::where = (params) -> _this = @ @request('where', params).then (records) -> records = records.concat(_this.seeds) _this.records = _.sortBy(records, 'id') _this.promise _this.records # Return a single record by ``id`` # # ```coffeescript # User.find(15).then (user) -> # alert "Yo, #{user.nam...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
41
54
Nedomas/databound:src/databound.coffee:4:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript Databound::where = (params) -> _this = @ @request('where', params).then (records) -> records = records.concat(_this.seeds) _this.records = _.sortBy(records, 'id') _this.promise _this.records # Return a single record by ``id`` # # ```coffeescript...
Databound.prototype.where = function(params) { var _this; _this = this; return this.request('where', params).then(function(records) { records = records.concat(_this.seeds); _this.records = _.sortBy(records, 'id'); return _this.promise(_this.records); }); }; // Return a single record by ``id`` // `...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
41
54
Nedomas/databound:src/databound.coffee:4:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript Databound.prototype.where = function(params) { var _this; _this = this; return this.request('where', params).then(function(records) { records = records.concat(_this.seeds); _this.records = _.sortBy(records, 'id'); return _this.promise(_this.record...
Databound::where = (params) -> _this = @ @request('where', params).then (records) -> records = records.concat(_this.seeds) _this.records = _.sortBy(records, 'id') _this.promise _this.records # Return a single record by ``id`` # # ```coffeescript # User.find(15).then (user) -> # alert "Yo, #{user.nam...
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
41
54
Nedomas/databound:src/databound.coffee:5:raw_corpus
raw_corpus
Databound::find = (id) -> _this = @ @where(id: id).then -> _this.promise _this.take(id) # Return a single record by ``params`` # # ```coffeescript # User.findBy(name: 'John', city: 'New York').then (user) -> # alert "I'm John from New York" # ```
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
55
66
Nedomas/databound:src/databound.coffee:5:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript Databound::find = (id) -> _this = @ @where(id: id).then -> _this.promise _this.take(id) # Return a single record by ``params`` # # ```coffeescript # User.findBy(name: 'John', city: 'New York').then (user) -> # alert "I'm John from New York" # ``` ```
Databound.prototype.find = function(id) { var _this; _this = this; return this.where({ id: id }).then(function() { return _this.promise(_this.take(id)); }); }; // Return a single record by ``params`` // ```coffeescript // User.findBy(name: 'John', city: 'New York').then (user) -> // alert "I'm Joh...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
55
66
Nedomas/databound:src/databound.coffee:5:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript Databound.prototype.find = function(id) { var _this; _this = this; return this.where({ id: id }).then(function() { return _this.promise(_this.take(id)); }); }; // Return a single record by ``params`` // ```coffeescript // User.findBy(name: 'John...
Databound::find = (id) -> _this = @ @where(id: id).then -> _this.promise _this.take(id) # Return a single record by ``params`` # # ```coffeescript # User.findBy(name: 'John', city: 'New York').then (user) -> # alert "I'm John from New York" # ```
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
55
66
Nedomas/databound:src/databound.coffee:6:raw_corpus
raw_corpus
Databound::findBy = (params) -> _this = @ @where(params).then (resp) -> _this.promise _.first(_.values(resp))
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
67
71
Nedomas/databound:src/databound.coffee:6:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript Databound::findBy = (params) -> _this = @ @where(params).then (resp) -> _this.promise _.first(_.values(resp)) ```
Databound.prototype.findBy = function(params) { var _this; _this = this; return this.where(params).then(function(resp) { return _this.promise(_.first(_.values(resp))); }); };
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
67
71
Nedomas/databound:src/databound.coffee:6:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript Databound.prototype.findBy = function(params) { var _this; _this = this; return this.where(params).then(function(resp) { return _this.promise(_.first(_.values(resp))); }); }; ```
Databound::findBy = (params) -> _this = @ @where(params).then (resp) -> _this.promise _.first(_.values(resp))
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
67
71
Nedomas/databound:src/databound.coffee:6:completion
completion
Databound::findBy = (params) -> _this = @
@where(params).then (resp) -> _this.promise _.first(_.values(resp))
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
67
71
Nedomas/databound:src/databound.coffee:9:raw_corpus
raw_corpus
Databound::destroy = (params) -> @requestAndRefresh 'destroy', params # Just take already dowloaded records
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
90
93
Nedomas/databound:src/databound.coffee:9:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript Databound::destroy = (params) -> @requestAndRefresh 'destroy', params # Just take already dowloaded records ```
Databound.prototype.destroy = function(params) { return this.requestAndRefresh('destroy', params); }; // Just take already dowloaded records
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
90
93
Nedomas/databound:src/databound.coffee:9:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript Databound.prototype.destroy = function(params) { return this.requestAndRefresh('destroy', params); }; // Just take already dowloaded records ```
Databound::destroy = (params) -> @requestAndRefresh 'destroy', params # Just take already dowloaded records
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
90
93
Nedomas/databound:src/databound.coffee:10:raw_corpus
raw_corpus
Databound::take = (id) -> _this = @ _.detect @records, (record) -> id.toString() == record.id.toString()
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
94
98
Nedomas/databound:src/databound.coffee:10:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript Databound::take = (id) -> _this = @ _.detect @records, (record) -> id.toString() == record.id.toString() ```
Databound.prototype.take = function(id) { var _this; _this = this; return _.detect(this.records, function(record) { return id.toString() === record.id.toString(); }); };
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
94
98
Nedomas/databound:src/databound.coffee:10:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript Databound.prototype.take = function(id) { var _this; _this = this; return _.detect(this.records, function(record) { return id.toString() === record.id.toString(); }); }; ```
Databound::take = (id) -> _this = @ _.detect @records, (record) -> id.toString() == record.id.toString()
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
94
98
Nedomas/databound:src/databound.coffee:10:completion
completion
Databound::take = (id) -> _this = @
_.detect @records, (record) -> id.toString() == record.id.toString()
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
94
98
Nedomas/databound:src/databound.coffee:11:raw_corpus
raw_corpus
Databound::takeAll = -> @records # F.e. Have default records
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
100
103
Nedomas/databound:src/databound.coffee:11:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript Databound::takeAll = -> @records # F.e. Have default records ```
Databound.prototype.takeAll = function() { return this.records; }; // F.e. Have default records
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
100
103
Nedomas/databound:src/databound.coffee:11:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript Databound.prototype.takeAll = function() { return this.records; }; // F.e. Have default records ```
Databound::takeAll = -> @records # F.e. Have default records
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
100
103
Nedomas/databound:src/databound.coffee:13:raw_corpus
raw_corpus
Databound::requestAndRefresh = (action, params) -> _this = @ # backend responds with: # { # success: true, # id: record.id, # scoped_records: [] # } @request(action, params).then (resp) -> throw new Error 'Error in the backend' unless resp?.success records = JSON.parse(resp.scoped_record...
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
107
126
Nedomas/databound:src/databound.coffee:13:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript Databound::requestAndRefresh = (action, params) -> _this = @ # backend responds with: # { # success: true, # id: record.id, # scoped_records: [] # } @request(action, params).then (resp) -> throw new Error 'Error in the backend' unless r...
Databound.prototype.requestAndRefresh = function(action, params) { var _this; _this = this; // backend responds with: // { // success: true, // id: record.id, // scoped_records: [] // } return this.request(action, params).then(function(resp) { var records, records_with_seeds; if (!(resp ...
CoffeeScript
JavaScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
107
126
Nedomas/databound:src/databound.coffee:13:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript Databound.prototype.requestAndRefresh = function(action, params) { var _this; _this = this; // backend responds with: // { // success: true, // id: record.id, // scoped_records: [] // } return this.request(action, params).then(function(resp)...
Databound::requestAndRefresh = (action, params) -> _this = @ # backend responds with: # { # success: true, # id: record.id, # scoped_records: [] # } @request(action, params).then (resp) -> throw new Error 'Error in the backend' unless resp?.success records = JSON.parse(resp.scoped_record...
JavaScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
107
126
Nedomas/databound:src/databound.coffee:13:completion
completion
Databound::requestAndRefresh = (action, params) -> _this = @ # backend responds with: # { # success: true, # id: record.id, # scoped_records: [] # } @request(action, params).then (resp) ->
throw new Error 'Error in the backend' unless resp?.success records = JSON.parse(resp.scoped_records) records_with_seeds = records.concat(_this.seeds) _this.records = _.sortBy(records_with_seeds, 'id') if resp.id _this.promise _this.take(resp.id) else _this.promise resp.success
CoffeeScript
CoffeeScript
Nedomas/databound
src/databound.coffee
MIT
3298bfbdb88366d938c1aa0bc30b30664cb7a216
452
https://github.com/Nedomas/databound/blob/3298bfbdb88366d938c1aa0bc30b30664cb7a216/src/databound.coffee
107
126