github.com/consensys/gnark-crypto@v0.14.0/.github/parse-tests.js (about)

     1  const readline = require('readline');
     2  
     3  // Create readline interface
     4  const rl = readline.createInterface({
     5    input: process.stdin,
     6    output: process.stdout,
     7    terminal: false
     8  });
     9  
    10  let content = '';
    11  
    12  // Read stdin content
    13  rl.on('line', (line) => {
    14    content += line + '\n';
    15  });
    16  
    17  rl.on('close', () => {
    18    // Escape special characters
    19    const escapedContent = content.replace(/"/g, ' ');
    20    // Convert the JSON object to a string
    21    const jsonStr = JSON.stringify(escapedContent);
    22    const jsonStr2 = jsonStr.slice(1, -1);
    23    console.log(jsonStr2);
    24  });