@gabrielrufino/cube 1.0.14 → 1.0.17

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.
package/README.md CHANGED
@@ -7,7 +7,7 @@ Data Structures and Algorithms made in Typescript
7
7
  #### Installing package
8
8
 
9
9
  ```bash
10
- npm i @gabrielrufino/cube
10
+ npm install @gabrielrufino/cube
11
11
  ```
12
12
 
13
13
  #### Importing package
@@ -33,11 +33,7 @@ var Array = /** @class */ (function (_super) {
33
33
  return element;
34
34
  };
35
35
  Array.prototype.insertInFirstPosition = function (element) {
36
- for (var i = this.size; i > 0; i--) {
37
- this._data[i] = this._data[i - 1];
38
- }
39
- this._data[0] = element;
40
- return element;
36
+ return this.insertInPosition(0, element);
41
37
  };
42
38
  Array.prototype.insertInPosition = function (position, element) {
43
39
  this._data.splice(position, 0, element);
@@ -66,13 +62,12 @@ var Array = /** @class */ (function (_super) {
66
62
  return element;
67
63
  };
68
64
  Array.prototype[Symbol.toPrimitive] = function (type) {
69
- if (type === 'string') {
70
- return this.data.join(', ');
71
- }
72
- if (type === 'number') {
73
- return this.size;
74
- }
75
- return null;
65
+ var primitives = {
66
+ number: this.size,
67
+ string: this.data.join(', '),
68
+ default: true,
69
+ };
70
+ return primitives[type];
76
71
  };
77
72
  return Array;
78
73
  }(DataStructure_1.default));
@@ -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));
@@ -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
  }());
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@gabrielrufino/cube",
3
- "version": "1.0.14",
3
+ "version": "1.0.17",
4
4
  "description": "Data Structures and Algorithms made in Typescript",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
7
7
  "lint": "eslint src/**/*.ts",
8
8
  "test": "jest",
9
9
  "test:cov": "npm t -- --coverage",
10
+ "test:mutation": "npx stryker run",
10
11
  "test:watch": "npm t -- --watch",
11
12
  "build": "rimraf ./build && tsc",
12
13
  "reinstall": "rimraf node_modules && npm ci"
@@ -28,6 +29,9 @@
28
29
  "homepage": "https://github.com/gabrielrufino/cube#readme",
29
30
  "devDependencies": {
30
31
  "@faker-js/faker": "^6.1.2",
32
+ "@stryker-mutator/core": "^6.0.2",
33
+ "@stryker-mutator/jest-runner": "^6.0.2",
34
+ "@stryker-mutator/typescript-checker": "^6.0.2",
31
35
  "@types/jest": "^27.4.1",
32
36
  "@typescript-eslint/eslint-plugin": "^5.13.0",
33
37
  "@typescript-eslint/parser": "^5.13.0",
@@ -35,6 +39,7 @@
35
39
  "eslint-config-xo": "^0.39.0",
36
40
  "jest": "^27.5.1",
37
41
  "rimraf": "^3.0.2",
42
+ "stryker-cli": "^1.0.2",
38
43
  "ts-jest": "^27.1.3",
39
44
  "ts-node": "^10.5.0",
40
45
  "typescript": "^4.6.2"