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.15 to 0.0.16

6

lib/attribute.js

@@ -40,4 +40,4 @@

unset: function () {
this.set(this._callOrGetDefault());
this._isSet = false;
this.value = this._callOrGetDefault();
},

@@ -109,3 +109,5 @@

set: function (value) {
if (!this.isEqual(value)) {
if (value === null) {
this.unset();
} else if (!this.isEqual(value)) {
this.value = this.parse(value);

@@ -112,0 +114,0 @@ this._isSet = true;

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

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

@@ -104,2 +104,4 @@ # Promised Models

**Note:** setting `null` is equivalent to call `.unset()`
#### get `model.get(attributeName)`

@@ -106,0 +108,0 @@

@@ -68,3 +68,23 @@ var expect = require('chai').expect,

});
it('should emit change', function (done) {
var model = new ModelClass({
a: 'a-1'
});
model.ready().then(function () {
model.on('change:a', function () {
done();
});
model.unset('a');
}).done();
});
});
describe('set', function () {
it('should unset when setting null', function () {
var model = new ModelClass({
a: 'a-1'
});
model.set('a', null);
expect(model.get('a')).to.be.equal('a');
});
});
});
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