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.4.6

2

lib/utils.js
(function () {
"use strict";
var arrayIndexRegex = /(.+)\[(\d+)\]/;
var arrayIndexRegex = /(.+)\[(.+)\]/;
var endsWith = function (str, suffix) {

@@ -5,0 +5,0 @@ return str.indexOf(suffix, str.length - suffix.length) !== -1;

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

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

@@ -116,2 +116,6 @@ [![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)

//The index can be also non-numerical
//This will create an array 'myarray' with the object '{obj:'test'}' with key test
db.push("/arraytest/myarray[test]", {obj:'test'}, true);
//You can retrieve a property of an object included in an array

@@ -118,0 +122,0 @@ //testString = 'test';

@@ -177,2 +177,17 @@ var expect = require("expect.js");

});
it('should create an array with a string at index TEST', function () {
db.push('/arraytest/myarray[TEST]', "works", true);
var myarray = db.getData('/arraytest/myarray');
expect(myarray).to.be.an('array');
expect(myarray['TEST']).to.be('works');
});
it('should create an array with a string at index "TEST test"', function () {
db.push('/arraytest/myarray[TEST test]', "workingTest", true);
var myarray = db.getData('/arraytest/myarray');
expect(myarray).to.be.an('array');
expect(myarray['TEST test']).to.be('workingTest');
});
it('should add an object at index 1', function () {

@@ -179,0 +194,0 @@ var obj = {property: "perfect"};