Skip to content

refact: comlete homework tasks#81

Open
imaslenchenko wants to merge 2 commits into
React-js-OTUS:mainfrom
imaslenchenko:homework1
Open

refact: comlete homework tasks#81
imaslenchenko wants to merge 2 commits into
React-js-OTUS:mainfrom
imaslenchenko:homework1

Conversation

@imaslenchenko
Copy link
Copy Markdown

No description provided.

Comment thread src/homeworks/ts1/1_base.ts Outdated

export const removeFirstZeros = (value: string): string => value.replace(/^(-)?[0]+(-?\d+.*)$/, '$1$2');

export const getBeautifulNumber = (value: number | string, separator = ' '): string | undefined =>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

А почему undefined ?

Comment thread src/homeworks/ts1/1_base.ts Outdated
const transformRegexp =
/(matrix\(-?\d+(\.\d+)?, -?\d+(\.\d+)?, -?\d+(\.\d+)?, -?\d+(\.\d+)?, )(-?\d+(\.\d+)?), (-?\d+(\.\d+)?)\)/;

export const getTransformFromCss = (transformCssString: string): { x: number; y: number } => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

{ x: number; y: number } стоит вынести в отдельный тип

Comment thread src/homeworks/ts1/1_base.ts Outdated
export const shortColorRegExp = /^#[0-9a-f]{3}$/i;
export const longColorRegExp = /^#[0-9a-f]{6}$/i;

export const checkColor = (color: string): void => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Не только void

Comment thread src/homeworks/ts1/1_base.ts Outdated
return [red, green, blue];
};

export const getNumberedArray = (arr: number[]): { value: number; number: number }[] => arr.map((value, number) => ({ value, number }));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Стоит вынести в отдельный тип, так стоит посмотреть шире может быть не только number

Comment thread src/homeworks/ts1/1_base.ts Outdated
export const toStringArray = (arr: { value: number; number: number }[]): string[] => arr.map(({ value, number }) => `${value}_${number}`);

export const transformCustomers = (
customers: { id: number; name: string; age: number; isSubscribed: boolean }[]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

{ id: number; name: string; age: number; isSubscribed: boolean }[] отдельный тип

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