I hereby claim:
- I am misantronic on github.
- I am misantronic (https://keybase.io/misantronic) on keybase.
- I have a public key whose fingerprint is F301 523A 7317 9F3C 1BDA 42E8 36C1 CF7A DF2B 3A16
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Model = Backbone.Model.extend({ | |
get: function (attribute) { | |
var value = Backbone.Model.prototype.get.call(this, attribute); | |
if(_.isFunction(value)) { | |
value = value.call(this); | |
} | |
return value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Backbone.Model.extend({ | |
/** | |
* Return the model itself instead of fetched-data object | |
* @param {Object} [options] | |
* @returns {jQuery} | |
*/ | |
fetch: function (options) { | |
options = options || {}; | |
var self = this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { db, binding, vm, misc } from 'baqend'; | |
import { | |
observable, | |
decorate, | |
isObservableArray, | |
reaction, | |
IReactionDisposer | |
} from 'mobx'; | |
function isObject(obj): boolean { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { observable, computed } from 'mobx'; | |
type WrapRequestState = 'loading' | 'fetched' | 'error'; | |
/** @see https://stackoverflow.com/a/4994244/1138860 */ | |
// tslint:disable-next-line:cyclomatic-complexity no-any | |
function isEmpty(obj: any): boolean { | |
if (!obj) return true; | |
if (obj > 0) return false; | |
if (obj.length > 0) return false; |