How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • import ansiEscapes from 'ansi-escapes';
    
    // Moves the cursor two rows up and to the left
    process.stdout.write(ansiEscapes.cursorUp(2) + ansiEscapes.cursorLeft);
    //=> '\u001B[2A\u001B[1000D'
    Docs
  • function errorColor(str) {
      // Add ANSI escape codes to display text in red.
      return `\x1b[31m${str}\x1b[0m`;
    }
    
    program
      .configureOutput({
        // Visibly override write routines as example!
        writeOut: (str) => process.stdout.write(`[OUT] ${str}`),
        writeErr: (str) => process.stdout.write(`[ERR] ${str}`),
        // Highlight errors in color.
        outputError: (str, write) => write(errorColor(str))
      });
    Docs
  • const cursor = Person.find({ occupation: /host/ }).cursor();
    
    for (let doc = await cursor.next(); doc != null; doc = await cursor.next()) {
      console.log(doc); // Prints documents one at a time
    }
    
    Docs
  • prettier.formatWithCursor(" 1", { cursorOffset: 2, parser: "babel" });
    // -> { formatted: '1;\n', cursorOffset: 1 }
    
    Docs
  • function displayData() {
      var transaction = db.transaction(['rushAlbumList'], "readonly");
      var objectStore = transaction.objectStore('rushAlbumList');
    
      objectStore.openCursor().onsuccess = function(event) {
        var cursor = event.target.result;
        if(cursor) {
          var listItem = document.createElement('li');
          listItem.innerHTML = cursor.value.albumTitle + ', ' + cursor.value.year;
          list.appendChild(listItem);
    
          console.log(cursor.value);
          cursor.continue();
        } else {
          console.log('Entries all displayed.');
        }
      };
    };
    
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples