data-structure-typed
Advanced tools
Comparing version 1.19.9 to 1.20.0
@@ -76,2 +76,5 @@ /** | ||
toArray(isItem: true): (HeapItem<T> | null)[]; | ||
sort(isItem?: undefined): (T | undefined)[]; | ||
sort(isItem: false): (T | undefined)[]; | ||
sort(isItem: true): (HeapItem<T> | null)[]; | ||
/** | ||
@@ -78,0 +81,0 @@ * The clear function clears the priority queue. |
@@ -138,2 +138,15 @@ "use strict"; | ||
/** | ||
* The function sorts the elements in the priority queue and returns either the sorted items or their values depending | ||
* on the value of the isItem parameter. | ||
* @param {boolean} [isItem] - The `isItem` parameter is a boolean flag that indicates whether the sorted result should | ||
* be an array of `HeapItem<T>` objects or an array of the values (`T`) of those objects. If `isItem` is `true`, the | ||
* sorted result will be an array of `HeapItem | ||
* @returns an array of either `HeapItem<T>`, `null`, `T`, or `undefined` values. | ||
*/ | ||
sort(isItem) { | ||
isItem = isItem !== null && isItem !== void 0 ? isItem : false; | ||
const sorted = this._pq.sort(); | ||
return isItem ? sorted : sorted.map(item => item.val); | ||
} | ||
/** | ||
* The clear function clears the priority queue. | ||
@@ -140,0 +153,0 @@ */ |
{ | ||
"name": "data-structure-typed", | ||
"version": "1.19.9", | ||
"version": "1.20.0", | ||
"description": "Javascript & TypeScript Data Structure Library, meticulously crafted to empower developers with a versatile set of essential data structures. Our library includes a wide range of data structures, such as Binary Tree, AVL Tree, Binary Search Tree (BST), Tree Multiset, Segment Tree, Binary Indexed Tree, Graph, Directed Graph, Undirected Graph, Singly Linked List, Hash, CoordinateSet, CoordinateMap, Heap, Doubly Linked List, Priority Queue, Max Priority Queue, Min Priority Queue, Queue, ObjectDeque, ArrayDeque, Stack, and Trie. Each data structure is thoughtfully designed and implemented using TypeScript to provide efficient, reliable, and easy-to-use solutions for your programming needs. Whether you're optimizing algorithms, managing data, or enhancing performance, our TypeScript Data Structure Library is your go-to resource. Elevate your coding experience with these fundamental building blocks for software development.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -177,3 +177,20 @@ /** | ||
sort(isItem?: undefined): (T | undefined)[]; | ||
sort(isItem: false): (T | undefined)[]; | ||
sort(isItem: true): (HeapItem<T> | null)[]; | ||
/** | ||
* The function sorts the elements in the priority queue and returns either the sorted items or their values depending | ||
* on the value of the isItem parameter. | ||
* @param {boolean} [isItem] - The `isItem` parameter is a boolean flag that indicates whether the sorted result should | ||
* be an array of `HeapItem<T>` objects or an array of the values (`T`) of those objects. If `isItem` is `true`, the | ||
* sorted result will be an array of `HeapItem | ||
* @returns an array of either `HeapItem<T>`, `null`, `T`, or `undefined` values. | ||
*/ | ||
sort(isItem?: boolean): (HeapItem<T> | null | T | undefined)[] { | ||
isItem = isItem ?? false; | ||
const sorted = this._pq.sort(); | ||
return isItem ? sorted : sorted.map(item => item.val); | ||
} | ||
/** | ||
* The clear function clears the priority queue. | ||
@@ -180,0 +197,0 @@ */ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
981145
20604