Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return when(source, function(source){
if(!source){
throw new DatabaseError(3, "not found");
}
if(source instanceof Array){
// this handles query results, but probably should create a branch for real arrays
var results = extendSome({
some: function(callback){
source.some(function(item){
callback((item && typeof item == "object" && wrap(item, transaction, item, true)) || item);
});
},
length: source.length,
});
results.totalCount = source.totalCount;
return results;
}
var instancePrototype = Object.create(facetPrototype);
defineProperties(instancePrototype, {
load: {
value: function(){
if(facetSchema.allowed && !facetSchema.allowed(transaction.env, source)){
throw new AccessError("Access denied to " + source);