Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 15556x 15556x 15556x 15556x 15556x 15556x 2x 2x 2x 2x 2x 2x 2x 41253x 41253x 41253x 41253x 41253x 41253x 41253x 2x 2x 2x 2x 2x 2x 55911x 55911x 55911x 55911x 55911x 2x 2x 2x 2x 2x 2x 2x 15657x 15657x 15657x 15657x 15657x 2x 2x 2x | /**
* This module exports the functions to build the AST.
*
* @module buildAst
*/
'use strict';
/**
* Builds an object.
* @param {Array} pairs A list of pairs to build the object.
* @returns {Object} The AST of the object.
*/
function buildObject(pairs) {
return {
type: 'object',
properties: pairs
};
}
/**
* Builds a pair.
* @param {Object} key Key of the pair.
* @param {Object} value Value of the pair.
* @returns {Object} The AST of the pair.
*/
function buildPair(key, value) {
return {
type: 'pair',
key: key.value,
value
};
}
/**
* Builds the value of a JSON file.
* @param {Object} value Value to build.
* @returns {Object} The AST of the value.
*/
function buildValue([value]) {
return {
type: 'value',
value: value.value,
};
}
/**
* Builds an array.
* @param {Array} array Array to build.
* @returns {Object} The AST of the array.
*/
function buildArray([array]) {
return {
type: 'array',
elements: array
};
}
export { buildObject, buildPair, buildValue, buildArray };
|