UNPKG

962 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.createSplitUnit = void 0;
7
8var _factory = require("../../../utils/factory");
9
10var name = 'splitUnit';
11var dependencies = ['typed'];
12var createSplitUnit = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
13 var typed = _ref.typed;
14
15 /**
16 * Split a unit in an array of units whose sum is equal to the original unit.
17 *
18 * Syntax:
19 *
20 * splitUnit(unit: Unit, parts: Array.<Unit>)
21 *
22 * Example:
23 *
24 * math.splitUnit(new Unit(1, 'm'), ['feet', 'inch'])
25 * // [ 3 feet, 3.3700787401575 inch ]
26 *
27 * See also:
28 *
29 * unit
30 *
31 * @param {Array} [parts] An array of strings or valueless units.
32 * @return {Array} An array of units.
33 */
34 return typed(name, {
35 'Unit, Array': function UnitArray(unit, parts) {
36 return unit.splitUnit(parts);
37 }
38 });
39});
40exports.createSplitUnit = createSplitUnit;
\No newline at end of file