Skip to content

Conversation

@imaslenchenko
Copy link

No description provided.


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

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

Choose a reason for hiding this comment

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

А почему undefined ?

const transformRegexp =
/(matrix\(-?\d+(\.\d+)?, -?\d+(\.\d+)?, -?\d+(\.\d+)?, -?\d+(\.\d+)?, )(-?\d+(\.\d+)?), (-?\d+(\.\d+)?)\)/;

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

Choose a reason for hiding this comment

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

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

export const shortColorRegExp = /^#[0-9a-f]{3}$/i;
export const longColorRegExp = /^#[0-9a-f]{6}$/i;

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

Choose a reason for hiding this comment

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

Не только void

return [red, green, blue];
};

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

Choose a reason for hiding this comment

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

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

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 }[]

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