Skip to content

Added my coursework - #14

Open
stanislav7766 wants to merge 2 commits into
HowProgrammingWorks:masterfrom
stanislav7766:difference
Open

Added my coursework#14
stanislav7766 wants to merge 2 commits into
HowProgrammingWorks:masterfrom
stanislav7766:difference

Conversation

@stanislav7766

Copy link
Copy Markdown

No description provided.

@tshemsedinov tshemsedinov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fix naming, improve style

Comment thread client.js Outdated
if (array[index] === '')
Array.prototype.splice.apply(array, [index, 1].concat(arrayToInsert));
else
Array.prototype.splice.apply(array, [index, 0].concat(arrayToInsert));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use ternary op or +(logical value) here

Comment thread client.js Outdated
const trouble = ['addToEmpty', 'addWithTrouble'];
//массив , где элементы - возможжные операции с перезаписью поля
const applyDelta = (arr, obj) => { //функция , для применения изменений
// у других клиентов

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

const idx = obj.line - 1;

Comment thread client.js Outdated
return d;
};
const setDelta = (oldSource, newSource) => { //наша главная функция,
//в которой мы определяем , какого типа будет наша дельта

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Format comments

Comment thread client.js Outdated
insertArrayAt(arr, obj.line, obj.data[1]);
arr.splice(obj.line + 1, 0, '');
} else insertArrayAt(arr, obj.line, obj.data[1]);
} else if (obj.operation === 'addNewLine') {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use collection instead of if else if ...

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