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

fresh.db

v1.0.7

Published

Easy to use and fast JSON file based database.

Downloads

95

Readme

Logo

🌿 Fresh.db

  • Easy to use and fast JSON file based database.

Installation

$ npm install fresh.db

🌐 API

FreshDBOptions

  • name<String>: Database name. db
  • folderPath<String>: Database folder path. ./fresh.db
  • prettySave<Boolean>: If its true brefore saving prettfys the data. false
  • prettySaveSS<Integer>: Prettyf spacing amount. 2
  • disableGetSetErrors<Boolean>: If the setting is true, it does not care about the errors that occur while putting or receiving data in the database and tries again. false
  • DEBUG<Boolean>: false

FreshDB

Functions's first is argument always dataPath and it is string if first argument is exits

  • set(): (Any)
    • arg-1: (String)
    • arg-2: (Any)
  • get(): (Any)
    • arg-1: (String)
  • del(): (Boolean)
    • arg-1: (String)
  • has(): (Boolean)
    • arg-1: (String)
  • update()
    • arg-1: (String)
    • arg-2: (Function(data))
    • Example:
    set("my.data", 6); // 6
    getAll(); // {"my":{"data":6}}
    update("my.data", (d) => {
      return d * 2;
    }); // 12
    getAll(); // {"my":{"data":12}}
  • getAll(): (Object)
  • s.push(): (Any)
    • arg-1: (String)
    • arg-2: (Any)
  • s.unshift(): (Any)
    • arg-1: (String)
    • arg-2: (Any)
  • s.shift(): (Any)
    • arg-1: (String)
  • s.pop(): (Any)
    • arg-1: (String)
  • s.splice(): (Any)
    • arg-1: (String)
    • arg-2: (Number)
    • arg-3: (Number)
  • s.add(): (Number)
    • arg-1: (String)
    • arg-2: (Number)
  • s.subtract(): (Number)
    • arg-1: (String)
    • arg-2: (Number)
  • s.mulitply(): (Number)
    • arg-1: (String)
    • arg-2: (Number)
  • s.divide(): (Number)
    • arg-1: (String)
    • arg-2: (Number)
  • clear(): (None)
  • deleteDatabase(): (None)
  • isDeleted: (Boolean)

Example

const FreshDB = require("fresh.db");
// create a db or get existing one
let db = new FreshDB();

db.set("gameSettings.difficulty", "Hard");

db.set("gameSettings.playerName", "Armağan");

// Add random items to player's inventory
db.s.push(
  "player.inventory",
  "Gold Sword",
  "Diamond Hoe",
  "Hacked Sword",
  "Apple",
  "Beef",
  "Hacked Beef"
);

// But i don't want hacked items
db.update("player.inventory", (d) => {
  return d.filter((i) => !i.toLowerCase().includes("hacked"));
});

// get 2nd item in player's inventory
db.get("player.inventory[1]"); // Diamond Hoe

// set 2nd item in player's inventory
db.set("player.inventory[1]", "Diamond Sword");

🔙 Updates

Update (1.0.7): new 3 shorthands.
Update (1.0.41): Fixed setDefaultOptions.
Major Update (1.0.4): Better error handling & better readme & DEBUG option & prettySave and prettySaveSS options & now you can change default options (FreshDB.setDefaultOptions({})) & new 2 shorthands (db.s).
Update (1.0.30): Better handling for shorthands (db.s).
Update (1.0.29): Now supports recursive folderPath opening.
Update (1.0.2): Better readme.
Update (1.0.1): Fixing lots of bugs.
Update (1.0.0): First relese.

Created with ❤ by Kıraç Armğan Önal > + You are soo cool! Because you are using FreshDB! 💕💞💓