source: trip-planner-front/node_modules/css-tree/lib/syntax/node/Dimension.js

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

initial commit

  • Property mode set to 100644
File size: 811 bytes
Line 
1var consumeNumber = require('../../tokenizer/utils').consumeNumber;
2var TYPE = require('../../tokenizer').TYPE;
3
4var DIMENSION = TYPE.Dimension;
5
6module.exports = {
7 name: 'Dimension',
8 structure: {
9 value: String,
10 unit: String
11 },
12 parse: function() {
13 var start = this.scanner.tokenStart;
14 var numberEnd = consumeNumber(this.scanner.source, start);
15
16 this.eat(DIMENSION);
17
18 return {
19 type: 'Dimension',
20 loc: this.getLocation(start, this.scanner.tokenStart),
21 value: this.scanner.source.substring(start, numberEnd),
22 unit: this.scanner.source.substring(numberEnd, this.scanner.tokenStart)
23 };
24 },
25 generate: function(node) {
26 this.chunk(node.value);
27 this.chunk(node.unit);
28 }
29};
Note: See TracBrowser for help on using the repository browser.