Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

immutable-class

Package Overview
Dependencies
Maintainers
3
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

immutable-class - npm Package Compare versions

Comparing version 0.6.40 to 0.6.41

1

build/base-immutable/base-immutable.d.ts

@@ -65,2 +65,3 @@ export interface Validator {

equals(other: BaseImmutable<ValueType, JSType>): boolean;
equivalent(other: BaseImmutable<ValueType, JSType>): boolean;
get(propName: string): any;

@@ -67,0 +68,0 @@ change(propName: string, newValue: any): this;

@@ -191,4 +191,3 @@ "use strict";

var equal = property.equal || equality_1.generalEqual;
var getter = 'get' + firstUp(propertyName);
if (!equal(this[getter](), other[getter]()))
if (!equal(this[propertyName], other[propertyName]))
return false;

@@ -198,2 +197,19 @@ }

};
BaseImmutable.prototype.equivalent = function (other) {
if (!other)
return false;
if (this === other)
return true;
if (!(other instanceof this.constructor))
return false;
var properties = this.ownProperties();
for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) {
var property = properties_6[_i];
var propertyName = property.name;
var equal = property.equal || equality_1.generalEqual;
if (!equal(this.get(propertyName), other.get(propertyName)))
return false;
}
return true;
};
BaseImmutable.prototype.get = function (propName) {

@@ -200,0 +216,0 @@ var getter = this['get' + firstUp(propName)];

@@ -55,8 +55,15 @@ "use strict";

describe('equals', function () {
it('works with default values', function () {
it('is not equal if new value is explicitly set', function () {
var car0 = car_mock_1.Car.fromJS({ name: 'pouet' });
var car1 = car0.change('driver', car0.get('driver'));
chai_1.expect(car0.equals(car1)).to.be.true;
chai_1.expect(car0.equals(car1)).to.be.false;
});
});
describe('equivalent', function () {
it('is equivalent if new value is explicitly set', function () {
var car0 = car_mock_1.Car.fromJS({ name: 'pouet' });
var car1 = car0.change('driver', car0.get('driver'));
chai_1.expect(car0.equivalent(car1)).to.be.true;
});
});
describe('deepChange', function () {

@@ -63,0 +70,0 @@ it('works', function () {

2

package.json
{
"name": "immutable-class",
"version": "0.6.40",
"version": "0.6.41",
"description": "A template for creating immutable classes",

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

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