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 🙏

© 2026 – Pkg Stats / Ryan Hefner

jsdat

v0.0.1

Published

Simple JSON database

Readme

JSDat - The simplest JSON database

Indostruction

JSON is a pretty good but sometimes you need more powerful data save method. SQL database is a good method but it also required to setting up. Now JSDat comes in! You just installing this package and now you can start working. Pretty simple :>

Docs

JSDat based on functions that creates classes so you don't need to use keyword new for create an class object. So there's 2 of them: Database (main class) and DBList. Also a blank object template

Database class

For create a Database object evaluate function imported by this module by default and pass your project's database's data folder as an argument

const jsdat = require('jsdat')(`${__dirname}/data`);

get(db)

Get DBList object using subfolder name (Use it only if you know that's the folder exists)

exists(db)

Check if database exists

create(db, blank)

Create a subfolder using blank object (Use it on your own risk)

db(db, blank)

Safely create&get a DBList object using subfolder name (Use estead of get&create combinations)

dispose(db)

Delete DBList from cache if application got broken

DBList

DBList represents a database list. You can use Database.create(db) function for create an instance of it

readonly blank

blank object of database

readonly data

(Not recommended, use .array() estead) data of database

get(line)

Get data of line

set(line, data)

Set data of line to data

forEach(fn)

Loop each entry of data with fn

array()

Return entries of database's data

Blank object

Represents a blank object that using in database by default. E. g. if you try to get an noneisting line it will send you blank data. You can't override data fields with .set() if its type does not match blank's field type or doesn't specified on it.

Examples

Simple profiles

You can simply use jsdat for store users' accounts profiles data

const db = require('jsdat')(`${__dirname}/data`).db("profiles", {
	username: "John Doe",
	password: "12345",
	ballance: 0,
	
	exists: false, //If you like, but better if it will be here
});

module.exports.addUser = (email, username, password) => {
	db.set(email, {
		username, password,
		
		ballance: 0,
		exists: true,
	});
}

module.exports.login = (email, password) => {
	const user = db.get(email);
	
	return user.password == password && user.exists;
}

//You can add a bit more functions but we here not for write you a bank system :>

"Enums" database (you need to make this thing first)

One of the main tricks with jsdat. Easy-to-edit-in-runtime enums. They have the simplest technology:

const enums = require('jsdat')("i dont want to write this again sry").db("enums", {
	values: ["string"] //Now will not work like that, but better add it because of future updates
});

enums.get("my_life").values[0]; //"is pointless"

ToDo list:

Make advanced 'typeof'

NodeJS's basic typeof can't give us a fully-functional and failsafe JSON database, so prepare to it, adding a type of arrays in their definition in blank

const {typeOf} = require("i dont want reval you this module name cuz you will steal it :<");

typeOf([]); //array[void]
typeof []   //object

typeOf({"hello": "world", "me": true}); //object{"hello": "string", "me": "boolean"}
typeof {"hello": "world", "me": true}   //object

Create an authefication and remote access

Sockets allows us to do warious things like our own protocols. So one of them will be a jsdat:// protocol. Adding this will also require an authefication system, so this will be a hard task (i don't a pro in sockets, sry)

Add database rules and data validation

In blank you can now set only type of data, but not any validator. This will cause a big changes like:

{
	"values": {
		"$type": "array",
		"$contents": [
			{
				"$type": "string",
				"$length": "1...30"
			}
		],
		"$access": {
			"user1": [
				"WRITE"
			],
			"%group1": [
				"WRITE",
				"MODIFY"
			],
			"$other": [
				"READ"
			]
		}
	}
}

You'll still be able to not use advanced rules