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

@awsui/collection-hooks

Package Overview
Dependencies
Maintainers
4
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@awsui/collection-hooks - npm Package Compare versions

Comparing version 1.0.22 to 1.0.23

1

dist/cjs/operations/index.d.ts

@@ -8,3 +8,4 @@ import { UseCollectionOptions, CollectionState, TrackBy } from '../interfaces';

};
export declare const getTrackableValue: <T>(trackBy: TrackBy<T> | undefined, item: T) => any;
export declare const processSelectedItems: <T>(items: readonly T[], selectedItems: readonly T[], trackBy?: TrackBy<T> | undefined) => T[];
export declare const itemsAreEqual: <T>(items1: readonly T[], items2: readonly T[], trackBy?: TrackBy<T> | undefined) => boolean;

11

dist/cjs/operations/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.itemsAreEqual = exports.processSelectedItems = exports.processItems = void 0;
exports.itemsAreEqual = exports.processSelectedItems = exports.getTrackableValue = exports.processItems = void 0;
var filter_js_1 = require("./filter.js");

@@ -43,6 +43,7 @@ var property_filter_js_1 = require("./property-filter.js");

};
exports.getTrackableValue = getTrackableValue;
var processSelectedItems = function (items, selectedItems, trackBy) {
var selectedSet = new Set();
selectedItems.forEach(function (item) { return selectedSet.add(getTrackableValue(trackBy, item)); });
return items.filter(function (item) { return selectedSet.has(getTrackableValue(trackBy, item)); });
selectedItems.forEach(function (item) { return selectedSet.add((0, exports.getTrackableValue)(trackBy, item)); });
return items.filter(function (item) { return selectedSet.has((0, exports.getTrackableValue)(trackBy, item)); });
};

@@ -55,5 +56,5 @@ exports.processSelectedItems = processSelectedItems;

var set1 = new Set();
items1.forEach(function (item) { return set1.add(getTrackableValue(trackBy, item)); });
return items2.every(function (item) { return set1.has(item); });
items1.forEach(function (item) { return set1.add((0, exports.getTrackableValue)(trackBy, item)); });
return items2.every(function (item) { return set1.has((0, exports.getTrackableValue)(trackBy, item)); });
};
exports.itemsAreEqual = itemsAreEqual;

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

var newSelectedItems = (0, index_js_1.processSelectedItems)(items, state.selectedItems, options.selection.trackBy);
if (!(0, index_js_1.itemsAreEqual)(newSelectedItems, state.selectedItems)) {
if (!(0, index_js_1.itemsAreEqual)(newSelectedItems, state.selectedItems, options.selection.trackBy)) {
// This is a recommended pattern for how to handle the state, dependent on the incoming props

@@ -28,0 +28,0 @@ // https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops

@@ -8,3 +8,4 @@ import { UseCollectionOptions, CollectionState, TrackBy } from '../interfaces';

};
export declare const getTrackableValue: <T>(trackBy: TrackBy<T> | undefined, item: T) => any;
export declare const processSelectedItems: <T>(items: readonly T[], selectedItems: readonly T[], trackBy?: TrackBy<T> | undefined) => T[];
export declare const itemsAreEqual: <T>(items1: readonly T[], items2: readonly T[], trackBy?: TrackBy<T> | undefined) => boolean;

@@ -30,3 +30,3 @@ import { filter } from './filter.js';

}
var getTrackableValue = function (trackBy, item) {
export var getTrackableValue = function (trackBy, item) {
if (!trackBy) {

@@ -51,3 +51,3 @@ return item;

items1.forEach(function (item) { return set1.add(getTrackableValue(trackBy, item)); });
return items2.every(function (item) { return set1.has(item); });
return items2.every(function (item) { return set1.has(getTrackableValue(trackBy, item)); });
};

@@ -22,3 +22,3 @@ var __assign = (this && this.__assign) || function () {

var newSelectedItems = processSelectedItems(items, state.selectedItems, options.selection.trackBy);
if (!itemsAreEqual(newSelectedItems, state.selectedItems)) {
if (!itemsAreEqual(newSelectedItems, state.selectedItems, options.selection.trackBy)) {
// This is a recommended pattern for how to handle the state, dependent on the incoming props

@@ -25,0 +25,0 @@ // https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops

{
"name": "@awsui/collection-hooks",
"version": "1.0.22",
"version": "1.0.23",
"type": "module",

@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js",

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