Socket
Socket
Sign inDemoInstall

ampersand-state

Package Overview
Dependencies
Maintainers
4
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ampersand-state - npm Package Compare versions

Comparing version 4.3.14 to 4.3.15

3

ampersand-state.js

@@ -286,3 +286,4 @@ /*$AMPERSAND_VERSION*/

def = this._definition[attr];
isEqual = this._getCompareForType(def && def.type);
if (!def) continue;
isEqual = this._getCompareForType(def.type);
if (isEqual(old[attr], (val = diff[attr]))) continue;

@@ -289,0 +290,0 @@ (changed || (changed = {}))[attr] = val;

{
"name": "ampersand-state",
"description": "An observable, extensible state object with derived watchable properties.",
"version": "4.3.14",
"version": "4.3.15",
"author": "Henrik Joreteg <henrik@andyet.net>",

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

@@ -56,2 +56,14 @@ # ampersand-state

`AmpersandState.extend` does more than just copy attributes from one prototype to another. As such it is incompatible with Coffeescript's class-based extend. TypeScript users may have similar issues.
For instance, this will not work since it never actually calls `AmpersandState.extend`:
```
class Foo extends AmpersandView
constructor: (options)->
@special = options.special
super
```
### constructor/initialize `new AmpersandState([attrs], [options])`

@@ -501,2 +513,4 @@

Note that if passing an attributes object to diff against, only changes to properties defined on the model will be detected. This means that changes to children or collections will *not* be returned as changes by this method.
### toJSON `state.toJSON()`

@@ -503,0 +517,0 @@

@@ -1395,1 +1395,29 @@ var tape = require('tape');

});
test("#96 - changedAttributes includes properties that are not direct model attributes", function(t) {
var Submodel = State.extend({
props: {
b: 'number'
}
});
var Model = State.extend({
props: {
a: 'number'
},
children: {
submodels: Submodel
}
});
var model = new Model({ a: 1 });
var old = JSON.parse(JSON.stringify(model));
var diff = model.changedAttributes(old);
t.ok(diff === false, 'should return false');
diff = model.changedAttributes({ a: 5, submodels: [] });
t.ok(diff.hasOwnProperty('a'), 'should return the changed `a`');
t.ok(!diff.hasOwnProperty('submodels'), 'should not return `submodels`');
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