Fix comments

This commit is contained in:
Raymond Feng 2015-05-18 09:34:25 -07:00
parent 1bd5e74a13
commit be38cb3a6f
1 changed files with 45 additions and 37 deletions

View File

@ -1417,7 +1417,7 @@ BelongsTo.prototype.related = function (condOrRefresh, options, cb) {
cb = condOrRefresh; cb = condOrRefresh;
condOrRefresh = false; condOrRefresh = false;
} else if (typeof options === 'function' && cb === undefined) { } else if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // order.customer(condOrRefresh, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -1518,7 +1518,7 @@ BelongsTo.prototype.related = function (condOrRefresh, options, cb) {
*/ */
BelongsTo.prototype.getAsync = function (options, cb) { BelongsTo.prototype.getAsync = function (options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // order.customer.getAsync(cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -1684,7 +1684,7 @@ RelationDefinition.hasOne = function (modelFrom, modelTo, params) {
*/ */
HasOne.prototype.create = function (targetModelData, options, cb) { HasOne.prototype.create = function (targetModelData, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.profile.create(options, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -1727,7 +1727,7 @@ HasOne.prototype.create = function (targetModelData, options, cb) {
HasOne.prototype.update = function(targetModelData, options, cb) { HasOne.prototype.update = function(targetModelData, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.profile.update(data, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -1748,7 +1748,7 @@ HasOne.prototype.update = function(targetModelData, options, cb) {
HasOne.prototype.destroy = function (options, cb) { HasOne.prototype.destroy = function (options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.profile.destroy(cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -1773,7 +1773,7 @@ HasOne.prototype.destroy = function (options, cb) {
*/ */
HasMany.prototype.create = function (targetModelData, options, cb) { HasMany.prototype.create = function (targetModelData, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.orders.create(data, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -1861,11 +1861,11 @@ HasOne.prototype.related = function (condOrRefresh, options, cb) {
condOrRefresh = false; condOrRefresh = false;
} else if (typeof condOrRefresh === 'function' && } else if (typeof condOrRefresh === 'function' &&
options === undefined && cb === undefined) { options === undefined && cb === undefined) {
// order.customer(cb) // customer.profile(cb)
cb = condOrRefresh; cb = condOrRefresh;
condOrRefresh = false; condOrRefresh = false;
} else if (typeof options === 'function' && cb === undefined) { } else if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.profile(condOrRefresh, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -1925,7 +1925,7 @@ HasOne.prototype.related = function (condOrRefresh, options, cb) {
HasOne.prototype.getAsync = function (options, cb) { HasOne.prototype.getAsync = function (options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // order.profile.getAsync(cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -2054,7 +2054,7 @@ EmbedsOne.prototype.related = function (condOrRefresh, options, cb) {
cb = condOrRefresh; cb = condOrRefresh;
condOrRefresh = false; condOrRefresh = false;
} else if (typeof options === 'function' && cb === undefined) { } else if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // order.customer(condOrRefresh, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -2089,7 +2089,7 @@ EmbedsOne.prototype.embeddedValue = function(modelInstance) {
EmbedsOne.prototype.create = function (targetModelData, options, cb) { EmbedsOne.prototype.create = function (targetModelData, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // order.customer.create(data, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -2170,7 +2170,7 @@ EmbedsOne.prototype.build = function (targetModelData) {
EmbedsOne.prototype.update = function (targetModelData, options, cb) { EmbedsOne.prototype.update = function (targetModelData, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // order.customer.update(data, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -2200,7 +2200,7 @@ EmbedsOne.prototype.update = function (targetModelData, options, cb) {
EmbedsOne.prototype.destroy = function (options, cb) { EmbedsOne.prototype.destroy = function (options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // order.customer.destroy(cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -2424,10 +2424,11 @@ EmbedsMany.prototype.related = function(receiver, scopeParams, condOrRefresh, op
if (typeof condOrRefresh === 'function' && if (typeof condOrRefresh === 'function' &&
options === undefined && cb === undefined) { options === undefined && cb === undefined) {
// customer.emails(receiver, scopeParams, cb)
cb = condOrRefresh; cb = condOrRefresh;
condOrRefresh = false; condOrRefresh = false;
} else if (typeof options === 'function' && cb === undefined) { } else if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.emails(receiver, scopeParams, condOrRefresh, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -2460,7 +2461,7 @@ EmbedsMany.prototype.related = function(receiver, scopeParams, condOrRefresh, op
EmbedsMany.prototype.findById = function (fkId, options, cb) { EmbedsMany.prototype.findById = function (fkId, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // order.emails(fkId, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -2492,7 +2493,7 @@ EmbedsMany.prototype.findById = function (fkId, options, cb) {
EmbedsMany.prototype.exists = function (fkId, options, cb) { EmbedsMany.prototype.exists = function (fkId, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.emails.exists(fkId, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -2505,11 +2506,12 @@ EmbedsMany.prototype.exists = function (fkId, options, cb) {
EmbedsMany.prototype.updateById = function (fkId, data, options, cb) { EmbedsMany.prototype.updateById = function (fkId, data, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.emails.updateById(fkId, data, cb)
cb = options; cb = options;
options = {}; options = {};
} }
if (typeof data === 'function') { if (typeof data === 'function') {
// customer.emails.updateById(fkId, cb)
cb = data; cb = data;
data = {}; data = {};
} }
@ -2549,7 +2551,7 @@ EmbedsMany.prototype.updateById = function (fkId, data, options, cb) {
EmbedsMany.prototype.destroyById = function (fkId, options, cb) { EmbedsMany.prototype.destroyById = function (fkId, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.emails.destroyById(fkId, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -2579,11 +2581,15 @@ EmbedsMany.prototype.destroyById = function (fkId, options, cb) {
EmbedsMany.prototype.destroyAll = function(where, options, cb) { EmbedsMany.prototype.destroyAll = function(where, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.emails.destroyAll(where, cb);
cb = options; cb = options;
options = {}; options = {};
} else if (typeof where === 'function' &&
options === undefined && cb === undefined) {
// customer.emails.destroyAll(cb);
cb = where;
where = {};
} }
if (typeof where === 'function') cb = where, where = {};
var propertyName = this.definition.keyFrom; var propertyName = this.definition.keyFrom;
var modelInstance = this.modelInstance; var modelInstance = this.modelInstance;
@ -2636,7 +2642,7 @@ EmbedsMany.prototype.create = function (targetModelData, options, cb) {
var modelInstance = this.modelInstance; var modelInstance = this.modelInstance;
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.emails.create(cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -2737,11 +2743,12 @@ EmbedsMany.prototype.build = function(targetModelData) {
*/ */
EmbedsMany.prototype.add = function (acInst, data, options, cb) { EmbedsMany.prototype.add = function (acInst, data, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.emails.add(acInst, data, cb)
cb = options; cb = options;
options = {}; options = {};
} } else if (typeof data === 'function' &&
if (typeof data === 'function') { options === undefined && cb === undefined) {
// customer.emails.add(acInst, cb)
cb = data; cb = data;
data = {}; data = {};
} }
@ -2790,7 +2797,7 @@ EmbedsMany.prototype.add = function (acInst, data, options, cb) {
*/ */
EmbedsMany.prototype.remove = function (acInst, options, cb) { EmbedsMany.prototype.remove = function (acInst, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.emails.remove(acInst, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -2934,11 +2941,11 @@ ReferencesMany.prototype.related = function(receiver, scopeParams, condOrRefresh
if (typeof condOrRefresh === 'function' && if (typeof condOrRefresh === 'function' &&
options === undefined && cb === undefined) { options === undefined && cb === undefined) {
// order.customer(cb) // customer.orders(receiver, scopeParams, cb)
cb = condOrRefresh; cb = condOrRefresh;
condOrRefresh = undefined; condOrRefresh = undefined;
} else if (typeof options === 'function' && cb === undefined) { } else if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.orders(receiver, scopeParams, condOrRefresh, cb)
cb = options; cb = options;
options = {}; options = {};
if (typeof condOrRefresh === 'boolean') { if (typeof condOrRefresh === 'boolean') {
@ -2960,7 +2967,7 @@ ReferencesMany.prototype.related = function(receiver, scopeParams, condOrRefresh
ReferencesMany.prototype.findById = function (fkId, options, cb) { ReferencesMany.prototype.findById = function (fkId, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.orders.findById(fkId, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -3015,7 +3022,7 @@ ReferencesMany.prototype.findById = function (fkId, options, cb) {
ReferencesMany.prototype.exists = function (fkId, options, cb) { ReferencesMany.prototype.exists = function (fkId, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.orders.exists(fkId, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -3031,11 +3038,12 @@ ReferencesMany.prototype.exists = function (fkId, options, cb) {
ReferencesMany.prototype.updateById = function (fkId, data, options, cb) { ReferencesMany.prototype.updateById = function (fkId, data, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.orders.updateById(fkId, data, cb)
cb = options; cb = options;
options = {}; options = {};
} } else if (typeof data === 'function' &&
if (typeof data === 'function') { options === undefined && cb === undefined) {
// customer.orders.updateById(fkId, cb)
cb = data; cb = data;
data = {}; data = {};
} }
@ -3050,7 +3058,7 @@ ReferencesMany.prototype.updateById = function (fkId, data, options, cb) {
ReferencesMany.prototype.destroyById = function (fkId, options, cb) { ReferencesMany.prototype.destroyById = function (fkId, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.orders.destroyById(fkId, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -3067,7 +3075,7 @@ ReferencesMany.prototype.destroyById = function (fkId, options, cb) {
ReferencesMany.prototype.at = function (index, options, cb) { ReferencesMany.prototype.at = function (index, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.orders.at(index, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -3080,7 +3088,7 @@ ReferencesMany.prototype.at = function (index, options, cb) {
ReferencesMany.prototype.create = function (targetModelData, options, cb) { ReferencesMany.prototype.create = function (targetModelData, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.orders.create(data, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -3141,7 +3149,7 @@ ReferencesMany.prototype.build = function(targetModelData) {
*/ */
ReferencesMany.prototype.add = function (acInst, options, cb) { ReferencesMany.prototype.add = function (acInst, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.orders.add(acInst, cb)
cb = options; cb = options;
options = {}; options = {};
} }
@ -3197,7 +3205,7 @@ ReferencesMany.prototype.add = function (acInst, options, cb) {
*/ */
ReferencesMany.prototype.remove = function (acInst, options, cb) { ReferencesMany.prototype.remove = function (acInst, options, cb) {
if (typeof options === 'function' && cb === undefined) { if (typeof options === 'function' && cb === undefined) {
// order.customer(options, cb) // customer.orders.remove(acInst, cb)
cb = options; cb = options;
options = {}; options = {};
} }