source: trip-planner-front/node_modules/stylus/lib/functions/unit.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 509 bytes
Line 
1var utils = require('../utils')
2 , nodes = require('../nodes');
3
4/**
5 * Assign `type` to the given `unit` or return `unit`'s type.
6 *
7 * @param {Unit} unit
8 * @param {String|Ident} type
9 * @return {Unit}
10 * @api public
11 */
12
13function unit(unit, type){
14 utils.assertType(unit, 'unit', 'unit');
15
16 // Assign
17 if (type) {
18 utils.assertString(type, 'type');
19 return new nodes.Unit(unit.val, type.string);
20 } else {
21 return unit.type || '';
22 }
23}
24unit.params = ['unit', 'type'];
25module.exports = unit;
Note: See TracBrowser for help on using the repository browser.