# 子类包
# 浏览器类 - browser
@goodluck/util-browser 浏览器类理论上只能用于浏览器网页中,是针对浏览器网页环境运行的方法,因会涉及浏览器特有API、DOM、CSS等操作,在Node、小程序等环境中调用可能会发生错误或异常。
base
- browserVersion
- browserBottomVisible
- browserElementIsVisibleInViewport
- browserElementIsVisibleInScope
- browserScrollMove
- browserElementComputedStyle
- clipboardWrite
- browserFullScreen
- browserLoadFileAsync
- browserConsolePrintf
- browserQueryString
- EventListener
media
storage
# 常用类 - common
@goodluck/util-common 常用类是对数据类型的常用操作,包含数组、日期时间、数字、函数、对象、正则表达式、字符串以及色值等格式类型的操作。
base
- promisify
- sleep
- constructorName
- bytesFormat
- numeralsArabicToRoman
- numeralsArabicToChinese
- Pagination
- debounce
- throttle
array
- arrayDifference
- arrayIntersection
- arrayUnion
- arrayPowerset
- arrayWithout
- arrayUnique
- arrayEquals
- arraySample
- arrayZip
- arrayChunk
- arrayCompact
- arrayCountOccurrences
- arrayFill
- arraySupplement
- arrayFilterNonUnique
- arrayLast
- arrayInitial
- arrayTail
- arrayInitRange
- arrayInit
- arrayShuffle
- arrayTake
- arrayTakeRight
- arrayDeepClone
- ArrayIteratorLoop
color
date-time
- dateParse
- dateDeepClone
- dateFormat
- timestampToCountdown
- dateDiffBetween
- daysDiffBetweenDates
- dateRange
- timestampBeautify
math
- mathFactorial
- mathPercentile
- mathClosest
- mathAverage
- mathMedian
- mathSum
- mathRound
- mathStandardDeviation
- mathDigitize
- mathRandomInRange
- mathRandomIntegerInRange
- mathCeil
- mathPrefixZero
object
string
- stringAnagrams
- stringCapitalizeEveryWord
- stringCapitalize
- stringPalindrome
- stringReverse
- stringSortInCharacters
- stringTruncate
- stringByteSize
- stringPhoneNumberHide
- stringReplace
- stringTrimAll
- stringSnakeToCamel
- stringCamelToSnake
- stringLength
- stringThousands
- stringMid
- stringIncludes
# 加解密类 - crypto
@goodluck/util-crypto 加解密类封装了各种加解密算法、常用编解码,以及进制转换相关的方法。
base
code
md5
# 修饰器类 - decorator
修饰器是为了简化代码编写并且提高代码可读性的一种方式,本质上修饰器是一个函数,可以用来修改类或方法的行为,修饰器是
ECMAScript 2016 (ES7)的一个提案,目前在使用TypeScript编写的项目中比较常用。
@goodluck/util-decorator 修饰器类封装了常用的修饰函数,修饰器类中的部分函数功能或许会与常用类中的相同,但是使用场景是不同的。
bind
# 校验类 - validation
@goodluck/util-validation 校验类可用于数据类型、编码类型或各种数字、文字规则的校验。
account
- validChinaPhoneNumber
- validChinaTelephoneNumber
- validPassword
- validPasswordPayment
- validCaptchaSMS
- validMail
- validURL
- validTencentQQ
- validIdNumberChina
- validBankNumberLuhn
- validChinaBusinessLicenseCode
code
currency
math
name
# 网络类 - network
@goodluck/util-network 网络类是封装了发起接口请求,处理返回数据的请求器,能够支持浏览器、小程序、跨平台桌面应用等环境,目前还在开发中。