@gabrielrufino/cerebrum 1.1.0 → 1.1.1

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.
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BubbleSort = void 0;
4
- class BubbleSort {
5
- constructor(numbers) {
6
- this.numbers = numbers;
7
- }
4
+ const Sort_1 = require("./Sort");
5
+ class BubbleSort extends Sort_1.Sort {
8
6
  execute() {
9
7
  for (let i = 0; i < this.numbers.length - 1; i++) {
10
8
  for (let j = 0; j < this.numbers.length - i - 1; j++) {
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SelectionSort = void 0;
4
- class SelectionSort {
5
- constructor(numbers) {
6
- this.numbers = numbers;
7
- }
4
+ const Sort_1 = require("./Sort");
5
+ class SelectionSort extends Sort_1.Sort {
8
6
  execute() {
9
7
  for (let i = 0; i < this.numbers.length - 1; i++) {
10
8
  let minIndex = i;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Sort = void 0;
4
+ class Sort {
5
+ constructor(numbers) {
6
+ this.numbers = numbers;
7
+ }
8
+ }
9
+ exports.Sort = Sort;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gabrielrufino/cerebrum",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Algorithms made in TypeScript",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -1,8 +1,6 @@
1
- export class BubbleSort {
2
- constructor (
3
- private readonly numbers: Array<number>
4
- ) {}
1
+ import { Sort } from './Sort';
5
2
 
3
+ export class BubbleSort extends Sort {
6
4
  public execute(): Array<number> {
7
5
  for (let i = 0; i < this.numbers.length - 1; i++) {
8
6
  for (let j = 0; j < this.numbers.length - i - 1; j++) {
@@ -1,8 +1,6 @@
1
- export class SelectionSort {
2
- constructor(
3
- private readonly numbers: Array<number>
4
- ) {}
1
+ import { Sort } from './Sort';
5
2
 
3
+ export class SelectionSort extends Sort {
6
4
  public execute(): Array<number> {
7
5
  for (let i = 0; i < this.numbers.length - 1; i++) {
8
6
  let minIndex = i;
@@ -0,0 +1,7 @@
1
+ export abstract class Sort {
2
+ constructor(
3
+ protected readonly numbers: Array<number>
4
+ ) {}
5
+
6
+ public abstract execute(): Array<number>
7
+ }