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

immutable-class

Package Overview
Dependencies
Maintainers
5
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.9.10 to 0.10.0

5

build/base-immutable/base-immutable.js

@@ -47,2 +47,7 @@ "use strict";

}
if (property.type === exports.PropertyType.ARRAY) {
if (!Array.isArray(pv)) {
throw new Error(this.constructor.name + "." + propertyName + " must be an Array");
}
}
var validate = property.validate;

@@ -49,0 +54,0 @@ if (validate) {

@@ -203,2 +203,17 @@ "use strict";

});
it('should validate array values when PropertyType is set', function () {
expect(function () {
return car_mock_1.Car.fromJS({
fuel: 'electric',
name: 'ford',
passengers: 'badString',
});
}).toThrow('Car.passengers must be an Array');
});
it('should set PropertyType.ARRAY to empty array if not defined', function () {
expect(car_mock_1.Car.fromJS({
fuel: 'electric',
name: 'ford',
})).toEqual({ fuel: 'electric', name: 'ford', passengers: [] });
});
});

2

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

@@ -23,2 +23,3 @@ import { BackCompat, BaseImmutable, Property } from './base-immutable';

driver?: Driver;
passengers?: string[];
}

@@ -34,2 +35,3 @@ export interface CarJS {

driver?: DriverJS;
passengers?: string[];
}

@@ -36,0 +38,0 @@ export declare class Car extends BaseImmutable<CarValue, CarJS> {

@@ -101,2 +101,6 @@ "use strict";

},
{
name: 'passengers',
type: base_immutable_1.PropertyType.ARRAY,
},
];

@@ -103,0 +107,0 @@ Car.BACK_COMPATS = [

2

package.json
{
"name": "immutable-class",
"version": "0.9.10",
"version": "0.10.0",
"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