@teamsparta/utils
v1.2.5
Published
`@teamsparta/utils`는 React, NextJS, NestJS 등 JavaScript 환경에서 사용할 수 있으며 type - safe한 유틸리티성 함수들을 모아놓은 패키지입니다.
Downloads
637
Maintainers
Keywords
Readme
@teamsparta/utils
@teamsparta/utils
는 React, NextJS, NestJS 등 JavaScript 환경에서 사용할 수 있으며 type - safe한 유틸리티성 함수들을 모아놓은 패키지입니다.
Getting Started
npm install @teamsparta/utils # npm
yarn add @teamsparta/utils # yarn
pnpm add @teamsparta/utils # pnpm
Usage
- clamp: 입력값을 최솟값과 최댓값 사이로 제한합니다.
import { clamp } from '@teamsparta/utils';
function setTime(date: Date, hour: number, minute: number, second: number) {
return date.setHours(
clamp(hour, 0, 23),
clamp(minute, 0, 59),
clamp(second, 0, 59),
);
}