-
Notifications
You must be signed in to change notification settings - Fork 63
Completed tasks #43
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?
Completed tasks #43
Conversation
src/homeworks/ts1/1_base.ts
Outdated
| export const removePlus = (string: string): string => string.replace(/^\+/, ''); | ||
| export const addPlus = (string: string): string => `+${string}`; | ||
| export const removeFirstZeros = (value: string): string => value.replace(/^(-)?[0]+(-?\d+.*)$/, '$1$2'); | ||
| export const getBeautifulNumber = (value: number | undefined, separator = ' ') => |
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 по логике не совсем ясно. number тоже имеет метод toString
|
|
||
| const transformRegexp = | ||
| /(matrix\(-?\d+(\.\d+)?, -?\d+(\.\d+)?, -?\d+(\.\d+)?, -?\d+(\.\d+)?, )(-?\d+(\.\d+)?), (-?\d+(\.\d+)?)\)/; | ||
|
|
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 }
| /(matrix\(-?\d+(\.\d+)?, -?\d+(\.\d+)?, -?\d+(\.\d+)?, -?\d+(\.\d+)?, )(-?\d+(\.\d+)?), (-?\d+(\.\d+)?)\)/; | ||
|
|
||
| export const getTransformFromCss = (transformCssString: string): { x: number; y: number } => { | ||
| const data = transformCssString.match(transformRegexp); |
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
| // http://www.w3.org/TR/AERT#color-contrast | ||
| Math.round((red * 299 + green * 587 + blue * 114) / 1000); | ||
|
|
||
| export const getContrastType = (contrastValue: number): string => (contrastValue > 125 ? 'black' : 'white'); |
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.
тут стоит сузить тип до 'black' | 'white'
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
| const blue = parseInt(color.substring(5, 8), 16); | ||
| return [red, green, blue]; | ||
| }; | ||
|
|
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.
Array<{ value: number; number: number } отдельный тип
src/homeworks/ts1/1_base.ts
Outdated
|
|
||
| export const getNumberedArray = (arr: Array<number>): Array<{ value: number; number: number }> => | ||
| arr.map((value, number) => ({ value, number })); | ||
| export const toStringArray = (arr: Array<{ value: number, number: number}>): Array<string> => |
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.
Array<{ value: number, number: number}> отдельный тип
No description provided.