Further optimizations: remove hasOwnProperty backward compat
This commit is contained in:
parent
da9ff3e1e8
commit
dbb39bf43e
|
@ -519,7 +519,7 @@ AbstractClass.prototype.toObject = function (onlySchema) {
|
|||
this.constructor.forEachProperty(function (attr) {
|
||||
if (self[attr] instanceof List) {
|
||||
data[attr] = self[attr].toObject();
|
||||
} else if (self.hasOwnProperty(attr)) {
|
||||
} else if (self.__data.hasOwnProperty(attr)) {
|
||||
data[attr] = self[attr];
|
||||
} else {
|
||||
data[attr] = null;
|
||||
|
@ -537,10 +537,10 @@ AbstractClass.prototype.toObject = function (onlySchema) {
|
|||
return data;
|
||||
};
|
||||
|
||||
AbstractClass.prototype.hasOwnProperty = function (prop) {
|
||||
return this.__data && this.__data.hasOwnProperty(prop) ||
|
||||
Object.getOwnPropertyNames(this).indexOf(prop) !== -1;
|
||||
};
|
||||
// AbstractClass.prototype.hasOwnProperty = function (prop) {
|
||||
// return this.__data && this.__data.hasOwnProperty(prop) ||
|
||||
// Object.getOwnPropertyNames(this).indexOf(prop) !== -1;
|
||||
// };
|
||||
|
||||
AbstractClass.prototype.toJSON = function () {
|
||||
return this.toObject();
|
||||
|
|
|
@ -428,7 +428,7 @@ function skipValidation(inst, conf, kind) {
|
|||
if (typeof inst[conf[kind]] === 'function') {
|
||||
doValidate = inst[conf[kind]].call(inst);
|
||||
if (kind === 'unless') doValidate = !doValidate;
|
||||
} else if (inst.hasOwnProperty(conf[kind])) {
|
||||
} else if (inst.__data.hasOwnProperty(conf[kind])) {
|
||||
doValidate = inst[conf[kind]];
|
||||
if (kind === 'unless') doValidate = !doValidate;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue