GitHub
Preparing search index...
The search index is not available
ts-utils - v5.0.1-beta.1
Settings
Member Visibility
Protected
Private
Inherited
External
Theme
OS
Light
Dark
Modules
mxssfd/core -
v5.0.1-
beta.1
str
Repeat
number2
Chinese
chinese2
Number
format
Date
mxssfd/dom -
v5.0.1-
beta.1
mxssfd/bom -
v5.0.1-
beta.1
copy2
Clipboard
mxssfd/types -
v5.0.1-
beta.1
mxssfd/random-
picker -
v5.0.1-
beta.1
@mxssfd/random-picker
Direct
One
By
One
Url
Model
解析url
Event
Bus
Pool
RGB
RGBA
List
Cache
Set
Cache
Responsibility
Chain
责任链
Number2
Chinese
Chinese2
Number
format
Date
Interface
Point
root
host
Reg
Url
Reg
Exp
Stack
is
Native
type
Of
is
Object
is
Object
Like
is
Array
is
Array
Like
is
String
is
Number
is
Function
is
Boolean
is
Undefined
in
Types
用typeIn("123", ["string", "number"]) 代替 typeOf("123") === "string" || typeOf("123") === "number"
is
Promise
Like
is
NaN
is
Empty
Object
is
Empty
is
Equal
object
Is
Equal
is
Same
Type
is
Iterable
is
Percent
is
Include
Chinese
是否包含中文
is
Integer
是否正数
is
Array
Obj
is
Broadly
Obj
thousand
Format
Number.prototype.toLocaleString 也能转成千位分隔数字字符串
str
Template
str
Pad
Start
给长度不满足要求的字符串添加前缀 strFillPrefix
str
Pad
End
给长度不满足要求的字符串添加后缀 strFillPrefix
remove
Str
By
Num
从字符串中删除指定字符串(from)中重复的第n(num)个字符串(str)
sub
String
切割字符串
str
Repeat
与String.prototype.repeat相同
smart
Repeat
根据模板创建出字符串 除了面试题找不到应用场景的函数
capitalize
首字母大写
from
Camel
从驼峰转其他命名格式
to
Camel
其他转驼峰
get
String
Len
获取字符串实际长度,String.prototype.length获取的是utf-16的长度
number2
Chinese
阿拉伯数字转为中文数字
chinese2
Number
中文转为阿拉伯数字
strip
把错误的数据转正 from number-precision
get
Number
Len
After
Dot
get
Common
Pow
calc
Arr
to
Non
Exponential
科学计数法转普通小数
plus
minus
times
divide
get
Safe
Num
安全数字
get
Tree
Max
Deep
get
Tree
Node
Len
deep
Merge
for
Each
Obj
代替Object.keys(obj).forEach,减少循环次数
get
Reverse
Obj
object key-value翻转
reduce
Obj
代替Object.keys(obj).reduce,减少循环次数
pick
By
Keys
pick
Rename
pick
功能与pickByKeys函数一致
pick
Diff
从其他对象中挑出与原对象值不一样的或原对象中不存在的键值对所组成的新对象
pick
Additional
从其他对象中挑出与原对象中不存在的键值对所组成的新对象
rename
Obj
Key
根据新键值对重命名对象的key,并生成一个新的对象
omit
Omit 省略
assign
defaults
与lodash defaults一样 只替换target里面的值为undefined的属性
obj
Update
使用target里面的key去查找其他的对象,如果其他对象里有该key,则把该值赋给target,如果多个对象都有同一个值,则以最后的为准
get
Ins
Keys
获取class实例的key数组
update
Ins
更新实例对象属性
pick
Updated
根据与target对比,挑出与target同key不同value的key所组成的object
create
Obj
创建一个object 代替es6的动态key object 与Object.fromEntries一样
obj
Keys
Object.keys
obj
Values
Object.values
obj
Entries
Object.entries
translate
Obj
Path
obj[a] => obj.a 从getObjValueByPath中分离出来
get
Obj
Value
By
Path
通过object路径获取值
set
Obj
Value
By
Path
通过object路径设置值 如果路径中不存在则会自动创建对应的对象
get
Obj
Path
Entries
获取object的路径数组
revert
Obj
From
Path
obj
Filter
has
Own
判断对象是否包含某个属性。
obj
For
Each
obj
Reduce
update
Obj
Obj
From
Entries
create
Array
for
Each
for
Each
Async
跟promiseQueue类似,不过此函数是callback异步,重点在callback
map
Async
reduce
Async
reduce promise 跟 promiseQueue差不多,此函数多了callbackFn
for
Each
Right
from
filter
includes
find
find
Index
find
Index
Right
flat
binary
Find2
二分查找item
binary
Find
binary
Find
Index
二分查找item index
insert
To
Array
item插入到数组,在原数组中改变
array
Remove
Item
array
Remove
Items
By
unique
cast
Array
chunk
数组分片
in
Range
判断min <= num <= max
in
Ranges
group
By
数组分组
some
In
List
查找是否items中任何一个在list中
debounce
防抖函数
debounce
Async
如果callback执行了的话,那么不论是否resolved都不会再被reject
throttle
节流函数
debounce
Cancelable
可取消防抖函数
debounce
By
Promise
前一个promise未完成即reject,最后一个或者中断前调用的才会执行
polling
轮询函数
for
Each
By
Len
for
Each
By
Len
Right
one
By
One
每隔一段事件返回字符串中的一个单词
generate
Function
Code
function
Apply
createUUID
生成不重复的字符串
formatJSON
格式化json
create
Enum
create
Enum
By
Obj
promise
Any
Promise.prototype.any list中任意一个promise resolve都会resolve,如果全是reject,那么reject
sync
Promise
All
串行版promise.all,执行完一个才会去执行下一个
promise
Queue
promise队列 任何一个reject都会中断队列 (跟reduceAsync类似)
num
To
Fixed
原来的函数四舍五入不准确
at
从arr获取index处的item,支持负数
like
Keys
查找对象中与param key类似的key
parse
Cmd
Params
命令行的参数转为Map
id
Gen
创建一个自增id生成器
lazy
swap
number2
Date
date
Diff
比较两个日期相差年天时分秒 用于倒计时等
get
Date
From
Str
字符串转为date对象 因为苹果手机无法直接new Date("2018-08-01 10:20:10")获取date
sleep
create
Time
Count
Up
create
Time
Count
Down
创建一个倒计时函数
get
The
Last
Date
OfAMonth
获取某月最后一天的date
get
Month
The
Nth
Weekday
获取指定某年月份(month)第n(nth)个星期几(weekday)的Date
get
Milliseconds
获取毫秒数
is
Same
Time
判断时间是否相同
in
Same
Week
判断两个日期是否在同一个星期内
year
Diff
计算两个日期间相差的年数 a - b
calc
Relative
Date
比如根据服务器与本地时间的差值计算实际日期
format
Date
格式化日期
str2
Date
字符串转为date对象 因为苹果手机无法直接new Date("2018-08-01 10:20:10")获取date
get
Url
Protocol
get
Url
Host
get
Url
Port
get
Url
Path
get
Url
Hash
get
Url
Hash
Param
获取hash中的param
get
Url
Param
Obj
stringify
Url
Search
get
Url
Param
来源于网页调起qq 只获取url参数的话可以使用这个
update
Url
Param
修改url参数,不能新增或删除参数
set
Url
Param
设置url参数,可新增或删除参数
is
Url
get
Url
Query
isRGBColor
isHEXColor
rgb
To
Hex
hsl
To
Rgb
random
Float
random
Int
random
Item
随机获取数组中的一个
random
Items
Gen
创建一个数组随机item的生成器,直到遍历完为止
shuffle
洗牌
randomRGB
randomRGBA
randomHEX
random
Color
随机颜色
clone
Function
deep
Clone
deep
Clone
Bfs
is
Point
In
Path
get
Distance
根据三角函数求两点的距离
get
Angle
根据目标点获取相对于原点的角度
get
Rotate
Point
根据半径与角度获取点
two
Bezier
fixme 无法单元测试
get
Border
Width
By
Cos
根据余弦定理(c^2 = a^2 + b^2 - 2 * a * b * cosA)获取任意边长
get
Border
Width
By
Sin
根据正弦定理(a/sinA = b/sinB = c/sinC)获取对应边长
decoratorfy
Debounce
防抖装饰器
Throttle
节流装饰器
Polling
比setInterval好的地方在于使用promise判断一回执行完毕情况
ts-utils - v5.0.1-beta.1
mxssfd/core
Module mxssfd/core - v5.0.1-beta.1
Index
Namespaces
str
Repeat
number2
Chinese
chinese2
Number
format
Date
Enumerations
Direct
Classes
One
By
One
Url
Model
Event
Bus
Pool
RGB
RGBA
List
Cache
Set
Cache
Responsibility
Chain
Interfaces
Number2
Chinese
Chinese2
Number
format
Date
Interface
Type Aliases
Point
Variables
root
host
Reg
Url
Reg
Exp
Stack
Functions
is
Native
type
Of
is
Object
is
Object
Like
is
Array
is
Array
Like
is
String
is
Number
is
Function
is
Boolean
is
Undefined
in
Types
is
Promise
Like
is
NaN
is
Empty
Object
is
Empty
is
Equal
object
Is
Equal
is
Same
Type
is
Iterable
is
Percent
is
Include
Chinese
is
Integer
is
Array
Obj
is
Broadly
Obj
thousand
Format
str
Template
str
Pad
Start
str
Pad
End
remove
Str
By
Num
sub
String
str
Repeat
smart
Repeat
capitalize
from
Camel
to
Camel
get
String
Len
number2
Chinese
chinese2
Number
strip
get
Number
Len
After
Dot
get
Common
Pow
calc
Arr
to
Non
Exponential
plus
minus
times
divide
get
Safe
Num
get
Tree
Max
Deep
get
Tree
Node
Len
deep
Merge
for
Each
Obj
get
Reverse
Obj
reduce
Obj
pick
By
Keys
pick
Rename
pick
pick
Diff
pick
Additional
rename
Obj
Key
omit
assign
defaults
obj
Update
get
Ins
Keys
update
Ins
pick
Updated
create
Obj
obj
Keys
obj
Values
obj
Entries
translate
Obj
Path
get
Obj
Value
By
Path
set
Obj
Value
By
Path
get
Obj
Path
Entries
revert
Obj
From
Path
obj
Filter
has
Own
obj
For
Each
obj
Reduce
update
Obj
Obj
From
Entries
create
Array
for
Each
for
Each
Async
map
Async
reduce
Async
for
Each
Right
from
filter
includes
find
find
Index
find
Index
Right
flat
binary
Find2
binary
Find
binary
Find
Index
insert
To
Array
array
Remove
Item
array
Remove
Items
By
unique
cast
Array
chunk
in
Range
in
Ranges
group
By
some
In
List
debounce
debounce
Async
throttle
debounce
Cancelable
debounce
By
Promise
polling
for
Each
By
Len
for
Each
By
Len
Right
one
By
One
generate
Function
Code
function
Apply
createUUID
formatJSON
create
Enum
create
Enum
By
Obj
promise
Any
sync
Promise
All
promise
Queue
num
To
Fixed
at
like
Keys
parse
Cmd
Params
id
Gen
lazy
swap
number2
Date
date
Diff
get
Date
From
Str
sleep
create
Time
Count
Up
create
Time
Count
Down
get
The
Last
Date
OfAMonth
get
Month
The
Nth
Weekday
get
Milliseconds
is
Same
Time
in
Same
Week
year
Diff
calc
Relative
Date
format
Date
str2
Date
get
Url
Protocol
get
Url
Host
get
Url
Port
get
Url
Path
get
Url
Hash
get
Url
Hash
Param
get
Url
Param
Obj
stringify
Url
Search
get
Url
Param
update
Url
Param
set
Url
Param
is
Url
get
Url
Query
isRGBColor
isHEXColor
rgb
To
Hex
hsl
To
Rgb
random
Float
random
Int
random
Item
random
Items
Gen
shuffle
randomRGB
randomRGBA
randomHEX
random
Color
clone
Function
deep
Clone
deep
Clone
Bfs
is
Point
In
Path
get
Distance
get
Angle
get
Rotate
Point
two
Bezier
get
Border
Width
By
Cos
get
Border
Width
By
Sin
decoratorfy
Debounce
Throttle
Polling