🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@lsky/tools

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lsky/tools

一个工具库

Source
npmnpm
Version
1.0.5
Version published
Weekly downloads
23
228.57%
Maintainers
1
Weekly downloads
 
Created
Source

tools

一个工具库

Type

类型检查

NameTypeReturnDescription
getTypeanystring返回参数的类型
isTypeStringBoolean判断是否是指定Type
isNullanyBoolean判断是否是Null
isUndefinedanyBoolean判断是否是Undefined
isArrayanyBoolean判断是否是Array
isObjectanyBoolean判断是否是Object
isNumberanyBoolean判断是否是Number
isStringanyBoolean判断是否是String
isFuncanyBoolean判断是否是Function
isDateanyBoolean判断是否是Date
isErroranyBoolean判断是否是Error
isRegExpanyBoolean判断是否是RegExp
isMapanyBoolean判断是否是Map
isSetanyBoolean判断是否是Set
isSymbolanyBoolean判断是否是Symbol
isPromiseanyBoolean判断是否是Promise
isNananyBoolean判断是否是Nan

Value

有关值操作

NameTypeReturnDescription
isEmptyanyBoolean是否为空值
toUniqueArray | SetArray去重
checkNumStringString校验数值字符串,并且格式化
obtain(value: any, key: stringnumber, default: nullany) => any

Request

请求封装

NameTypeReturnDescription
requestObjectNull请求

Browser

浏览器

NameTypeReturnDescription
buildSchemeObjectString创建 Scheme
generateIntent(config: Object, Option: Object) => StringString创建 Intent
getBrowserNullObject判断浏览器类型

Dom

NameTypeReturnDescription
addEventListener(dom, eventType, cb, option) => {remove: () => void}{ remove: () => void }注册事件
getParent(dom, target: String | Element) => nullElement | null获取指定父元素
isBrowserFunctionBoolean判断是否是浏览器
injectScript(url: String, id: String) => ElementElement插入 Script 标签
checkTargetModuleHaveLoaded(cb: Function, condition: Function, params: {count: Number, time: Number, fail: Function}) => voidvoid循环检查

UUID

NameTypeReturnDescription
shortIDNullString生成 UUID

Debounce

NameTypeReturnDescription
debounce(func, wait, immediate) => FunctionFunction防抖

Throttle

NameTypeReturnDescription
throttle(func, wait) => FunctionFunction节流

Date

NameTypeReturnDescription
replaceTargetDateFormat(fmt: string, tar: string, value: string | number) => stringstring给定 fmt 中替换指定 value
format(fmt: string, date: Date | string | number) => stringstring根据 format 格式化时间

FAQs

Package last updated on 16 Mar 2022

Did you know?

Socket

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.

Install

Related posts