1.0.3 • Published 2 months ago

@shuchaoxxx/csc-utils v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 months ago

csc-utils

A TypeScript utility library with commonly used tools and functions.

Features

  • TypeScript support
  • Built with Rollup
  • Includes popular utilities:
    • lodash
    • dayjs
    • axios

Installation

npm install csc-utils

本地使用 storybook 调试

npm run storybook

Usage

import { formatDate, debounce, fetchData } from "csc-utils";

// Format date
const formattedDate = formatDate(new Date());

// Use debounce
const debouncedFn = debounce(() => {
  console.log("Debounced function called");
}, 1000);

// Fetch data
const data = await fetchData("https://api.example.com/data");

API

formatDate(date: Date | string, format?: string): string

Formats a date using dayjs.

debounce(func: Function, wait: number): Function

Creates a debounced function that delays invoking func until after wait milliseconds have elapsed.

fetchData(url: string): Promise

Makes an HTTP GET request using axios.

License

ISC

1.0.3

2 months ago

1.0.2

2 months ago

1.0.1

2 months ago

1.0.0

2 months ago