Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
509 bytes
|
Line | |
---|
1 | var 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 |
|
---|
13 | function 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 | }
|
---|
24 | unit.params = ['unit', 'type'];
|
---|
25 | module.exports = unit;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.