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

@sectly-studios/suchdb

v1.0.16

Published

An simple, dependency free, require & go node.js and browser database

Downloads

31

Readme

SuchDB: An simple, dependency free, require & go node.js and browser database

Install: npm i @sectly-studios/suchdb | (https://www.npmjs.com/package/@sectly-studios/suchdb)

Quick Start:

let SuchDB = require("@sectly-studios/suchdb");

let database = new SuchDB.SuchDB({}); // Make an new database instance

database.set("foo", "bar") // Lets add some data

database.get("foo") // Lets grab the data, It should return: bar

database.set("foo", { bar: [1, 2, 3, 4], baz: { name: "SuchDB" } }) // SuchDB Supports: Strings, Numbers, Objects And Arrays As Values

database.get("foo") // { bar: [1, 2, 3, 4], baz: { name: "SuchDB" } })

database.get("foo").bar // [1, 2, 3, 4]

database.get("foo").bar[0] // 1

database.get("foo").baz // { name: "SuchDB" }

database.get("foo").baz["name"] // SuchDB

Docs:

Table of Contents

exports

Browser:

Load in file with:

<script src="path/to/suchdb"></script>
let database = SuchDB.SuchDB();

Node.js:

let SuchDB = require("@sectly-studios/suchdb");

let database = new SuchDB.SuchDB();

Options/Config:

let SuchDB = require("@sectly-studios/suchdb").SuchDB({
   master: "data",
   autosave: true,
   autoload: false,
   encrypt: {
     enabled: true,
     key: "SuchDB_Key",
   },
   autobackup: true,
   logging: true,
   custom_logging : function(message) {
    // Some code to log to something like logtail or sentry.
   }
});

set

Set/Add Data To The Database

Parameters

database.get(key, value)

get

Get/Grab Data From The Database

Parameters

database.get(key) // Returns data

remove

Remove/Delete Data From The Database

Parameters

database.remove(key)

clear

Clear/Delete All Data In The Database

database.clear()

keys

Get Database Keys

database.keys() // Returns keys

values

Get Database Values

database.values() // Returns values

entries

Get Database Entries

database.entries() // Returns object

forEach

Loop Through All Data In The Database

Parameters

database.forEach(function(key, value) {
    // Retuns key and value
})

size

Get Database Size

database.size() // Returns number

isEmpty

Check If Database Is Empty

database.isEmpty() // Returns boolean

has

Check If Database Has Data

Parameters

  • key
database.has(key) // Returns boolean

lookup

Lookup Data In The Database

Parameters

  • value any
database.lookup(value) // Returns data

sort

Sort the database

Parameters

database.sort(key, reverse)

port

Port Json To The Database

Parameters

database.port(json, overwrite)

save

Save Database To:

localStorage node-fs

database.save()

load

Load Database From:

localStorage node-fs

Parameters

let overwrite = false;

database.load(overwrite)

save

Save Database Backup To:

localStorage node-fs

database.saveBackup()

load

Load Database Backup From:

localStorage node-fs

Parameters

let overwrite = false;

database.loadBackup(overwrite)

raw

Get Raw Database Data

database.raw() // Returns object

find

Find entry by query

database.find({name:"something",value:"something"}) // Returns entry

Parameters

findMultiple

Find one or more entries by query

database.findMultiple({name:"something",value:"something"}) //Returns an array of entries

Paramters

Boot

SuchDB

var options = {
   master: "data",
   autosave: true,
   autoload: false,
   encrypt: {
     enabled: true,
     key: "SuchDB_Key",
   },
   autobackup: true,
};

let database = new SuchDB.SuchDB(options);

let SuchDB = require("@sectly-studios/suchdb");

Parameters

var options = {
   master: "data",
   autosave: true,
   autoload: false,
   encrypt: {
     enabled: true,
     key: "SuchDB_Key",
   },
   autobackup: true,
};