Class: Tools
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:118
Universal tool library
Constructors
new Tools()
new Tools(): Tools
Returns
Methods
ABCatNum()
static ABCatNum(a): number
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:568
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
arrayToObject()
static arrayToObject(array): IKeyValue
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:656
Parameters
Parameter | Type |
---|---|
array | IKeyValue [][] |
Returns
IKeyValue
camelCase()
static camelCase(str): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:494
Parameters
Parameter | Type |
---|---|
str | string |
Returns
string
capitalize()
static capitalize(str): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:482
Parameters
Parameter | Type |
---|---|
str | string |
Returns
string
chatAtABC()
static chatAtABC(n): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:595
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”
clamp()
static clamp(
value,
min,
max): number
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:695
Parameters
Parameter | Type |
---|---|
value | number |
min | number |
max | number |
Returns
number
commonExtend()
static commonExtend<T>(originJson, extendJson): T
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:629
extend two objects
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
originJson | IKeyValue |
extendJson | IKeyValue |
Returns
T
commonExtend1()
static commonExtend1<T>(originJson, extendJson): T
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:647
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
originJson | IKeyValue |
extendJson | IKeyValue |
Returns
T
deepClone()
static deepClone<T>(value): T
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:315
Type Parameters
Type Parameter | Default type |
---|---|
T | unknown |
Parameters
Parameter | Type |
---|---|
value | T |
Returns
T
deepMerge()
static deepMerge(target, ...sources): any
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:245
Parameters
Parameter | Type |
---|---|
target | any |
…sources | any [] |
Returns
any
Deprecated
This method is deprecated, please use import { merge } from '@univerjs/core
instead
deleteBlank()
static deleteBlank(value?): undefined | string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:143
Parameters
Parameter | Type |
---|---|
value ? | string |
Returns
undefined
| string
diffValue()
static diffValue(one, two): boolean
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:311
Parameters
Parameter | Type |
---|---|
one | any |
two | any |
Returns
boolean
fCamelCase()
static fCamelCase(_all, letter): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:487
Parameters
Parameter | Type |
---|---|
_all | any |
letter | string |
Returns
string
fillTwoDimensionalArray()
static fillTwoDimensionalArray(
rows,
columns,
value): any[][]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:524
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
[][]
generateRandomId()
static generateRandomId(n, alphabet?): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:236
Use this method without Tools
.
Parameters
Parameter | Type | Default value |
---|---|---|
n | number | 21 |
alphabet ? | string | undefined |
Returns
string
Deprecated
getBrowserType()
static getBrowserType(): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:183
Returns
string
getClassName()
static getClassName(instance): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:240
Parameters
Parameter | Type |
---|---|
instance | object |
Returns
string
getLanguage()
static getLanguage(): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:345
Returns
string
getSystemType()
static getSystemType(): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:151
Returns
string
getValueType()
static getValueType(value): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:353
Parameters
Parameter | Type |
---|---|
value | any |
Returns
string
hasIntersectionBetweenTwoRanges()
static hasIntersectionBetweenTwoRanges(
range1Start,
range1End,
range2Start,
range2End): boolean
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:667
Parameters
Parameter | Type |
---|---|
range1Start | number |
range1End | number |
range2Start | number |
range2End | number |
Returns
boolean
hasLength()
static hasLength(target, length?): boolean
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:472
Parameters
Parameter | Type |
---|---|
target | string | IArguments | any [] |
length ? | number |
Returns
boolean
indexAt()
static indexAt(code): number
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:132
Parameters
Parameter | Type |
---|---|
code | string |
Returns
number
isAndroid()
static isAndroid(): boolean
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:443
Returns
boolean
isArray()
static isArray<T>(value?): value is T[]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:394
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
value is T[]
isBlank()
static isBlank(value): boolean
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:361
Parameters
Parameter | Type |
---|---|
value | any |
Returns
boolean
isBoolean()
static isBoolean(value?): value is boolean
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:371
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
value is boolean
isDate()
static isDate(value?): value is Date
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:386
Parameters
Parameter | Type |
---|---|
value ? | Date |
Returns
value is Date
isDefine()
static isDefine<T>(value?): value is T
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:357
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
value ? | void | T |
Returns
value is T
isEmptyObject()
static isEmptyObject(value?): boolean
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:414
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
boolean
isFunction()
static isFunction(value?): value is boolean
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:382
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
value is boolean
isIPhone()
static isIPhone(): boolean
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:448
Returns
boolean
isLegalUrl()
static isLegalUrl(url): boolean
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:452
Parameters
Parameter | Type |
---|---|
url | string |
Returns
boolean
isMobile()
static isMobile(): boolean
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:422
Returns
boolean
isNumber()
static isNumber(value?): value is number
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:402
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
value is number
isObject()
static isObject<T>(value?): value is T
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:410
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
value is T
isPlainObject()
static isPlainObject(value): value is object
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:375
Parameters
Parameter | Type |
---|---|
value | any |
Returns
value is object
isRegExp()
static isRegExp(value?): value is RegExp
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:390
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
value is RegExp
isStartValidPosition()
static isStartValidPosition(name): boolean
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:676
Parameters
Parameter | Type |
---|---|
name | string |
Returns
boolean
isString()
static isString(value?): value is string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:398
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
value is string
isStringNumber()
static isStringNumber(value?): boolean
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:406
Parameters
Parameter | Type |
---|---|
value ? | any |
Returns
boolean
isTablet()
static isTablet(): boolean
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:434
Returns
boolean
isValidParameter()
static isValidParameter(name): boolean
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:682
Parameters
Parameter | Type |
---|---|
name | string |
Returns
boolean
isWeChat()
static isWeChat(): boolean
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:438
Returns
boolean
itCount()
static itCount(count): Function
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:464
Parameters
Parameter | Type |
---|---|
count | number |
Returns
Function
normalizeUrl()
static normalizeUrl(url): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:456
Parameters
Parameter | Type |
---|---|
url | string |
Returns
string
now()
static now(): number
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:699
Returns
number
numberFixed()
static numberFixed(value, digit): number
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:307
Parameters
Parameter | Type |
---|---|
value | number |
digit | number |
Returns
number
numToWord()
static numToWord(x): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:545
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
randSort()
static randSort<T>(arr): T[]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:613
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
arr | T [] |
Returns
T
[]
removeNull()
static removeNull(value): object
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:503
remove all null from object
Parameters
Parameter | Type |
---|---|
value | IKeyValue |
Returns
object
stringAt()
static stringAt(index): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:119
Parameters
Parameter | Type |
---|---|
index | number |
Returns
string
topLevelDomainCombiningString()
static topLevelDomainCombiningString(): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:460
Returns
string