ampersand-state
Advanced tools
Comparing version 4.1.1 to 4.2.0
@@ -439,2 +439,5 @@ var _ = require('underscore'); | ||
} | ||
}, | ||
isState: { | ||
value: true | ||
} | ||
@@ -441,0 +444,0 @@ }); |
{ | ||
"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(); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
73510
1811
399
0