From 82af659356c06f976bdd557ac1b911691b07c808 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:41:24 +0000 Subject: [PATCH] chore: apply automated fixes --- src/list-iterator.ts | 28 ++++++++++++++-------------- src/list.ts | 14 +++++++------- test/list.test.ts | 14 +++++++------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/list-iterator.ts b/src/list-iterator.ts index 351b92e..fec2b88 100644 --- a/src/list-iterator.ts +++ b/src/list-iterator.ts @@ -9,7 +9,7 @@ export interface AbstractIterator extends Iterable { * @type {() => this} */ first: () => this; - + /** * Sets current position to last element of list * @date 1/23/2024 - 7:19:25 PM @@ -17,7 +17,7 @@ export interface AbstractIterator extends Iterable { * @type {() => this} */ last: () => this; - + /** * Moves current position back one element * @date 1/23/2024 - 7:20:09 PM @@ -25,7 +25,7 @@ export interface AbstractIterator extends Iterable { * @type {() => this} */ previous: () => this; - + /** * Moves current position forward one element * @date 1/23/2024 - 7:20:25 PM @@ -33,7 +33,7 @@ export interface AbstractIterator extends Iterable { * @type {() => this} */ next: () => this; - + /** * Returns the current position in list * @date 1/23/2024 - 7:20:39 PM @@ -41,7 +41,7 @@ export interface AbstractIterator extends Iterable { * @type {() => number} */ current: () => number; - + /** * Moves the current position to specified position * @date 1/23/2024 - 7:21:14 PM @@ -63,32 +63,32 @@ export class AbstractListIterator implements AbstractIterator { return this; } - public next(): this{ + public next(): this { // this.position - if(this.position < this.length -1){ - ++this.position + if (this.position < this.length - 1) { + ++this.position; } return this; } - public previous(): this{ - if(this.position > 0){ + public previous(): this { + if (this.position > 0) { --this.position; } return this; } - public current () { + public current() { return this.position; } - public last(): this{ + public last(): this { this.position = this.length - 1; return this; } - public moveTo (position: number): this { + public moveTo(position: number): this { this.position = position - 1; return this; } -} \ No newline at end of file +} diff --git a/src/list.ts b/src/list.ts index f68d5b5..e05bb29 100644 --- a/src/list.ts +++ b/src/list.ts @@ -3,7 +3,7 @@ import { AbstractIterator, AbstractListIterator } from "./list-iterator"; /* eslint-disable @typescript-eslint/no-inferrable-types */ -export interface AbstractList extends AbstractIterator{ +export interface AbstractList extends AbstractIterator { /** * Determine Number of elements in list * @date 1/23/2024 - 12:53:11 PM @@ -46,7 +46,7 @@ export interface AbstractList extends AbstractIterator{ * * ``` */ - getElement: () => List|undefined; + getElement: () => List | undefined; /** * Inserting an Element into a List @@ -135,17 +135,17 @@ export interface AbstractList extends AbstractIterator{ export class List extends AbstractListIterator { public size: number = 0; private _context: Array = []; - - public contains (element: T extends any ? T : never) : boolean { - for(let i = 0; i < this.length; ++i){ - if(this.context[i] === element){ + + public contains(element: T extends any ? T : never): boolean { + for (let i = 0; i < this.length; ++i) { + if (this.context[i] === element) { return true; } } return false; } - public clear() : void { + public clear(): void { this._context = []; this.size = this.position = this.length = 0; } diff --git a/test/list.test.ts b/test/list.test.ts index 87346a5..86a3f57 100644 --- a/test/list.test.ts +++ b/test/list.test.ts @@ -189,13 +189,13 @@ describe("List", () => { personLists.previous(); expect(personLists.getElement()).toStrictEqual({ name: "person2", - age: 20 - }) + age: 20, + }); personLists.previous(); expect(personLists.getElement()).toStrictEqual({ name: "person1", - age: 10 - }) + age: 10, + }); }); it("call ``moveTo`` any ways should return correct element for that position", () => { @@ -218,10 +218,10 @@ describe("List", () => { personLists.moveTo(3); expect(personLists.getElement()).toStrictEqual({ name: "person3", - age: 30 - }) + age: 30, + }); expect(personLists.current()).toStrictEqual(personLists.position); - }) + }); }); describe("Utils Methods Call", () => { it("Call ``toString()`` should can return string represent the list", () => {