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

promised-models

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promised-models - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

3

lib/attribute.js

@@ -94,2 +94,5 @@

get: function () {
if (arguments.length > 0) {
throw new Error('Attribute.get() supports no arguments');
}
return this.value;

@@ -96,0 +99,0 @@ },

4

lib/model.js

@@ -250,3 +250,3 @@ /**

* @param {Function} cb
* @param {*} [ctx] [description]
* @param {*} [ctx]
*/

@@ -407,3 +407,3 @@ un: function (attribute, event, cb, ctx) {

* @param {Function} cb
* @param {*} [ctx] [description]
* @param {*} [ctx]
*/

@@ -410,0 +410,0 @@ _callEventEmitter: function (method, attribute, event, cb, ctx) {

@@ -82,2 +82,11 @@ /**

/**
* @override
*/
set: function (value) {
if (!this.isEqual(value)) {
this.value = this.parse(value);
this.emitListChange();
}
},

@@ -84,0 +93,0 @@ /**

{
"description": "promise based, typed attributes, nested models and collections",
"name": "promised-models",
"version": "0.0.8",
"version": "0.0.9",
"repository": "git@github.com:delfrrr/promised-models.git",

@@ -6,0 +6,0 @@ "keywords": [

@@ -12,2 +12,3 @@ var expect = require('chai').expect;

beforeEach(function () {
console.log('beforeEach');
model = new Model({

@@ -151,12 +152,31 @@ nested: {

});
it('should not trigger event on removed model', function (done) {
it('should not trigger event on removed model', function () {
var changeCall = 0;
model.on('change', function () {
done();
changeCall++;
expect(changeCall).to.be.below(2);
});
var nestedModel = model.get('collection').unshift();
model.ready().then(function () {
var nestedModel = model.get('collection').shift();
return model.ready().then(function () {
expect(changeCall).to.be.equal(1);
nestedModel.set('a', 'a-10');
return nestedModel.ready();
});
});
it('should be trigered for models added through .set', function (done) {
var nestedModel = new NestedModel({a: 'a-3'});
nestedModel.ready().then(function () {
model.set({
collection: [nestedModel]
});
return model.ready();
}).then(function () {
model.on('change', function () {
done();
});
nestedModel.set('a', 'a-10');
}).done();
});
});

@@ -163,0 +183,0 @@

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