@gabrielrufino/cube 1.0.19 → 1.0.20

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.
@@ -11,7 +11,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  var MaxHeap = /** @class */ (function () {
13
13
  function MaxHeap(_a) {
14
- var _b = _a === void 0 ? { inputs: [] } : _a, greaterThanOrEqualTo = _b.greaterThanOrEqualTo, _c = _b.inputs, inputs = _c === void 0 ? [] : _c;
14
+ var _b = _a === void 0 ? {} : _a, greaterThanOrEqualTo = _b.greaterThanOrEqualTo, _c = _b.inputs, inputs = _c === void 0 ? [] : _c;
15
15
  this._data = [];
16
16
  this._greaterThanOrEqualTo = function (value1, value2) { return value1 >= value2; };
17
17
  this._getLeftIndex = function (index) { return (2 * index) + 1; };
@@ -89,13 +89,12 @@ var MaxHeap = /** @class */ (function () {
89
89
  }
90
90
  };
91
91
  MaxHeap.prototype[Symbol.toPrimitive] = function (type) {
92
- if (type === 'string') {
93
- return this.data.join(', ');
94
- }
95
- if (type === 'number') {
96
- return this.size;
97
- }
98
- return null;
92
+ var primitives = {
93
+ default: true,
94
+ number: this.size,
95
+ string: this.data.join(', '),
96
+ };
97
+ return primitives[type];
99
98
  };
100
99
  return MaxHeap;
101
100
  }());
@@ -11,7 +11,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  var MinHeap = /** @class */ (function () {
13
13
  function MinHeap(_a) {
14
- var _b = _a === void 0 ? { inputs: [] } : _a, lessThanOrEqualTo = _b.lessThanOrEqualTo, _c = _b.inputs, inputs = _c === void 0 ? [] : _c;
14
+ var _b = _a === void 0 ? {} : _a, lessThanOrEqualTo = _b.lessThanOrEqualTo, _c = _b.inputs, inputs = _c === void 0 ? [] : _c;
15
15
  this._data = [];
16
16
  this._lessThanOrEqualTo = function (value1, value2) { return value1 <= value2; };
17
17
  this._getLeftIndex = function (index) { return (2 * index) + 1; };
@@ -89,13 +89,12 @@ var MinHeap = /** @class */ (function () {
89
89
  }
90
90
  };
91
91
  MinHeap.prototype[Symbol.toPrimitive] = function (type) {
92
- if (type === 'string') {
93
- return this.data.join(', ');
94
- }
95
- if (type === 'number') {
96
- return this.size;
97
- }
98
- return null;
92
+ var primitives = {
93
+ default: true,
94
+ number: this.size,
95
+ string: this.data.join(', '),
96
+ };
97
+ return primitives[type];
99
98
  };
100
99
  return MinHeap;
101
100
  }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gabrielrufino/cube",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "Data Structures and Algorithms made in Typescript",
5
5
  "main": "build/index.js",
6
6
  "scripts": {