min-priority-queue-typed 1.19.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export * from './min-priority-queue';
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./min-priority-queue"), exports);
@@ -0,0 +1,15 @@
1
+ /**
2
+ * data-structure-typed
3
+ *
4
+ * @author Tyler Zeng
5
+ * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
+ * @license MIT License
7
+ */
8
+ import { PriorityQueue } from 'data-structure-typed';
9
+ import type { PriorityQueueOptions } from 'data-structure-typed';
10
+ export declare class MinPriorityQueue<T = number> extends PriorityQueue<T> {
11
+ constructor(options?: Omit<PriorityQueueOptions<number>, 'comparator'>);
12
+ constructor(options: PriorityQueueOptions<T>);
13
+ static heapify<T extends number>(options?: Omit<PriorityQueueOptions<T>, 'comparator'>): MinPriorityQueue<T>;
14
+ static heapify<T>(options: PriorityQueueOptions<T>): MinPriorityQueue<T>;
15
+ }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.MinPriorityQueue = void 0;
30
+ /**
31
+ * data-structure-typed
32
+ *
33
+ * @author Tyler Zeng
34
+ * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
35
+ * @license MIT License
36
+ */
37
+ var data_structure_typed_1 = require("data-structure-typed");
38
+ var MinPriorityQueue = /** @class */ (function (_super) {
39
+ __extends(MinPriorityQueue, _super);
40
+ /**
41
+ * The constructor initializes a priority queue with an optional comparator function.
42
+ * @param [options] - The `options` parameter is an optional object that can contain various configuration options for
43
+ * the `PriorityQueue` constructor.
44
+ */
45
+ function MinPriorityQueue(options) {
46
+ return _super.call(this, __assign(__assign({}, options), { comparator: (options === null || options === void 0 ? void 0 : options.comparator) ? options.comparator : function (a, b) {
47
+ var aKey = a, bKey = b;
48
+ return aKey - bKey;
49
+ } })) || this;
50
+ }
51
+ /**
52
+ * The function `heapify` creates a new MinPriorityQueue instance and sets the comparator function based on the options
53
+ * provided, and then fixes the heap structure of the queue.
54
+ * @param options - The `options` parameter is an object that contains configuration options for creating a priority
55
+ * queue. It can have the following properties:
56
+ * @returns a MinPriorityQueue object.
57
+ */
58
+ MinPriorityQueue.heapify = function (options) {
59
+ var minPQ = new MinPriorityQueue(__assign(__assign({}, options), { comparator: (options === null || options === void 0 ? void 0 : options.comparator) ? options.comparator : function (a, b) {
60
+ var aKey = a, bKey = b;
61
+ return aKey - bKey;
62
+ } }));
63
+ minPQ._fix();
64
+ return minPQ;
65
+ };
66
+ return MinPriorityQueue;
67
+ }(data_structure_typed_1.PriorityQueue));
68
+ exports.MinPriorityQueue = MinPriorityQueue;
package/jest.config.js ADDED
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ preset: 'ts-jest',
3
+ testEnvironment: 'node',
4
+ testMatch: ['<rootDir>/tests/**/*.test.ts'],
5
+ };
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "min-priority-queue-typed",
3
+ "version": "1.19.3",
4
+ "description": "Min Priority Queue. Javascript & Typescript Data Structure.",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "build": "rm -rf dist && npx tsc",
8
+ "test": "jest",
9
+ "build:docs": "typedoc --out docs ./src",
10
+ "deps:check": "dependency-cruiser src",
11
+ "build:publish": "npm run build && npm run build:docs && npm publish"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/zrwusa/data-structure-typed"
16
+ },
17
+ "keywords": [
18
+ "Priority queue",
19
+ "Min priority queue",
20
+ "Heap data structure",
21
+ "Binary heap",
22
+ "Priority management",
23
+ "Insertion",
24
+ "Deletion",
25
+ "Min value",
26
+ "Heap property",
27
+ "Complete binary tree",
28
+ "Heapify",
29
+ "Extract minimum",
30
+ "Heap operations",
31
+ "Data structure",
32
+ "Efficient priority handling",
33
+ "Ordering property",
34
+ "Heap operations complexity",
35
+ "Binary tree",
36
+ "Data management",
37
+ "Dynamic resizing",
38
+ "Priority-based processing"
39
+ ],
40
+ "author": "Tyler Zeng zrwusa@gmail.com",
41
+ "license": "MIT",
42
+ "bugs": {
43
+ "url": "https://github.com/zrwusa/data-structure-typed/issues"
44
+ },
45
+ "homepage": "https://github.com/zrwusa/data-structure-typed#readme",
46
+ "types": "dist/index.d.ts",
47
+ "devDependencies": {
48
+ "@types/jest": "^29.5.3",
49
+ "@types/node": "^20.4.9",
50
+ "dependency-cruiser": "^13.1.2",
51
+ "jest": "^29.6.2",
52
+ "ts-jest": "^29.1.1",
53
+ "typedoc": "^0.24.8",
54
+ "typescript": "^4.9.5"
55
+ },
56
+ "dependencies": {
57
+ "data-structure-typed": "^1.19.3",
58
+ "zod": "^3.22.2"
59
+ }
60
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "compilerOptions": {
3
+ "declaration": true,
4
+ "outDir": "./dist",
5
+ "module": "commonjs",
6
+ "target": "es5",
7
+ "lib": [
8
+ "esnext",
9
+ ],
10
+ "strict": true,
11
+ "esModuleInterop": true,
12
+ "moduleResolution": "node",
13
+ "declarationDir": "./dist",
14
+ "skipLibCheck": true,
15
+ "downlevelIteration": true,
16
+ "experimentalDecorators": true,
17
+ // "allowJs": true,
18
+ // "allowSyntheticDefaultImports": true,
19
+ // "forceConsistentCasingInFileNames": true,
20
+ // "noFallthroughCasesInSwitch": true,
21
+ // "resolveJsonModule": true,
22
+ // "isolatedModules": true,
23
+ // "noEmit": true,
24
+ "typeRoots": [
25
+ "node_modules/@types"
26
+ ]
27
+ },
28
+
29
+ "include": [
30
+ "src",
31
+ ],
32
+ "exclude": [
33
+ // "node_modules/data-structure-typed",
34
+ "node_modules",
35
+ "dist"
36
+ ]
37
+ }