UNPKG

mathjs

Version:

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser and offers an integrated solution to work with numbers, big numbers, complex numbers, units, and matrices.

39 lines (31 loc) 762 B
'use strict'; var deepMap = require('../../../utils/collection/deepMap'); function factory (type, config, load, typed) { /** * Returns an array of units whose sum is equal to this unit * * Syntax: * * splitUnit(unit: Unit, parts: Array.<Unit>) * * Example: * * splitUnit(new Unit(1, 'm'), ['feet', 'inch']); * // [ 3 feet, 3.3700787401575 inch ] * * See also: * * unit * * @param {Array} [parts] An array of strings or valueless units. * @return {Array} An array of units. */ var splitUnit = typed('splitUnit', { 'Unit, Array': function(unit, parts) { return unit.splitUnit(parts); } }); return splitUnit; } exports.name = 'splitUnit'; exports.factory = factory;