Socket
Socket
Sign inDemoInstall

ampersand-state

Package Overview
Dependencies
Maintainers
1
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 3.0.1 to 4.0.0

3

ampersand-state.js

@@ -17,4 +17,3 @@ var _ = require('underscore');

if (attrs) this.set(attrs, _.extend({silent: true, initial: true}, options));
this.initialize.apply(this, arguments);
if (this.seal) Object.seal(this);
if (options.init !== false) this.initialize.apply(this, arguments);
}

@@ -21,0 +20,0 @@

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

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

@@ -92,20 +92,2 @@ var tape = require('tape');

test('should be sealable', function (t) {
definition.seal = true;
var Bar = State.extend(definition);
var bar = new Bar();
t.throws(function () {
"use strict";
// detect if strict mode worked
var isStrict = (function () { return !this; })();
bar.someProperty = 'new';
// throw type error to be able to test in browsers
// that don't support strict
if (!isStrict) throw TypeError;
}, TypeError, 'Throws exception in strict mode.');
bar.someOtherProperty = 'something';
t.ok(!bar.someOtherProperty, 'ignores properties otherwise');
t.end();
});
test('should have default values for properties', function (t) {

@@ -457,16 +439,2 @@ var foo = new Foo({

test('should be able to bind events even if sealed', function (t) {
var SealedModel = State.extend({seal: true, props: {name: 'string'}});
var s = new SealedModel({name: 'henrik'});
t.equal(s.name, 'henrik', 'should have set name');
s.on('change:name', function () {
t.ok(true, 'event was triggered.');
});
s.name = 'superman'; // ridiculous, right?
t.end();
});
test('Calling `previous` during change of derived cached property should work', function (t) {

@@ -473,0 +441,0 @@ var foo = new Foo({firstName: 'Henrik', lastName: 'Joreteg'});

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