1 |
|
2 |
|
3 | # Function splitUnit
|
4 |
|
5 | Split a unit in an array of units whose sum is equal to the original unit.
|
6 |
|
7 |
|
8 | ## Syntax
|
9 |
|
10 | ```js
|
11 | splitUnit(unit: Unit, parts: Array.<Unit>)
|
12 | ```
|
13 |
|
14 | ### Parameters
|
15 |
|
16 | Parameter | Type | Description
|
17 | --------- | ---- | -----------
|
18 | `parts` | Array | An array of strings or valueless units.
|
19 |
|
20 | ### Returns
|
21 |
|
22 | Type | Description
|
23 | ---- | -----------
|
24 | Array | An array of units.
|
25 |
|
26 |
|
27 | ## Examples
|
28 |
|
29 | ```js
|
30 | math.splitUnit(new Unit(1, 'm'), ['feet', 'inch'])
|
31 | // [ 3 feet, 3.3700787401575 inch ]
|
32 | ```
|
33 |
|
34 |
|
35 | ## See also
|
36 |
|
37 | [unit](unit.md)
|