Helpers/array
asArray
asArray<T
>(a
): T
[]
Always return Array
Jodit.modules.Helpers.asArray('test') // ['test']
Jodit.modules.Helpers.asArray(['test']) // ['test']
Jodit.modules.Helpers.asArray(1) // [1]
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
a |
T | T [] |
Returns
T
[]
Defined in
src/core/helpers/array/as-array.ts#21
splitArray
splitArray(a
): string
[]
Return an array from string or array
Jodit.modules.Helpers.splitArray('1,2,3') // ['1', '2', '3']
Jodit.modules.Helpers.splitArray(['1', '2', '3']) // ['1', '2', '3']
Parameters
Name | Type |
---|---|
a |
string |
Returns
string
[]
Defined in
src/core/helpers/array/split-array.ts#11
splitArray<T
>(a
): T
Return an array from string or array
Jodit.modules.Helpers.splitArray('1,2,3') // ['1', '2', '3']
Jodit.modules.Helpers.splitArray(['1', '2', '3']) // ['1', '2', '3']
Type parameters
Name | Type |
---|---|
T |
extends any [] |
Parameters
Name | Type |
---|---|
a |
T |
Returns
T
Defined in
src/core/helpers/array/split-array.ts#13
splitArray<T
>(a
): T
| string
[]
Return an array from string or array
Jodit.modules.Helpers.splitArray('1,2,3') // ['1', '2', '3']
Jodit.modules.Helpers.splitArray(['1', '2', '3']) // ['1', '2', '3']
Type parameters
Name | Type |
---|---|
T |
extends any [] |
Parameters
Name | Type |
---|---|
a |
string | T |
Returns
T
| string
[]
Defined in
src/core/helpers/array/split-array.ts#15
toArray
toArray<T
>(arrayLike
): T
[]
Always return Array. It's a safe polyfill for Array.from method
In certain scenarios (such as with Joomla Mootools), Array.from may be substituted with a less optimal implementation
Jodit.modules.Helpers.toArray('123') // ['1', '2', '3']
Jodit.modules.Helpers.toArray(['test']) // ['test']
Jodit.modules.Helpers.toArray(1) // []
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
arrayLike |
ArrayLike <T > |
Returns
T
[]
Defined in
jodit/src/core/helpers/array/to-array.ts:23
toArray<T
, U
>(arrayLike
, mapfn
, thisArg?
): U
[]
Always return Array. It's a safe polyfill for Array.from method
In certain scenarios (such as with Joomla Mootools), Array.from may be substituted with a less optimal implementation
Jodit.modules.Helpers.toArray('123') // ['1', '2', '3']
Jodit.modules.Helpers.toArray(['test']) // ['test']
Jodit.modules.Helpers.toArray(1) // []
Type parameters
Name |
---|
T |
U |
Parameters
Name | Type |
---|---|
arrayLike |
ArrayLike <T > |
mapfn |
(v : T , k : number ) => U |
thisArg? |
any |
Returns
U
[]
Defined in
jodit/src/core/helpers/array/to-array.ts:23
toArray<T
>(iterable
): T
[]
Always return Array. It's a safe polyfill for Array.from method
In certain scenarios (such as with Joomla Mootools), Array.from may be substituted with a less optimal implementation
Jodit.modules.Helpers.toArray('123') // ['1', '2', '3']
Jodit.modules.Helpers.toArray(['test']) // ['test']
Jodit.modules.Helpers.toArray(1) // []
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
iterable |
Iterable <T , any , any > | ArrayLike <T > |
Returns
T
[]
Defined in
jodit/src/core/helpers/array/to-array.ts:23
toArray<T
, U
>(iterable
, mapfn
, thisArg?
): U
[]
Always return Array. It's a safe polyfill for Array.from method
In certain scenarios (such as with Joomla Mootools), Array.from may be substituted with a less optimal implementation
Jodit.modules.Helpers.toArray('123') // ['1', '2', '3']
Jodit.modules.Helpers.toArray(['test']) // ['test']
Jodit.modules.Helpers.toArray(1) // []
Type parameters
Name |
---|
T |
U |
Parameters
Name | Type |
---|---|
iterable |
Iterable <T , any , any > | ArrayLike <T > |
mapfn |
(v : T , k : number ) => U |
thisArg? |
any |
Returns
U
[]
Defined in
jodit/src/core/helpers/array/to-array.ts:23