You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

node-json-db

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-json-db - npm Package Compare versions

Comparing version

to
0.3.2

17

JsonDB.js

@@ -13,3 +13,3 @@ (function () {

var JsonDB = function (filename, saveOnPush) {
var JsonDB = function (filename, saveOnPush, humanReadable) {

@@ -36,3 +36,9 @@ this.filename = filename;

}
this.saveOnPush = saveOnPush;
this.saveOnPush = saveOnPush || true;
if (humanReadable) {
this.humanReadable = humanReadable;
}
else {
this.humanReadable = false;
}

@@ -177,3 +183,8 @@ return this;

try {
data = JSON.stringify(this.data);
if (this.humanReadable) {
data = JSON.stringify(this.data, null, 4);
}
else {
data = JSON.stringify(this.data);
}
FS.writeFileSync(this.filename, data, 'utf8');

@@ -180,0 +191,0 @@ } catch (err) {

2

package.json
{
"name": "node-json-db",
"version": "0.3.1",
"version": "0.3.2",
"description": "Database using JSON file as storage for Node.JS",

@@ -5,0 +5,0 @@ "main": "./JsonDB.js",

@@ -41,3 +41,4 @@ [![Build Status](https://secure.travis-ci.org/Belphemur/node-json-db.png?branch=master)](http://travis-ci.org/Belphemur/node-json-db) [![Coverage Status](https://img.shields.io/coveralls/Belphemur/node-json-db.svg)](https://coveralls.io/r/Belphemur/node-json-db?branch=master)

//If you put false, you'll have to call the save() method.
var db = new JsonDB("myDataBase", true);
//The third argument is to ask JsonDB to save the database in an human readable format. (default false)
var db = new JsonDB("myDataBase", true, false);

@@ -44,0 +45,0 @@ //Pushing the data into the database

@@ -33,3 +33,3 @@ var expect = require("expect.js");

describe('Initialisation', function () {
var db = new JsonDB(testFile1, true);
var db = new JsonDB(testFile1, true, true);

@@ -36,0 +36,0 @@ it('should create the JSON File', function (done) {