2.8.0 • Published 2 years ago

@depeng9527/tools v2.8.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@depeng9527/tools

npm version

Opinionated collection of common JavaScript / TypeScript utils by Depeng0929.

Is

包括常用的数据类型判断。

import {
  isRegExp,
  isFunction,
  isString,
  isNumber,
  isObject,
  isDate,
  isSymbol,
  isSet,
  isMap,
  isNull,
  isUndefined,
} from '@depng9527/tools'
  • isNil: 是否是undefinednull
  • notNil: 与isNill相反
  • isBrowser:是否在游览器中

String

  • ensurePrefix

  • ensureSuffix

  • randomStr

  • pascalCase,camelCase,kebabCase, capitalize

Math

常用的数学运算

import {
  add, divide, subtract, multiply 
} from '@depng9527/tools'
  • sum: 求数组的和
  • clamp: clamp(n, min, max)返回n到min,max之间最近的点

Array

  • range

  • uniq

  • at

  • last

  • head

  • remove

  • removeElement

  • move

  • toArray

Object

  • deepClone

  • deepMerge

  • objectMap

  • renameKeys

// { b: 2 }
objectMap({ a: 1, b: 2 }, (k, v) => k === 'a' ? undefined : [k, v])

Function

  • tap: 通常执行一些副作用
  function createUser(name: string): User {
    return tap(new User, user => {
      user.name = name
    })
  }
  • assert: 断言

  • debug: debug

Vendor

  • throttle

  • debounce

  • findValueByKey

  • isEmpty

  • select: like sql

  • pick: like sql

time

  • formateTime

  • timeStamp

pLimit

  • p
2.8.0

2 years ago

2.7.4

2 years ago

2.7.3

2 years ago

2.7.6

2 years ago

2.7.5

2 years ago

2.7.2

2 years ago

2.7.1

2 years ago

2.7.0

2 years ago

2.6.3

2 years ago

2.6.2

2 years ago

2.6.1

2 years ago

2.6.0

2 years ago

2.5.2

3 years ago

2.5.1

3 years ago

2.5.0

3 years ago

2.3.0

3 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.3.1

3 years ago

2.4.2

3 years ago

2.2.8

3 years ago

2.2.5

3 years ago

2.2.7

3 years ago

2.2.6

3 years ago

2.2.4

3 years ago

2.2.0

3 years ago

2.2.3

3 years ago

2.0.15

3 years ago

2.1.1

3 years ago

2.0.16

3 years ago

2.1.6

3 years ago

2.1.5

3 years ago

2.0.12

3 years ago

2.1.7

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

2.0.19

3 years ago

2.0.17

3 years ago

2.0.18

3 years ago

1.1.1

4 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago

0.3.3

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.2

4 years ago