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

ampersand-collection

Package Overview
Dependencies
Maintainers
4
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ampersand-collection - npm Package Compare versions

Comparing version 1.3.15 to 1.3.16

6

ampersand-collection.js

@@ -267,2 +267,3 @@ var BackboneEvents = require('backbone-events-standalone');

if (this.isModel(attrs)) {
if (!attrs.collection) attrs.collection = this;
return attrs;

@@ -272,3 +273,6 @@ } else {

options.collection = this;
return new this.model(attrs, options);
var model = new this.model(attrs, options);
if (!model.validationError) return model;
this.trigger('invalid', this, model.validationError, options);
return false;
}

@@ -275,0 +279,0 @@ },

2

package.json
{
"name": "ampersand-collection",
"version": "1.3.15",
"version": "1.3.16",
"author": "Henrik Joreteg <henrik@andyet.net>",

@@ -5,0 +5,0 @@ "bugs": {

@@ -325,1 +325,32 @@ var test = require('tape');

});
test('add with validate:true enforces validation', function (t) {
t.plan(5);
var Model = State.extend({
idAttribute: '_id',
props: {
_id: 'string'
},
validate: function (attributes) {
return 'fail';
}
});
var C = Collection.extend({
model: Model
});
var c = new C();
c.on('invalid', function (collection, error, options) {
t.equal(c, collection);
t.equal(error, 'fail');
t.equal(options.validate, true);
});
var result = c.add({_id: 'a'}, {validate: true});
t.equal(c.length, 0);
t.equal(result, false);
t.end();
});
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