@univerjs/core v0.5.0-beta.1 • Docs
Class: Tools
Universal tool library
Constructors
new Tools()
new Tools(): Tools
Returns
Methods
ABCatNum()
static ABCatNum(a): number
Column subscript letter to number
Parameters
Parameter | Type | Description |
---|---|---|
a | string | Column subscript letter,e.g.,“A1” |
Returns
number
Column subscript number,e.g.,0
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:567
arrayToObject()
static arrayToObject(array): IKeyValue
Parameters
Parameter | Type |
---|---|
array | IKeyValue [][] |
Returns
IKeyValue
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:655
camelCase()
static camelCase(str): string
Parameters
Parameter | Type |
---|---|
str | string |
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:493
capitalize()
static capitalize(str): string
Parameters
Parameter | Type |
---|---|
str | string |
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:481
chatAtABC()
static chatAtABC(n): string
en: Column subscript number to letter
zh: 列下标 数字转字母
Parameters
Parameter | Type | Description |
---|---|---|
n | number | Column subscript number,e.g.,0 |
Returns
string
Column subscript letter,e.g.,“A1”
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:594
clamp()
static clamp(
value,
min,
max): number
Parameters
Parameter | Type |
---|---|
value | number |
min | number |
max | number |
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:694
commonExtend()
static commonExtend<T>(originJson, extendJson): T
extend two objects
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
originJson | IKeyValue |
extendJson | IKeyValue |
Returns
T
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:628
commonExtend1()
static commonExtend1<T>(originJson, extendJson): T
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
originJson | IKeyValue |
extendJson | IKeyValue |
Returns
T
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:646
deepClone()
static deepClone<T>(value): T
Type Parameters
Type Parameter | Default type |
---|---|
T | unknown |
Parameters
Parameter | Type |
---|---|
value | T |
Returns
T
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:314
deepMerge()
static deepMerge(target, ...sources): any
Parameters
Parameter | Type |
---|---|
target | any |
…sources | any [] |
Returns
any
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:244
deleteBlank()
static deleteBlank(value?): undefined | string
Parameters
Parameter | Type |
---|---|
value ? | string |
Returns
undefined
| string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:143
diffValue()
static diffValue(one, two): boolean
Parameters
Parameter | Type |
---|---|
one | any |
two | any |
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:310
fCamelCase()
static fCamelCase(_all, letter): string
Parameters
Parameter | Type |
---|---|
_all | any |
letter | string |
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:486
fillTwoDimensionalArray()
static fillTwoDimensionalArray(
rows,
columns,
value): any[][]
Generate a two-dimensional array with the specified number of rows and columns, and fill in the values
Parameters
Parameter | Type | Description |
---|---|---|
rows | number | row length |
columns | number | column length |
value | any | value to be set |
Returns
any
[][]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:523
generateRandomId()
static generateRandomId(n, alphabet?): string
Use this method without Tools
.
Parameters
Parameter | Type | Default value |
---|---|---|
n | number | 21 |
alphabet ? | string | undefined |
Returns
string
Deprecated
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:236
getBrowserType()
static getBrowserType(): string
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:183
getClassName()
static getClassName(instance): string
Parameters
Parameter | Type |
---|---|
instance | object |
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:240
getLanguage()
static getLanguage(): string
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:344
getSystemType()
static getSystemType(): string
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:151
getValueType()
static getValueType(value): string
Parameters
Parameter | Type |
---|---|
value | any |
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:352
hasIntersectionBetweenTwoRanges()
static hasIntersectionBetweenTwoRanges(
range1Start,
range1End,
range2Start,
range2End): boolean
Parameters
Parameter | Type |
---|---|
range1Start | number |
range1End | number |
range2Start | number |
range2End | number |
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:666
hasLength()
static hasLength(target, length?): boolean
Parameters
Parameter | Type |
---|---|
target | string | IArguments | any [] |
length ? | number |
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:471
indexAt()
static indexAt(code): number
Parameters
Parameter | Type |
---|---|
code | string |
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:132
isAndroid()
static isAndroid(): boolean
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:442
isArray()
static isArray<T>(value?): value is T[]
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
value is T[]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:393
isBlank()
static isBlank(value): boolean
Parameters
Parameter | Type |
---|---|
value | any |
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:360
isBoolean()
static isBoolean(value?): value is boolean
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
value is boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:370
isDate()
static isDate(value?): value is Date
Parameters
Parameter | Type |
---|---|
value ? | Date |
Returns
value is Date
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:385
isDefine()
static isDefine<T>(value?): value is T
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
value ? | void | T |
Returns
value is T
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:356
isEmptyObject()
static isEmptyObject(value?): boolean
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:413
isFunction()
static isFunction(value?): value is boolean
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
value is boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:381
isIPhone()
static isIPhone(): boolean
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:447
isLegalUrl()
static isLegalUrl(url): boolean
Parameters
Parameter | Type |
---|---|
url | string |
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:451
isMobile()
static isMobile(): boolean
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:421
isNumber()
static isNumber(value?): value is number
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
value is number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:401
isObject()
static isObject<T>(value?): value is T
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
value is T
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:409
isPlainObject()
static isPlainObject(value): value is object
Parameters
Parameter | Type |
---|---|
value | any |
Returns
value is object
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:374
isRegExp()
static isRegExp(value?): value is RegExp
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
value is RegExp
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:389
isStartValidPosition()
static isStartValidPosition(name): boolean
Parameters
Parameter | Type |
---|---|
name | string |
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:675
isString()
static isString(value?): value is string
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
value is string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:397
isStringNumber()
static isStringNumber(value?): boolean
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:405
isTablet()
static isTablet(): boolean
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:433
isValidParameter()
static isValidParameter(name): boolean
Parameters
Parameter | Type |
---|---|
name | string |
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:681
isWeChat()
static isWeChat(): boolean
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:437
itCount()
static itCount(count): Function
Parameters
Parameter | Type |
---|---|
count | number |
Returns
Function
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:463
normalizeUrl()
static normalizeUrl(url): string
Parameters
Parameter | Type |
---|---|
url | string |
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:455
now()
static now(): number
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:698
numberFixed()
static numberFixed(value, digit): number
Parameters
Parameter | Type |
---|---|
value | number |
digit | number |
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:306
numToWord()
static numToWord(x): string
Generate a two-dimensional array with the specified number of rows and columns, and fill in the values
Parameters
Parameter | Type |
---|---|
x | number |
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:544
randSort()
static randSort<T>(arr): T[]
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
arr | T [] |
Returns
T
[]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:612
removeNull()
static removeNull(value): object
remove all null from object
Parameters
Parameter | Type |
---|---|
value | IKeyValue |
Returns
object
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:502
stringAt()
static stringAt(index): string
Parameters
Parameter | Type |
---|---|
index | number |
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:119
topLevelDomainCombiningString()
static topLevelDomainCombiningString(): string
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:459