source: trip-planner-front/node_modules/css/lib/stringify/compiler.js@ bdd6491

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

initial commit

  • Property mode set to 100644
File size: 738 bytes
RevLine 
[6a3a178]1
2/**
3 * Expose `Compiler`.
4 */
5
6module.exports = Compiler;
7
8/**
9 * Initialize a compiler.
10 *
11 * @param {Type} name
12 * @return {Type}
13 * @api public
14 */
15
16function Compiler(opts) {
17 this.options = opts || {};
18}
19
20/**
21 * Emit `str`
22 */
23
24Compiler.prototype.emit = function(str) {
25 return str;
26};
27
28/**
29 * Visit `node`.
30 */
31
32Compiler.prototype.visit = function(node){
33 return this[node.type](node);
34};
35
36/**
37 * Map visit over array of `nodes`, optionally using a `delim`
38 */
39
40Compiler.prototype.mapVisit = function(nodes, delim){
41 var buf = '';
42 delim = delim || '';
43
44 for (var i = 0, length = nodes.length; i < length; i++) {
45 buf += this.visit(nodes[i]);
46 if (delim && i < length - 1) buf += this.emit(delim);
47 }
48
49 return buf;
50};
Note: See TracBrowser for help on using the repository browser.