Comparing version 0.10.0 to 0.10.1
{ | ||
"name": "lowdb", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"description": "Flat JSON file database", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -89,7 +89,6 @@ # lowdb [![NPM version](https://badge.fury.io/js/lowdb.svg)](http://badge.fury.io/js/lowdb) [![Build Status](https://travis-ci.org/typicode/lowdb.svg?branch=master)](https://travis-ci.org/typicode/lowdb) | ||
Database object. Useful for batch operations or to directly access the content of your JSON file. | ||
Use whenever you want to access or modify the underlying database object. | ||
```javascript | ||
console.log(db.object) // { songs: [ { title: 'low!' } ] } | ||
db('songs').value() === db.object.songs | ||
if (db.object.songs) console.log('songs array exists') | ||
``` | ||
@@ -96,0 +95,0 @@ |
@@ -5,3 +5,4 @@ var fs = require('graceful-fs') | ||
module.exports = { | ||
read: function (file) { | ||
// No async read | ||
readSync: function (file) { | ||
if (fs.existsSync(file)) { | ||
@@ -8,0 +9,0 @@ return fs.readFileSync(file, 'utf-8') |
@@ -90,4 +90,6 @@ var lodash = require('lodash') | ||
if (file) { | ||
var data = disk.read(file) | ||
if (data && data.trim() !== '') { | ||
// Parse file if there's some data | ||
// Otherwise init file | ||
var data = (disk.readSync(file) || '').trim() | ||
if (data) { | ||
try { | ||
@@ -94,0 +96,0 @@ db.object = low.parse(data) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10163
6
116
229