New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nscdb

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nscdb

A lightweight package to manage json and other data storage formats

  • 0.1.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

Build status NPM Downloads Known Vulnerabilities

Contributors BSD-2-Clause Forks Stargazers Issues


Logo

JS Database (aka. NSCDB) v0.1.7

A simple lightweight package to manage data
Read the Wiki »
Explore the typedoc »
See Changelog »

Quickstart · Report Bug · Request Feature

Table of Contents

About The Project

Built With

Dependencies

Optional Dependencies
  • js-yaml@^3.14.0 - the package has an integrated adaptor for yaml using js-yaml (install if you want to use yaml)
  • xml-js@^1.6.11 - the package has an integrated adaptor for xml using xml-js (install if you want to use xml)

[See all dependencies]

Getting Started

To get the package up and running follow these simple steps.

Prerequisites

You should have already installed npm to install this package

  • npm
npm install npm@latest -g

Installation

1. Install the package

[using npm]

npm i nscdb

[using yarn]

yarn add nscdb
2. (Optional) install optional dependencies

js-yaml (for using yaml files)
[using npm]

npm i js-yaml

[using yarn]

yarn add js-yaml

xml-js (for using xml files)
[using npm]

npm i xml-js

[using yarn]

yarn add xml-js

Usage

Basic Usage

Import using Typescript

import { createDatabase } from 'nscdb';
import { JsonFileAdapter } from 'nscdb/json_adapter';

Import using Javascript

const { createDatabase } = require('nscdb');
const { JsonFileAdapter } = require('nscdb/json_adapter');

A small system using the api

let database = await createDatabase(new JsonFileAdapter("./database.json"));

// Set defaults
database.setDefaults({
  users: []
});

// Push a value into the Database
let users = database.get("users");
users.push({
  id: database.generateId("users"),
  name: 'Harleen Dolan',
  password: 'a password'
});

users.push({
  id: database.generateId("users"),
  name: 'Lisa Bradley',
  password: 'another password'
});

// print output data from the database
console.log(database.data);

// Console Output:
// >> {
// >>   users: [
// >>     { id: 0, name: 'Harleen Dolan', password: 'a password' },
// >>     { id: 1, name: 'Lisa Bradley', password: 'another password' }
// >>   ],
// >>   id_counters: { users: 1 }
// >> }

// Save the Database
await database.saveData();

Continue after Quickstart

For more examples, please refer to the Documentation

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your own Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the BSD2-Clause License. See LICENSE for more information.

Contact

Project Link: https://github.com/nsc-de/js-database


Logo

js-database by Nicolas Schmidt | License BSD-2-Clause | read the wiki | explore the typedoc | GitHub | NPM

Keywords

FAQs

Package last updated on 26 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc