Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iridium

Package Overview
Dependencies
Maintainers
1
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iridium - npm Package Compare versions

Comparing version 1.3.5 to 1.3.6

35

lib/Model.js

@@ -150,12 +150,28 @@ /// <reference path="../nodelib/node.js"/>

if(!Array.isArray(object)) object = [object];
var returnArray = true;
if(!Array.isArray(object)) {
object = [object];
returnArray = false;
}
var created = [];
var end = function(err, results) {
if(!results) return callback(err);
if(!Array.isArray(results)) results = [results];
if(returnArray) return callback(err, results);
return callback(err, results[0]);
};
var next = function(err, instance) {
if(err) return callback(err, created);
if(err) return end(err, created);
if(instance) created.push(instance);
if(object.length === 0) {
$.setupIndexes();
return callback(null, created);
return end(null, created);
}

@@ -167,10 +183,10 @@

var doInsert = function(err, object) {
var doInsert = function(err) {
if(err) return next(err);
var validation = validate($.options.schema, object);
var validation = validate($.options.schema, this);
if (!validation.passed) return next(validation.toError());
var instance = $.wrap.call($, object, true);
var instance = $.wrap.call($, this, true);
instance.save(next);

@@ -181,5 +197,6 @@ };

if ($.options.hooks.beforeCreate) {
if ($.options.hooks.beforeCreate.length === 0) $.options.hooks.beforeCreate.call(object);
else return $.options.hooks.beforeCreate.call(object, doInsert);
}
if ($.options.hooks.beforeCreate.length === 0) $.options.hooks.beforeCreate.call(object);
else return $.options.hooks.beforeCreate.call(object, doInsert.bind(object));
}
doInsert.call(object);
};

@@ -186,0 +203,0 @@

@@ -69,3 +69,3 @@ /// <reference path="String.js"/>

if (schemaType === true) return assert(value, 'value');
if (schemaType === true) return assert(value, 'value', value || 'nothing');

@@ -118,4 +118,4 @@ if (schemaType === Object) return pass;

if (schemaType === Date) return assert(_.isDate(value), 'date');
if (schemaType instanceof RegExp) return assert(schemaType.test(value), 'regex ' + schemaType.toString() + ' to match', value.toString());
if (schemaType instanceof RegExp) return assert(schemaType.test(value || ''), 'regex match on ' + schemaType.toString(), (value || 'nothing').toString());
return assert(value instanceof schemaType, 'instanceof ' + schemaType.toString());
};
{
"name": "iridium",
"version": "1.3.5",
"version": "1.3.6",
"author": "Benjamin Pannell <admin@sierrasoftworks.com>",

@@ -5,0 +5,0 @@ "description": "A custom lightweight ORM for MongoDB designed for power-users",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc