max-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 './max-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("./max-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 MaxPriorityQueue<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'>): MaxPriorityQueue<T>;
14
+ static heapify<T>(options: PriorityQueueOptions<T>): MaxPriorityQueue<T>;
15
+ }
@@ -0,0 +1,67 @@
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.MaxPriorityQueue = 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 MaxPriorityQueue = /** @class */ (function (_super) {
39
+ __extends(MaxPriorityQueue, _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 properties to configure
43
+ * the priority queue.
44
+ */
45
+ function MaxPriorityQueue(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 bKey - aKey;
49
+ } })) || this;
50
+ }
51
+ /**
52
+ * The function `heapify` creates a max priority queue from the given options and returns it.
53
+ * @param options - The `options` parameter is an object that contains configuration options for creating a priority
54
+ * queue. It can have the following properties:
55
+ * @returns a MaxPriorityQueue object.
56
+ */
57
+ MaxPriorityQueue.heapify = function (options) {
58
+ var maxPQ = new MaxPriorityQueue(__assign(__assign({}, options), { comparator: (options === null || options === void 0 ? void 0 : options.comparator) ? options.comparator : function (a, b) {
59
+ var aKey = a, bKey = b;
60
+ return bKey - aKey;
61
+ } }));
62
+ maxPQ._fix();
63
+ return maxPQ;
64
+ };
65
+ return MaxPriorityQueue;
66
+ }(data_structure_typed_1.PriorityQueue));
67
+ exports.MaxPriorityQueue = MaxPriorityQueue;
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": "max-priority-queue-typed",
3
+ "version": "1.19.3",
4
+ "description": "Max 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
+ "Max priority queue",
20
+ "Heap data structure",
21
+ "Binary heap",
22
+ "Priority management",
23
+ "Insertion",
24
+ "Deletion",
25
+ "Max value",
26
+ "Heap property",
27
+ "Complete binary tree",
28
+ "Heapify",
29
+ "Extract maximum",
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
+ }