@univerjscoreclassesTools

@univerjs/core v0.5.0-beta.1Docs


Class: Tools

Universal tool library

Constructors

new Tools()

new Tools(): Tools

Returns

Tools

Methods

ABCatNum()

static ABCatNum(a): number

Column subscript letter to number

Parameters

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

ParameterType
arrayIKeyValue[][]

Returns

IKeyValue

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:655


camelCase()

static camelCase(str): string

Parameters

ParameterType
strstring

Returns

string

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:493


capitalize()

static capitalize(str): string

Parameters

ParameterType
strstring

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

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

ParameterType
valuenumber
minnumber
maxnumber

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

ParameterType
originJsonIKeyValue
extendJsonIKeyValue

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

ParameterType
originJsonIKeyValue
extendJsonIKeyValue

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

Parameters

ParameterType
valueT

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

ParameterType
targetany
sourcesany[]

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

ParameterType
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

ParameterType
oneany
twoany

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

ParameterType
_allany
letterstring

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

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

ParameterTypeDefault value
nnumber21
alphabet?stringundefined

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

ParameterType
instanceobject

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

ParameterType
valueany

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

ParameterType
range1Startnumber
range1Endnumber
range2Startnumber
range2Endnumber

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

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

ParameterType
codestring

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

ParameterType
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

ParameterType
valueany

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

ParameterType
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

ParameterType
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

ParameterType
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

ParameterType
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

ParameterType
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

ParameterType
urlstring

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

ParameterType
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

ParameterType
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

ParameterType
valueany

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

ParameterType
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

ParameterType
namestring

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

ParameterType
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

ParameterType
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

ParameterType
namestring

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

ParameterType
countnumber

Returns

Function

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:463


normalizeUrl()

static normalizeUrl(url): string

Parameters

ParameterType
urlstring

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

ParameterType
valuenumber
digitnumber

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

ParameterType
xnumber

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

ParameterType
arrT[]

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

ParameterType
valueIKeyValue

Returns

object

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/tools.ts:502


stringAt()

static stringAt(index): string

Parameters

ParameterType
indexnumber

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