Skip to content

@ryanuo/utils / common

common

提供项目通用工具类、基础类型和公共逻辑,避免代码重复。

Date

FunctionDescription
dateFormat日期格式化

Other

NameDescription
dayjs-
curryConverts a function into a curried function. The feature of a curried function is that it can receive one or more arguments, and returns a new function until all required arguments are received, then executes the original function.
debounceFunction debouncing A debouncing function is used to limit the frequency of executing a function within a specified time frame, preventing it from being called too frequently. If the function is called again within the specified interval, the previous call will be canceled and the timer will reset.
getUuidGenerate a unique UUID UUID (Universally Unique Identifier) is a standard used in distributed systems to uniquely identify information This function implements a simple UUID generation algorithm, primarily used to generate unique identifiers for use in applications
safeJSONParseSafely parses a JSON string
throttleCreates a throttled function that only executes the original function at most once per delay milliseconds. If immediate is true, the original function will be executed immediately upon the first call within the delay period.

is

FunctionDescription
isBooleanChecks if the value is a boolean
isBrowserChecks if the current environment is a browser
isDateChecks if the value is an date
isEmptyObjectCheck if an object is empty.
isFunctionChecks if the value is a function
isNullChecks if the value is an null
isNumberChecks if the value is a number
isObjectChecks if the value is an object
isRegExpChecks if the value is an regexp
isStringChecks if the value is an string
isUndefinedChecks if the value is an undefined

type

FunctionDescription
deepClone安全的深拷贝(处理循环引用)
getTypeNameGet the type name of the value
numberToFixedConvert a number to a fixed value with specified decimal places.
toStringto string type of value [Object.prototype.toString]