Loading...
01978
PercentageParser
type ReverseString<S extends string, L extends string = ''> = S extends `${infer First}${infer Rest}` ? ReverseString<Rest,`${First}${L}`> : L; type FirstChar<S extends string> = S extends `${infer First}${infer Rest}` ? First : S; type LastChar<S extends string> = FirstChar<ReverseString<S>>; type CurFirst<S extends string> = S extends `${infer First}${infer Rest}` ? Rest : S; type CurLast<S extends string> = ReverseString<CurFirst<ReverseString<S>>>; type PercentageParser<A extends string> = FirstChar<A> extends "+"|"-" ? LastChar<A> extends "%" ? [FirstChar<A>,CurLast<CurFirst<A>>,LastChar<A>] : [FirstChar<A>,CurFirst<A>, ''] : LastChar<A> extends "%" ? ['', CurLast<A>,LastChar<A>] : ['',A,'']
Link

본 페이지는 상업적 목적이 아닌

개인 포트폴리오 공개용이며

코드는 깃허브에 모두 공개되어 있습니다.

NextJS Typescript react-query @chakra-ui 로 제작되었습니다.