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.9.8 to 0.9.9

20

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

@@ -10,4 +10,6 @@ export declare type Validator = (x: any) => void;

};
export interface Property {
name: string;
export interface Property<T extends {
[key: string]: any;
} = any> {
name: keyof T;
defaultValue?: any;

@@ -46,3 +48,3 @@ possibleValues?: any[];

export declare abstract class BaseImmutable<ValueType, JSType> implements ImmutableInstanceType<ValueType, JSType> {
static jsToValue(properties: Property[], js: any, backCompats?: BackCompat[], context?: Record<string, any>): any;
static jsToValue<T = any>(properties: Property<T>[], js: any, backCompats?: BackCompat[], context?: Record<string, any>): any;
static finalize(ClassFn: ClassFnType): void;

@@ -55,5 +57,5 @@ static ensure: {

constructor(value: ValueType);
ownProperties(): Property[];
findOwnProperty(propName: string): Property | undefined;
hasProperty(propName: string): boolean;
ownProperties(): Property<ValueType>[];
findOwnProperty(propName: keyof ValueType): Property | undefined;
hasProperty(propName: keyof ValueType): boolean;
valueOf(): ValueType;

@@ -66,7 +68,7 @@ toJS(): JSType;

equivalent(other: BaseImmutable<ValueType, JSType>): boolean;
get(propName: string): any;
change(propName: string, newValue: any): this;
changeMany(properties: Record<string, any>): this;
get<T extends keyof ValueType>(propName: T): ValueType[T];
change<T extends keyof ValueType>(propName: T, newValue: ValueType[T]): this;
changeMany(properties: Partial<ValueType>): this;
deepChange(propName: string, newValue: any): this;
deepGet(propName: string): any;
}

@@ -196,2 +196,9 @@ "use strict";

});
it('works with types', function () {
var car = car_mock_1.Car.fromJS({
fuel: 'electric',
name: 'ford',
});
car.change('owners', ['foo']);
});
});

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

createdOn?: Date;
owners?: string[];
driver?: Driver;
}

@@ -30,5 +32,7 @@ export interface CarJS {

createdOn?: Date | string;
owners?: string[];
driver?: DriverJS;
}
export declare class Car extends BaseImmutable<CarValue, CarJS> {
static PROPERTIES: Property[];
static PROPERTIES: Property<CarValue>[];
static BACK_COMPATS: BackCompat[];

@@ -35,0 +39,0 @@ static isCar(car: Car): boolean;

{
"name": "immutable-class",
"version": "0.9.8",
"version": "0.9.9",
"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