@univerjscoreclassesTools

@univerjs/core v0.5.4


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

Tools

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

ParameterTypeDescription
astringColumn 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

ParameterType
arrayIKeyValue[][]

Returns

IKeyValue


camelCase()

static camelCase(str): string

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:494

Parameters

ParameterType
strstring

Returns

string


capitalize()

static capitalize(str): string

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:482

Parameters

ParameterType
strstring

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

ParameterTypeDescription
nnumberColumn 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

ParameterType
valuenumber
minnumber
maxnumber

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

ParameterType
originJsonIKeyValue
extendJsonIKeyValue

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

ParameterType
originJsonIKeyValue
extendJsonIKeyValue

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 ParameterDefault type
Tunknown

Parameters

ParameterType
valueT

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

ParameterType
targetany
sourcesany[]

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

ParameterType
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

ParameterType
oneany
twoany

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

ParameterType
_allany
letterstring

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

ParameterTypeDescription
rowsnumberrow length
columnsnumbercolumn length
valueanyvalue 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

ParameterTypeDefault value
nnumber21
alphabet?stringundefined

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

ParameterType
instanceobject

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

ParameterType
valueany

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

ParameterType
range1Startnumber
range1Endnumber
range2Startnumber
range2Endnumber

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

ParameterType
targetstring | 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

ParameterType
codestring

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

ParameterType
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

ParameterType
valueany

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

ParameterType
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

ParameterType
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

ParameterType
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

ParameterType
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

ParameterType
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

ParameterType
urlstring

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

ParameterType
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

ParameterType
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

ParameterType
valueany

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

ParameterType
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

ParameterType
namestring

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

ParameterType
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

ParameterType
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

ParameterType
namestring

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

ParameterType
countnumber

Returns

Function


normalizeUrl()

static normalizeUrl(url): string

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:456

Parameters

ParameterType
urlstring

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

ParameterType
valuenumber
digitnumber

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

ParameterType
xnumber

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

ParameterType
arrT[]

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

ParameterType
valueIKeyValue

Returns

object


stringAt()

static stringAt(index): string

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:119

Parameters

ParameterType
indexnumber

Returns

string


topLevelDomainCombiningString()

static topLevelDomainCombiningString(): string

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:460

Returns

string