
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
@lsky/tools
Advanced tools
一个工具库
类型检查
| Name | Type | Return | Description |
|---|---|---|---|
| getType | any | string | 返回参数的类型 |
| isType | String | Boolean | 判断是否是指定Type |
| isNull | any | Boolean | 判断是否是Null |
| isUndefined | any | Boolean | 判断是否是Undefined |
| isArray | any | Boolean | 判断是否是Array |
| isObject | any | Boolean | 判断是否是Object |
| isNumber | any | Boolean | 判断是否是Number |
| isString | any | Boolean | 判断是否是String |
| isFunc | any | Boolean | 判断是否是Function |
| isDate | any | Boolean | 判断是否是Date |
| isError | any | Boolean | 判断是否是Error |
| isRegExp | any | Boolean | 判断是否是RegExp |
| isMap | any | Boolean | 判断是否是Map |
| isSet | any | Boolean | 判断是否是Set |
| isSymbol | any | Boolean | 判断是否是Symbol |
| isPromise | any | Boolean | 判断是否是Promise |
| isNan | any | Boolean | 判断是否是Nan |
有关值操作
| Name | Type | Return | Description |
|---|---|---|---|
| isEmpty | any | Boolean | 是否为空值 |
| toUnique | Array | Set | Array | 去重 |
| checkNum | String | String | 校验数值字符串,并且格式化 |
| obtain | (value: any, key: string | number, default: null | any) => any |
请求封装
| Name | Type | Return | Description |
|---|---|---|---|
| request | Object | Null | 请求 |
浏览器
| Name | Type | Return | Description |
|---|---|---|---|
| buildScheme | Object | String | 创建 Scheme |
| generateIntent | (config: Object, Option: Object) => String | String | 创建 Intent |
| getBrowser | Null | Object | 判断浏览器类型 |
| Name | Type | Return | Description |
|---|---|---|---|
| addEventListener | (dom, eventType, cb, option) => {remove: () => void} | { remove: () => void } | 注册事件 |
| getParent | (dom, target: String | Element) => null | Element | null | 获取指定父元素 |
| isBrowser | Function | Boolean | 判断是否是浏览器 |
| injectScript | (url: String, id: String) => Element | Element | 插入 Script 标签 |
| checkTargetModuleHaveLoaded | (cb: Function, condition: Function, params: {count: Number, time: Number, fail: Function}) => void | void | 循环检查 |
| Name | Type | Return | Description |
|---|---|---|---|
| shortID | Null | String | 生成 UUID |
| Name | Type | Return | Description |
|---|---|---|---|
| debounce | (func, wait, immediate) => Function | Function | 防抖 |
| Name | Type | Return | Description |
|---|---|---|---|
| throttle | (func, wait) => Function | Function | 节流 |
| Name | Type | Return | Description |
|---|---|---|---|
| replaceTargetDateFormat | (fmt: string, tar: string, value: string | number) => string | string | 给定 fmt 中替换指定 value |
| format | (fmt: string, date: Date | string | number) => string | string | 根据 format 格式化时间 |
FAQs
We found that @lsky/tools demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.