New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

micromodel

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micromodel - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

74

model.js

@@ -33,6 +33,23 @@ // Generated by CoffeeScript 1.6.1

defineClassInheritableAccessor(Model, '_defaults', {});
Model.defaults = function(attrs) {
var name, value, _results;
if (attrs) {
_results = [];
for (name in attrs) {
value = attrs[name];
_results.push(this._defaults()[name] = value);
}
return _results;
} else {
return this._defaults();
}
};
function Model(attrs, options) {
var defaults;
this.errors = {};
if (this.defaults) {
this.set(this.defaults, options);
if (!_.isEmpty(defaults = this.constructor.defaults())) {
this.set(defaults, options);
}

@@ -84,2 +101,5 @@ if (attrs) {

}
if (options && options.cast) {
return this.castAndSet(attrs, options);
}
if (this.parse) {

@@ -118,13 +138,27 @@ attrs = this.parse(attrs);

defineClassInheritableAccessor(Model, '_validations', {});
Model.validations = function(validations) {
var name, validator, _results;
if (validations) {
_results = [];
for (name in validations) {
validator = validations[name];
_results.push(this._validations()[name] = validator);
}
return _results;
} else {
return this._validations();
}
};
Model.prototype.validate = function() {
var msg, name, validations, validator, _base, _ref, _results;
if (!(validations = this.constructor.validations)) {
return null;
}
var msg, name, validator, _base, _ref, _ref1, _results;
_ref = this.constructor.validations();
_results = [];
for (name in validations) {
if (!__hasProp.call(validations, name)) continue;
validator = validations[name];
for (name in _ref) {
if (!__hasProp.call(_ref, name)) continue;
validator = _ref[name];
if (msg = validator(this[name])) {
_results.push(((_ref = (_base = this.errors)[name]) != null ? _ref : _base[name] = []).push(msg));
_results.push(((_ref1 = (_base = this.errors)[name]) != null ? _ref1 : _base[name] = []).push(msg));
} else {

@@ -227,8 +261,12 @@ _results.push(void 0);

var name, type, _results;
_results = [];
for (name in types) {
type = types[name];
_results.push(this._types()[name] = type);
if (types) {
_results = [];
for (name in types) {
type = types[name];
_results.push(this._types()[name] = type);
}
return _results;
} else {
return this._types();
}
return _results;
};

@@ -239,3 +277,3 @@

casted = {};
_ref = this.constructor._types();
_ref = this.constructor.types();
for (name in _ref) {

@@ -247,2 +285,6 @@ type = _ref[name];

}
if (options && options.cast) {
options = _(options).clone();
delete options.cast;
}
return this.set(casted, options);

@@ -249,0 +291,0 @@ };

@@ -63,4 +63,6 @@ // Generated by CoffeeScript 1.6.1

extractCustomOptions = function(options) {
var bang;
var bang, originalId;
options = _(options).clone();
originalId = options.originalId;
delete options.originalId;
bang = options.bang;

@@ -70,3 +72,4 @@ delete options.bang;

options, {
bang: bang
bang: bang,
originalId: originalId
}

@@ -186,3 +189,3 @@ ];

Model.prototype.update = function(options) {
var bang, fail, result, _ref1, _ref2,
var bang, fail, originalId, result, _ref1, _ref2,
_this = this;

@@ -192,3 +195,3 @@ if (options == null) {

}
_ref1 = extractCustomOptions(options), options = _ref1[0], (_ref2 = _ref1[1], bang = _ref2.bang);
_ref1 = extractCustomOptions(options), options = _ref1[0], (_ref2 = _ref1[1], bang = _ref2.bang, originalId = _ref2.originalId);
fail = function() {

@@ -206,3 +209,3 @@ if (bang) {

return _this.collection().update({
id: _this.id
id: originalId || _this.id
}, _this.toJson(), options);

@@ -209,0 +212,0 @@ });

{
"name" : "micromodel",
"main" : "./model",
"version" : "2.0.0",
"version" : "2.0.1",
"homepage" : "http://alexeypetrushin.github.com/micromodel",

@@ -6,0 +6,0 @@ "dependencies" : {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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