@whitep4nth3r/random-code

    1.0.11 • Public • Published

    random-code

    Need some code for your project? We've got you covered. Choose your language. Choose how much code. BÄM! You got code.

    Install package

    npm install @whitep4nth3r/random-code

    Get random code

    There are two functions available for you to use:

    import { getLanguages, generateRandomCode } from "@whitep4nth3r/random-code";

    Use getLanguages() to return an Object with key/value pairs of available languages.

    Use generateRandomCode() to generate some random code with two optional parameters.

    • language (a key from getLanguages())
    • lines (an integer of how many lines of code you require)

    If you do not provide these parameters, your result will be random.

    Here's an example request:

    const myRandomCode = generateRandomCode("js", 3);

    Here's an example response:

    {
      "code": "const replaceObject = () => {\n    /* FIXME: For some reason this is causing the code below to error out? */\n    const property = true;\n    return 0;\n}",
      "lines": "3",
      "languageKey": "js",
      "languageValue": "JavaScript",
      "contributors": ["whitep4nth3r", "lukeocodes", "negue", "isabellabrookes"]
    }

    Profit

    And lol.

    Contributions

    If you'd like to contribute to this project, check out this blog post to understand how to build and test the code locally.

    Keywords

    Install

    npm i @whitep4nth3r/random-code

    DownloadsWeekly Downloads

    1

    Version

    1.0.11

    License

    MIT

    Unpacked Size

    164 kB

    Total Files

    67

    Last publish

    Collaborators

    • avatar