Skip to content

Lesson14: Functional programming#15

Open
mkremnev wants to merge 5 commits into
masterfrom
lessons/lesson14
Open

Lesson14: Functional programming#15
mkremnev wants to merge 5 commits into
masterfrom
lessons/lesson14

Conversation

@mkremnev

Copy link
Copy Markdown
Owner

No description provided.

Comment thread public/index.html
Comment on lines +4 to +13
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Otus project Game of Life</title>
</head>

<body>
<div id="app"></div>
</body>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

давай в следующий раз без лишних изменений (тех, которые к домашке не относятся)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Принял, не повторится)


// Задание 1
test('team to team', () => {
const originalTeam: OriginalTeam = Object.freeze({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а зачем фриз?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Фриз было в самом репозитории домашки, я не менял ничего.

Comment on lines +17 to +27
const withoutSize = Object.entries(originalTeam).filter(
(value) => value[0] !== 'size',
);
const newValueKeyOfName = withoutSize.map((value) => {
if (value[0] === 'name' && value[1] !== 'New York Badgers')
value[1] = 'New York Badgers';
return value;
});
const teamNew = Object.fromEntries(
(newValueKeyOfName as unknown) as string[],
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

сложновато, не находишь?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Согласен, надо пересмотреть будет

export const originalArrayToExpectedArray = (
originalArray: SomeArray,
): SomeArray => {
const cloneArrayWithoutFirstElement = originalArray.slice(2);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а если сделать это рестом?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так клонировать же надо без первого элемента, не пойму как можно сделать это рестом

const objectToArray = Object.entries(qsObj);
const elementJoinEquals = objectToArray.map((val) => val.join('='));
const stringJoinAmp = elementJoinEquals.join('&');
const propsWithSymbol = stringJoinAmp.replace(/^/, '?');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем replace если ты просто добавляешь символ?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Согласен, лишнего сделал

// Задание 3

export const parseQs = (qs: string): QsObj => {
const propsWithoutSymbol = qs.replace(/\?/y, '');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тебе же только первый вопрос убрать нужно, в смысле если он на первом месте

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделаю, спасибо.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants