-
Notifications
You must be signed in to change notification settings - Fork 63
refact: comlete homework tasks #81
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
base: main
Are you sure you want to change the base?
Conversation
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 => |
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.
А почему undefined ?
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 } => { |
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.
{ x: number; y: number } стоит вынести в отдельный тип
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 => { |
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.
Не только void
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 })); |
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.
Стоит вынести в отдельный тип, так стоит посмотреть шире может быть не только number
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 }[] |
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.
{ id: number; name: string; age: number; isSubscribed: boolean }[] отдельный тип
No description provided.