Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if(facetPrototype.save){
facetPrototype.save.call(this, directives);
}
var validation = validate(this, facetSchema);
var instance = this;
for(i in this){
if(this.hasOwnProperty(i)){
transfer(this[i]);
}
}
for (i in source){
if(source.hasOwnProperty(i) && !this.hasOwnProperty(i)){
transfer(undefined);
}
}
mustBeValid(validation);
var isNew = partial === NEW;
if(isNew && (typeof facetSchema.add === "function")){ // || )
partial = undefined;
id = facetSchema.add(source, directives);
}
else if(typeof facetSchema.put === "function"){
if(isNew){
directives.overwrite = false;
}
id = facetSchema.put(source, directives);
}
else if(permissive && isNew && typeof sourceClass.add === "function"){
id = sourceClass.add(source, directives);
}
else if(permissive && typeof sourceClass.put === "function"){
if(isNew){