DEV Community

Cover image for 一个 NPM 包,帮助数十万程序员提高数十倍效率,难道不开源出来?
toolkituse
toolkituse

Posted on

一个 NPM 包,帮助数十万程序员提高数十倍效率,难道不开源出来?

一个 NPM 包,帮助数十万程序员提高数十倍效率,难道不开源出来?(一)

首先贴下我们的官网

【预览页】

https://kennana.github.io/toolkit-use/

我们的推特

【toolkituse】

https://twitter.com/Toolkituse

我们的github

【toolkit-use】

https://github.com/KenNaNa/toolkit-use

数据类型是否为基础类型

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.isPrimitive(v)
Enter fullscreen mode Exit fullscreen mode

是否为引用类型或通过由new构造的类型

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.isObject(obj)
Enter fullscreen mode Exit fullscreen mode

是否为 Promise 函数

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.isPromise(val)
Enter fullscreen mode Exit fullscreen mode

转换为数字

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.toNumber(val)
Enter fullscreen mode Exit fullscreen mode

The object to inspect

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.isPlainObject(obj)
Enter fullscreen mode Exit fullscreen mode

转换为字符串

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.toString(val)
Enter fullscreen mode Exit fullscreen mode

将类数组对象转换为数组

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.toArray(list, start)
Enter fullscreen mode Exit fullscreen mode

将属性赋予目标对象

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.extend(to, _from)
Enter fullscreen mode Exit fullscreen mode

将对象数组合并到对象中

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.toObject(arr)
Enter fullscreen mode Exit fullscreen mode

驼峰式变短横线分隔

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.capitalize(str)
Enter fullscreen mode Exit fullscreen mode

驼峰式变短横线分隔

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.hyphenate(str)
Enter fullscreen mode Exit fullscreen mode

短横线分隔变驼峰式

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.camelize(str)
Enter fullscreen mode Exit fullscreen mode

删除数组项

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.remove(arr, item)
Enter fullscreen mode Exit fullscreen mode

函数只执行一次

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.once(fn)
Enter fullscreen mode Exit fullscreen mode

检测数组

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.isArray(obj)
Enter fullscreen mode Exit fullscreen mode

检测 map

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.isMap(val)
Enter fullscreen mode Exit fullscreen mode

检测 set

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.isSet(val)
Enter fullscreen mode Exit fullscreen mode

检测日期

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.isDate(val)
Enter fullscreen mode Exit fullscreen mode

检测函数

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.isFunction(val)
Enter fullscreen mode Exit fullscreen mode

检测字符串

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.isString(val)
Enter fullscreen mode Exit fullscreen mode

检测 symbol

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.isSymbol(val)
Enter fullscreen mode Exit fullscreen mode

判断是否为整数键值

import { ToolkitUseShared } from 'toolkit-use/dist/shared/index.esm'
ToolkitUseShared.isIntegerKey(val)
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
blueberry077 profile image
Marc-Daniel DALEBA

super duper great post 👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌