-
Notifications
You must be signed in to change notification settings - Fork 19
Solutions by Stepan Kormilin #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jsteacat
wants to merge
8
commits into
SArchieEdu:main
Choose a base branch
from
jsteacat:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6172cb7
precommit
jsteacat 41a469a
precommit
jsteacat e96bfa2
Merge remote-tracking branch 'origin/main'
jsteacat 55122f0
precommit
jsteacat 1ea7e81
precommit
jsteacat 04c7df4
precommit
jsteacat 4b4a3b1
precommit
jsteacat 408ccb1
solutions
jsteacat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,50 @@ | ||
| export class SuccessButton {} | ||
| export class ErrorButton {} | ||
| export class SuccessNotification {} | ||
| export class ErrorNotification {} | ||
| export class SuccessButton { | ||
| create() { | ||
| return '<div class="button button__success">Button</div>' | ||
| } | ||
| } | ||
|
|
||
| export class ErrorButton { | ||
| create() { | ||
| return '<div class="button button__error">Button</div>' | ||
| } | ||
| } | ||
|
|
||
| export class SuccessNotification { | ||
| create() { | ||
| return '<div class="notify notify__success">Notification</div>' | ||
| } | ||
| } | ||
|
|
||
| export class ErrorNotification { | ||
| create() { | ||
| return '<div class="notify notify__error">Notification</div>' | ||
| } | ||
| } | ||
|
|
||
| export class SuccessControl { | ||
| create (type = '') { | ||
| // todo: implement logic | ||
| if (type === 'notification') | ||
| return new SuccessNotification() | ||
| else | ||
| return new SuccessButton() | ||
| } | ||
| } | ||
|
|
||
| export class ErrorControl { | ||
| create (type = '') { | ||
| // todo: implement logic | ||
| if (type === 'notification') | ||
| return new ErrorNotification() | ||
| else | ||
| return new ErrorButton() | ||
| } | ||
| } | ||
|
|
||
| export default class ControlsFactory { | ||
| getFactory (factoryType = '') { | ||
| // todo: implement logic | ||
| if (factoryType === 'error') | ||
| return new ErrorControl() | ||
| else | ||
| return new SuccessControl() | ||
| } | ||
| } | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,21 @@ | ||
| export default class RequestBuilder { | ||
| constructor(url = '') { | ||
| this.url = new URL(url); | ||
| this.url = new URL(url) | ||
| } | ||
|
|
||
| addPagination (start, end) { | ||
| // todo: implement logic | ||
| this.url.searchParams.set('start', start) | ||
| this.url.searchParams.set('end', end) | ||
| } | ||
|
|
||
| addSort (sort, order) { | ||
| // todo: implement logic | ||
| this.url.searchParams.set('sort', sort) | ||
| this.url.searchParams.set('order', order) | ||
| } | ||
|
|
||
| addFilter (filter, filterLte, filterGte) { | ||
| // todo: implement logic | ||
| this.url.searchParams.set('filter', filter) | ||
| this.url.searchParams.set('filter_lte', filterLte) | ||
| this.url.searchParams.set('filter_gte', filterGte) | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,27 @@ | ||
| class Monster { | ||
| // todo: implement logic | ||
| constructor(settings = {}) { | ||
| this.settings = settings | ||
| } | ||
| } | ||
|
|
||
| export default class Location { | ||
| monsters = []; | ||
| monsters = [] | ||
|
|
||
| constructor(name = '', monstersCount = 0, monstersSettings = {}) { | ||
| this.name = name; | ||
| // todo: implement logic | ||
| this.name = name | ||
| this.monstersCount = monstersCount | ||
| this.monstersSettings = monstersSettings | ||
|
|
||
| this.initMonsters() | ||
| } | ||
|
|
||
| initMonsters () { | ||
| // todo: implement logic | ||
| for (let i = 0; i < this.monstersCount; i++) { | ||
| this.monsters.push(new Monster(this.monstersSettings)); | ||
| } | ||
| } | ||
|
|
||
| clone () { | ||
| // todo: implement logic | ||
| return { ...new Location() } | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,11 @@ | ||
| export default class Singleton { | ||
| static #instance; | ||
|
|
||
| constructor() { | ||
| // todo: implement logic | ||
| if (Singleton.#instance) { | ||
| return Singleton.#instance; | ||
| } | ||
|
|
||
| Singleton.#instance = this; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,24 @@ | ||
| export const getArea = shape => { | ||
| return shape.width * shape.height; | ||
| return shape.width * shape.height | ||
| }; | ||
|
|
||
| export class Square { | ||
| constructor(size) { | ||
| this.size = size; | ||
| this.size = size | ||
| } | ||
| } | ||
|
|
||
| export class Rectangle { | ||
| constructor(width, height) { | ||
| this.width = width; | ||
| this.height = height; | ||
| this.width = width | ||
| this.height = height | ||
| } | ||
| } | ||
|
|
||
| export class Adapter { | ||
| constructor(shape) { | ||
| // todo: add implementation | ||
| this.width = shape.width ?? shape.size | ||
| this.height = shape.height ?? shape.size | ||
| } | ||
| } | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше через switch, case так расширять проще