Socket
Socket
Sign inDemoInstall

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.7 to 0.9.8

2

build/keyed-array/keyed-array.d.ts

@@ -7,3 +7,3 @@ export declare type KeyGetter = (x: any) => string;

get(array: T[], key: string): T | undefined;
toMap(array: T[]): Record<string, T>;
toRecord(array: T[]): Record<string, T>;
checkValid(array: T[], what?: string, where?: string): void;

@@ -10,0 +10,0 @@ isValid(array: T[]): boolean;

@@ -17,13 +17,13 @@ "use strict";

};
KeyedArray.prototype.toMap = function (array) {
KeyedArray.prototype.toRecord = function (array) {
var getKey = this.getKey;
var myMap = {};
var myRecord = {};
for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
var a = array_1[_i];
var key = getKey(a);
if (myMap[key])
if (myRecord[key])
continue;
myMap[key] = a;
myRecord[key] = a;
}
return myMap;
return myRecord;
};

@@ -30,0 +30,0 @@ KeyedArray.prototype.checkValid = function (array, what, where) {

@@ -54,3 +54,3 @@ "use strict";

it('works', function () {
expect(keyedHelper.toMap(someArray)).toEqual({
expect(keyedHelper.toRecord(someArray)).toEqual({
Italy: {

@@ -57,0 +57,0 @@ accountId: 'Italy',

@@ -35,3 +35,3 @@ export declare type DiffAction = 'create' | 'update' | 'delete';

static get<T extends Nameable>(array: T[], name: string): T;
static toMap<T extends NamedArray>(array: T[]): Record<string, T>;
static toRecord<T extends NamedArray>(array: T[]): Record<string, T>;
static containsByName<T extends Nameable>(array: T[], name: string): boolean;

@@ -38,0 +38,0 @@ static findByNameCI<T extends Nameable>(array: T[], name: string): T | undefined;

@@ -76,4 +76,4 @@ "use strict";

};
NamedArray.toMap = function (array) {
return KEYED_ARRAY.toMap(array);
NamedArray.toRecord = function (array) {
return KEYED_ARRAY.toRecord(array);
};

@@ -80,0 +80,0 @@ NamedArray.containsByName = function (array, name) {

@@ -138,3 +138,3 @@ "use strict";

it('works', function () {
expect(named_array_1.NamedArray.toMap(someArray)).toEqual({
expect(named_array_1.NamedArray.toRecord(someArray)).toEqual({
Italy: {

@@ -141,0 +141,0 @@ name: 'Italy',

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