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

  • var accepts = require("accepts");
    var http = require("http");
    function app(req, res) {
      var accept = accepts(req); // the order of this list is significant; should be server preferred order
      switch (accept.type(["json", "html"])) {
        case "json":
          res.setHeader("Content-Type", "application/json");
          res.write('{"hello":"world!"}');
          break;
        case "html":
          res.setHeader("Content-Type", "text/html");
          res.write("hello, world!");
          break;
        default:
          // the fallback is text/plain, so no need to specify it above
          res.setHeader("Content-Type", "text/plain");
          res.write("hello, world!");
          break;
      }
      res.end();
    }
    http.createServer(app).listen(3000);
    
    Docs
    0
  • var accepts = require("accepts");
    var http = require("http");
    function app(req, res) {
      var accept = accepts(req); // the order of this list is significant; should be server preferred order
      switch (accept.type(["json", "html"])) {
        case "json":
          res.setHeader("Content-Type", "application/json");
          res.write('{"hello":"world!"}');
          break;
        case "html":
          res.setHeader("Content-Type", "text/html");
          res.write("hello, world!");
          break;
        default:
          // the fallback is text/plain, so no need to specify it above
          res.setHeader("Content-Type", "text/plain");
          res.write("hello, world!");
          break;
      }
      res.end();
    }
    http.createServer(app).listen(3000);
    
    Docs
    0
  • import React from "react";
    import { render, screen } from "@testing-library/react";
    import userEvent from "@testing-library/user-event";
    
    test("types into the input", () => {
      render(
        <>
          
          
        
      );
      const input = screen.getByLabelText(/enter a time/i);
      userEvent.type(input, "13:58");
      expect(input.value).toBe("13:58");
    });
    
    Docs
    0
  • import React from "react";
    import { render, screen } from "@testing-library/react";
    import userEvent, {
      specialChars,
    } from "@testing-library/user-event";
    
    test("delete characters within the selectedRange", () => {
      render(
        
    ); const input = screen.getByLabelText(/example/i); input.setSelectionRange(10, 13); userEvent.type(input, `${specialChars.backspace}good`); expect(input).toHaveValue("This is a good example"); });
    Docs
    0
  • import React from "react";
    import { render, screen } from "@testing-library/react";
    import userEvent from "@testing-library/user-event";
    
    test("type", () => {
      render(