New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

value-enhancer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

value-enhancer - npm Package Compare versions

Comparing version 4.0.1 to 4.0.2

@@ -116,7 +116,7 @@ import { R as ReadonlyVal } from './typings-8a4e5768.js';

/**
* Replace all elements in the list.
* @param arrayLike An array-like object to replace the elements in the list.
* @returns deleted values
* Replace all items in the list.
*
* @returns deleted items
*/
replace(arrayLike: ArrayLike<TValue>): TValue[];
replace(items: Iterable<TValue>): Iterable<TValue>;
/**

@@ -191,3 +191,3 @@ * @see Array#reverse

*/
replace(entries: Iterable<readonly [TKey, TValue]>): Map<TKey, TValue>;
replace(entries: Iterable<readonly [TKey, TValue]>): Iterable<readonly [TKey, TValue]>;
dispose(): void;

@@ -227,7 +227,7 @@ }

/**
* Replace all entries in the Set.
* Replace all items in the Set.
*
* @returns Deleted entries.
* @returns Deleted items.
*/
replace(entries: Iterable<TValue>): Set<TValue>;
replace(items: Iterable<TValue>): Iterable<TValue>;
}

@@ -234,0 +234,0 @@ /**

@@ -394,13 +394,13 @@ 'use strict';

/**
* Replace all elements in the list.
* @param arrayLike An array-like object to replace the elements in the list.
* @returns deleted values
* Replace all items in the list.
*
* @returns deleted items
*/
replace(arrayLike) {
replace(items) {
const cached = new Set(this);
this.#data.length = 0;
let isDirty = false;
for (const value of Array.from(arrayLike)) {
isDirty = isDirty || cached.delete(value);
this.#data.push(value);
for (const item of items) {
isDirty = isDirty || cached.delete(item);
this.#data.push(item);
}

@@ -410,3 +410,3 @@ if (isDirty || cached.size > 0) {

}
return [...cached];
return cached.values();
}

@@ -514,3 +514,3 @@ /**

}
return cached;
return cached.entries();
}

@@ -557,13 +557,13 @@ dispose() {

/**
* Replace all entries in the Set.
* Replace all items in the Set.
*
* @returns Deleted entries.
* @returns Deleted items.
*/
replace(entries) {
replace(items) {
const cached = new Set(this);
super.clear();
let isDirty = false;
for (const value of entries) {
isDirty = isDirty || cached.delete(value);
super.add(value);
for (const item of items) {
isDirty = isDirty || cached.delete(item);
super.add(item);
}

@@ -573,3 +573,3 @@ if (isDirty || cached.size > 0) {

}
return cached;
return cached.values();
}

@@ -576,0 +576,0 @@ };

{
"name": "value-enhancer",
"version": "4.0.1",
"version": "4.0.2",
"private": false,

@@ -5,0 +5,0 @@ "description": "A tiny library to enhance value with reactive wrapper.",

@@ -216,13 +216,13 @@ import { readonlyVal } from "../readonly-val";

/**
* Replace all elements in the list.
* @param arrayLike An array-like object to replace the elements in the list.
* @returns deleted values
* Replace all items in the list.
*
* @returns deleted items
*/
public replace(arrayLike: ArrayLike<TValue>): TValue[] {
public replace(items: Iterable<TValue>): Iterable<TValue> {
const cached = new Set(this);
this.#data.length = 0;
let isDirty = false;
for (const value of Array.from(arrayLike)) {
isDirty = isDirty || cached.delete(value);
this.#data.push(value);
for (const item of items) {
isDirty = isDirty || cached.delete(item);
this.#data.push(item);
}

@@ -232,3 +232,3 @@ if (isDirty || cached.size > 0) {

}
return [...cached];
return cached.values();
}

@@ -235,0 +235,0 @@

@@ -68,3 +68,3 @@ import { readonlyVal } from "../readonly-val";

entries: Iterable<readonly [TKey, TValue]>
): Map<TKey, TValue> {
): Iterable<readonly [TKey, TValue]> {
const cached = new Map(this);

@@ -81,3 +81,3 @@ super.clear();

}
return cached;
return cached.entries();
}

@@ -84,0 +84,0 @@

@@ -64,13 +64,13 @@ import { readonlyVal } from "../readonly-val";

/**
* Replace all entries in the Set.
* Replace all items in the Set.
*
* @returns Deleted entries.
* @returns Deleted items.
*/
public replace(entries: Iterable<TValue>): Set<TValue> {
public replace(items: Iterable<TValue>): Iterable<TValue> {
const cached = new Set(this);
super.clear();
let isDirty = false;
for (const value of entries) {
isDirty = isDirty || cached.delete(value);
super.add(value);
for (const item of items) {
isDirty = isDirty || cached.delete(item);
super.add(item);
}

@@ -80,3 +80,3 @@ if (isDirty || cached.size > 0) {

}
return cached;
return cached.values();
}

@@ -83,0 +83,0 @@ }

Sorry, the diff of this file is not supported yet