All files / egg-parser/src utils.js

73.33% Statements 11/15
0% Branches 0/4
20% Functions 1/5
100% Lines 10/10

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 151x     1x   1x 1x   1x 1x 1x 1x 1x   1x
const Radical = ["loc", "comments", "start", "end", "raw", 
                 "sourceType", "optional", "computed", 
                 "typeAnnotation"];
const Brutal = Radical.concat(["name"]);
 
let SkippedKeys = new Set(Radical);
const BrutalKeys = new Set(Brutal);
 
const skipKeys = keys => { SkippedKeys = new Set(keys) };
const skip = (key, value) => SkippedKeys.has(key)? undefined : value;
const skipBrutal = (key, value) => BrutalKeys.has(key)? undefined : value;
const simpleDeb = x => JSON.stringify(x, skip, 2);
const deb = x => JSON.stringify(x, skipBrutal, 1);
 
module.exports = { skipKeys, deb, simpleDeb };