npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

0db-repl

v0.0.1

Published

0db REPL playground for testing 0db database.

Downloads

37

Readme

🅾️ 0db REPL

NPM version NodeJS JavaScript Web

REPL playground for testing 0db.

This is a nodeJS REPL that comes with some handy context variables to easily play around with 0db on the command line.

Screenshot

📥 Installation

npm i 0db-repl -g

ℹ️ Usage

Launch using:

0db

Type help() to see a description of all available context variables.

Context Variables:

Context variables are objects and functions that are already defined and available for usage during the REPL session.

$0db

0db object.

🎯 Example:

► const myDb = await $0db("my-db.json")

db

A default instance using the default file ./db.json ready for use.

🎯 Example:

► await db("users").create({ name: "ambratolm" })

faker

Fake data generator to generate some realistic mock data. (See: Faker.JS)

🎯 Example:

► faker.name.firstName()
► faker.name.lastName()
► faker.name.gender()
► faker.internet.userName()
► faker.internet.email()
► faker.internet.password()
► await db("users").create({
    name: faker.internet.userName(),
    email: faker.internet.email(),
    password: faker.internet.password()
  })

gen

Built-in example data objects generator (using faker) that has some functions to generate example objects that can be added to database.

  • gen.user(count?) : Generates user objects.

    • Parameters:
      • count : Number, Optional. Number of objects to generate. Default: 1.
    • Returns an object if count <= 1, else an array of objects.

    user object is based on this schema:

    {
      name: String,
      firstName: String,
      lastName: String,
      gender: String,
      email: String,
      password: String,
      points: Number
    }

    🎯 Example:

    ► gen.user() // Returns 1 user object
    ► gen.user(100) // Returns an array of 100 user objects
    ► await db("users").create(gen.user())
  • gen.note(author?, count?) : Generates note objects.

    • Parameters:
      • author : String, Optional. Identifier for the author of the note (Expected to be the $id field of a created user object that exists in database).
      • count : Number, Optional. Number of objects to generate. Default: 1.
    • Returns an object if count <= 1, else an array of objects.

    note object is based on this schema:

    {
      author: String,
      title: String,
      content: String
    }

    🎯 Example:

    ► const user = await db("users").create(gen.user()) // Create a user item
    ► gen.note(user.$id) // Returns 1 note object
    ► gen.note(user.$id, 100) // Returns an array of 100 note objects
    ► const user = await db("users").create(gen.user())
    ► await db("notes").create(gen.note(user.$id))

cls

Clears screen.

🎯 Example:

► cls()

help

Shows a description of all context variables.

  • Parameters:
    • name : String, Optional. Name of a specific context object or function to show description for.

🎯 Example:

► help() // Shows all descriptions
► help("db") // Shows description only for "db" function
► help("gen") // Shows description only for "gen" object

🚀 Development

  1. Clone the repository.

    cd somewhere
    git clone https://github.com/practical-works/0db-repl.git
    cd 0db-repl
  2. Install dependencies: npm i

  3. Run:

    • npm run dev for development.
    • npm start for production.

💡 In development, you can type rs to manually restart. (See: Nodemon)

🏭 Environment

🌑 Application

📃 License

Licensed under MIT.