@pengzhanbo/utils - v3.5.0
    Preparing search index...

    @pengzhanbo/utils - v3.5.0

    A common JavaScript utility library, zero dependencies, any runtime.

    一个常用的工具类库, 无依赖, 任何运行时。

    jsr package jsr score MIT License npm package codecov document coverage

    # npm
    npm i @pengzhanbo/utils
    # pnpm
    pnpm add @pengzhanbo/utils
    # yarn
    yarn add @pengzhanbo/utils
    # bun
    bun add @pengzhanbo/utils
    # deno
    deno add jsr:@pengzhanbo/utils
    import { uniq, toArray } from '@pengzhanbo/utils'

    uniq([1, 1, 2, 2, 3, 3]) // => [1, 2, 3]
    toArray(null) // => []
    toArray(2) // => [2]

    Predicate

    isArray
    isBlob
    isBoolean
    isBrowser
    isBuffer
    isDate
    isDef
    isEmpty
    isEmptyObject
    isError
    isFinite
    isFunction
    isInteger
    isIterable
    isJSONArray
    isJSONObject
    isJSONValue
    isKeyof
    isMap
    isNil
    isNull
    isNumber
    isPlainObject
    isPrimitive
    isPromise
    isRegexp
    isSafeInteger
    isSet
    isString
    isSymbol
    isTypedArray
    isTypeof
    isUndefined
    isWindow
    typeOf

    Array

    ArrayIterator
    chunk
    count
    countBy
    difference
    differenceBy
    filterAsync
    findFirstThen
    findLastThen
    groupBy
    intersection
    intersectionBy
    keyBy
    limitAsync
    mapAsync
    move
    orderBy
    partition
    range
    remove
    removeBy
    sample
    sampleSize
    shuffle
    sortBy
    toArray
    union
    unionBy
    uniq
    uniqBy
    uniqWith

    Object

    ObjectIterator
    clearUndefined
    deepEqual
    deepFreeze
    deepMerge
    deepMergeWithArray
    deleteKey
    hasOwn
    objectEntries
    objectGet
    objectKeys
    objectMap
    omit
    omitBy
    pick
    pickBy

    String

    camelCase
    capitalize
    constantCase
    ensurePrefix
    ensureSuffix
    escape
    escapeRegExp
    indent
    kebabCase
    lowerCase
    pascalCase
    slugify
    snakeCase
    template
    titleCase
    truncate
    unescape
    upperCase
    words

    Promise

    Semaphore
    delay
    createControlledPromise
    createPromiseLock
    createSingletonPromise
    promiseParallel
    promiseParallelSettled
    retry
    sleep
    timeout
    withTimeout

    Function

    compose
    debounce
    invoke
    memoize
    noop
    once
    throttle

    Date

    isSameDay
    timestamp

    Guard

    notNullish
    notUndefined
    toError
    toFinite
    toNumber
    toString
    toTruthy

    Math

    clamp
    degToRad
    gcd
    inRange
    isPrime
    lcm
    lerp
    mapRange
    mean
    median
    radToDeg
    random
    sum

    Types

    Arrayable
    AsyncFn
    AsyncReturnType
    Awaitable
    BuiltIns
    Constructor
    DeepPartial
    DeepReadonly
    DeepRequired
    ElementOf
    Finite
    Float
    Fn
    If
    IfAny
    IfNever
    IfNotAnyOrNever
    IfNull
    IfUndefined
    IfUnknown
    Integer
    IsAny
    IsAnyOrNever
    IsEqual
    IsFloat
    IsInteger
    IsNever
    IsNotFalse
    IsNull
    IsNullable
    IsPrimitive
    IsUndefined
    IsUnion
    IsUnknown
    LiteralUnion
    LooseRequired
    Negative
    NegativeFloat
    NegativeInfinity
    NegativeInteger
    NonRecursiveType
    Not
    Nullable
    OptionalKeys
    PositiveInfinity
    Prettify
    Primitive
    RequiredKeys
    UnionToIntersection
    UnionToTuple

    URL

    combineURLs
    ensureLeadingSlash
    ensureTrailingSlash
    isHttp
    isUrl
    parseProtocol
    removeLeadingSlash
    removeTrailingSlash
    slash

    Util

    assert
    attempt
    attemptAsync

    Error

    AbortError
    RetryError
    TimeoutError

    Event

    createEmitter

    Clone

    deepClone
    shallowClone
    simpleClone

    Other

    <internal>
    ControlledPromise
    DebounceOptions
    EventEmitter
    MemoizeOptions
    RetryOptions
    SingletonPromise
    SleepOptions
    ThrottleOptions
    ArrayIteratorCallback
    ArrayIteratorPredicate
    ArrayIteratorTransform
    EventListener
    EventListenerList
    EventListenerMap
    EventType
    EventWildcardListener
    EventWildcardListenerList
    InternalIsUnion
    LastOfUnion
    MemoizedFn
    ObjectIteratorPredicate
    ObjectIteratorTransform
    Zero