Socket
Socket
Sign inDemoInstall

ampersand-state

Package Overview
Dependencies
Maintainers
2
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.1.1 to 4.2.0

3

ampersand-state.js

@@ -439,2 +439,5 @@ var _ = require('underscore');

}
},
isState: {
value: true
}

@@ -441,0 +444,0 @@ });

2

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

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

@@ -381,2 +381,9 @@ # ampersand-state

## A quick note about instanceof checks
With npm and browserify for module deps you can sometimes end up with a situation where, the same `state` constructor wasn't used to build a `state` object. As a result `instanceof` checks will fail.
In order to deal with this (because sometimes this is a legitimate scenario), `state` simply creates a read-only `isState` property on all state objects that can be used to check whether or a not a given object is in fact a state object no matter what its constructor was.
## Changelog

@@ -383,0 +390,0 @@

@@ -188,3 +188,17 @@ /*jshint expr: true*/

t.ok(p3 instanceof P3);
// all of them should have the isState flag too
t.ok(p1.isState);
t.ok(p2.isState);
t.ok(p3.isState);
// shouldn't be possible to change
p1.isState = false;
p2.isState = false;
p3.isState = false;
t.ok(p1.isState);
t.ok(p2.isState);
t.ok(p3.isState);
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