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

hyper-jdb

v0.0.1

Published

An amazing and simple json database

Downloads

1

Readme

Hyper JSON Database (HyperJDB)

version license downloads

An amazing and simple json database

Instalation

npm i hyper-jdb

Table of contents

Usage

// Using Node.js `require()`
const hyperJDB = require('hyper-jdb');

// Using ES6 imports
import hyperJDB from 'hyper-jdb';

const database = new hyperJDB("users") // This will create the folder `databases` and the `users.json` file

Methods

set(key, value)

Sets a value into the database.

database.set("language", "english")
/*
    {
        "language": "english"
    }
*/

// You can use dots to specify a new property 
database.set("user1.name", "Álvaro")

/* 
    {
        "language": "english",
        "user1": {
            "name": "Álvaro"
        }
    }
*/

get(key)

Gets an existing key from the database. Returns the value of the given key.

/*
    {
        "user1": {
            "name": "Álvaro",
            "age": 16
        },
        "user2": {
            "name": "Juan",
            "age": 20
        }
    }
*/

database.get("user1.name") // "Álvaro"
database.get("user2.age") // 20

has(key)

Searches the given key. Returns true if it exists or false if not.

/*
    {
        "user1": {
            "name": "newalvaro9",
            "hobbies": ["Gym", "Coding]
        }
    }
*/

database.has("user1.hobbies") // true
database.has("user1.age") // false

delete(key)

Deletes an existing key from the database.

/*
    {
        "user1": {
            "name": "Álvaro",
            "age": 16,
            "hobbies": ["Gym", "Coding", "Cycling"]
        }
    }
*/

database.delete("user1.hobbies[1]") // Deletes Coding property as it is hobbies[1]

/*
    {
        "user1": {
            "name": "Álvaro",
            "age": 16,
            "hobbies": ["Gym", "Cycling"]
        }
    }
*/

push(key, value)

Pushes to the given array a new value. Returns the updated array.

/*
    {
        "user1": {
            "name": "Álvaro",
            "age": 16,
            "hobbies": ["Gym", "Coding", "Cycling"]
        }
    }
*/

database.push("user1.hobbies", "Climbing")

/*
    {
        "user1": {
            "name": "Álvaro",
            "age": 16,
            "hobbies": ["Gym", "Coding", "Cycling", "Climbing"]
        }
    }
*/

add(key, quantity)

Adds to the given key the quantity provided (must be a Number). Returns the updated key value.

/*
    {
        "user1": {
            "name": "Álvaro",
            "money": 430
        }
    }
*/

// Adds 150 to 430 money property
database.add("user1.money", 150) // 580

/*
    {
        "user1": {
            "name": "Álvaro",
            "money": 580
        }
    }
*/

substract(key, quantity)

Substracts from the given key the quantity provided (must be a Number). Returns the updated key value.

/*
    {
        "user1": {
            "name": "Álvaro",
            "money": 430
        }
    }
*/
// Substracts 240 from 430 money 
database.add("user1.money", 240) // 190

/*
    {
        "user1": {
            "name": "Álvaro",
            "money": 190
        }
    }
*/

drop()

Clears all the data in the .json file

database.drop() // Clears the database 

Help

Have any doubts or suggestions? Send me a private message on Discord: @newalvaro9

License

MIT

Copyright 2023, Álvaro Poblador