@gabrielrufino/cube 1.0.15 → 1.0.18

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.
@@ -63,13 +63,12 @@ var Deck = /** @class */ (function (_super) {
63
63
  return element;
64
64
  };
65
65
  Deck.prototype[Symbol.toPrimitive] = function (type) {
66
- if (type === 'string') {
67
- return "[Front] ".concat(this.data.join(', '), " [Back]");
68
- }
69
- if (type === 'number') {
70
- return this.size;
71
- }
72
- return null;
66
+ var primitives = {
67
+ number: this.size,
68
+ string: "[Front] ".concat(this.data.join(', '), " [Back]"),
69
+ default: true,
70
+ };
71
+ return primitives[type];
73
72
  };
74
73
  return Deck;
75
74
  }(DataStructure_1.default));
@@ -61,13 +61,12 @@ var Queue = /** @class */ (function (_super) {
61
61
  this._data = [];
62
62
  };
63
63
  Queue.prototype[Symbol.toPrimitive] = function (type) {
64
- if (type === 'string') {
65
- return "[Front] ".concat(this.data.join(', '));
66
- }
67
- if (type === 'number') {
68
- return this.size;
69
- }
70
- return null;
64
+ var primitives = {
65
+ default: true,
66
+ number: this.size,
67
+ string: "[Front] ".concat(this.data.join(', ')),
68
+ };
69
+ return primitives[type];
71
70
  };
72
71
  return Queue;
73
72
  }(DataStructure_1.default));
@@ -119,13 +119,12 @@ var Set = /** @class */ (function () {
119
119
  .every(function (element) { return set2.has(element); });
120
120
  };
121
121
  Set.prototype[Symbol.toPrimitive] = function (type) {
122
- if (type === 'string') {
123
- return "{ ".concat(this.data.join(', '), " }");
124
- }
125
- if (type === 'number') {
126
- return this.size;
127
- }
128
- return null;
122
+ var primitives = {
123
+ number: this.size,
124
+ string: "{ ".concat(this.data.join(', '), " }"),
125
+ default: true,
126
+ };
127
+ return primitives[type];
129
128
  };
130
129
  return Set;
131
130
  }());
@@ -51,13 +51,12 @@ var Stack = /** @class */ (function (_super) {
51
51
  configurable: true
52
52
  });
53
53
  Stack.prototype[Symbol.toPrimitive] = function (type) {
54
- if (type === 'string') {
55
- return "".concat(this.data.join(', '), " [Top]");
56
- }
57
- if (type === 'number') {
58
- return this.size;
59
- }
60
- return null;
54
+ var primitives = {
55
+ default: true,
56
+ number: this.size,
57
+ string: "".concat(this.data.join(', '), " [Top]"),
58
+ };
59
+ return primitives[type];
61
60
  };
62
61
  return Stack;
63
62
  }(DataStructure_1.default));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gabrielrufino/cube",
3
- "version": "1.0.15",
3
+ "version": "1.0.18",
4
4
  "description": "Data Structures and Algorithms made in Typescript",
5
5
  "main": "build/index.js",
6
6
  "scripts": {