Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lowdb

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lowdb - npm Package Compare versions

Comparing version 0.13.0 to 0.13.1

19

dist/lowdb.js

@@ -23,2 +23,11 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.low = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

if (source) {
if (format) {
if (format.serialize) {
db.serialize = format.serialize;
}
if (format.deserialize) {
db.deserialize = format.deserialize;
}
}
if (storage) {

@@ -54,10 +63,2 @@ if (storage.read) {

}
if (format) {
var _options = options;
var _format = _options.format;
db.serialize = _format.serialize;
db.deserialize = _format.deserialize;
}
}

@@ -72,3 +73,3 @@

db._checksum = str;
db.write(db.source, db.__wrapped__);
db.write(db.source);
}

@@ -75,0 +76,0 @@ }

@@ -1,1 +0,1 @@

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.low=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var isPromise=require("is-promise");module.exports=function(source){var _ref=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];var _ref$format=_ref.format;var format=_ref$format===undefined?null:_ref$format;var _ref$storage=_ref.storage;var storage=_ref$storage===undefined?null:_ref$storage;var _ref$writeOnChange=_ref.writeOnChange;var writeOnChange=_ref$writeOnChange===undefined?true:_ref$writeOnChange;var lodash=arguments[2];var _=lodash.runInContext();var db=_.chain({});if(source){if(storage){if(storage.read){db.read=function(){var s=arguments.length<=0||arguments[0]===undefined?source:arguments[0];var res=storage.read(s,db.deserialize);var init=function init(obj){db.__wrapped__=obj;db._checksum=JSON.stringify(db.__wrapped__)};if(isPromise(res)){return res.then(function(obj){init(obj);return db})}init(res);return db}}if(storage.write){db.write=function(){var dest=arguments.length<=0||arguments[0]===undefined?source:arguments[0];return storage.write(dest,db.__wrapped__,db.serialize)}}}if(format){var _options=options;var _format=_options.format;db.serialize=_format.serialize;db.deserialize=_format.deserialize}}function persist(){if(db.source&&db.write&&writeOnChange){var str=JSON.stringify(db.__wrapped__);if(str!==db._checksum){db._checksum=str;db.write(db.source,db.__wrapped__)}}}_.prototype.value=_.wrap(_.prototype.value,function(value){var v=value.apply(this);persist();return v});db.getState=function(){return db.__wrapped__};db.setState=function(state){db.__wrapped__=state;persist()};db._=_;db.source=source;if(db.read){return db.read()}else{return db}}},{"is-promise":4}],2:[function(require,module,exports){"use strict";module.exports={read:function read(source){var deserialize=arguments.length<=1||arguments[1]===undefined?JSON.parse:arguments[1];var data=localStorage.getItem(source);if(data){return deserialize(data)}else{localStorage.setItem(source,"{}");return{}}},write:function write(dest,obj){var serialize=arguments.length<=2||arguments[2]===undefined?JSON.stringify:arguments[2];return localStorage.setItem(dest,serialize(obj))}}},{}],3:[function(require,module,exports){"use strict";var index=require("./_index");var storage=require("./browser");module.exports=function low(source){var opts=arguments.length<=1||arguments[1]===undefined?{storage:storage}:arguments[1];return index(source,opts,window._)}},{"./_index":1,"./browser":2}],4:[function(require,module,exports){module.exports=isPromise;function isPromise(obj){return!!obj&&(typeof obj==="object"||typeof obj==="function")&&typeof obj.then==="function"}},{}]},{},[3])(3)});
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.low=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var isPromise=require("is-promise");module.exports=function(source){var _ref=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];var _ref$format=_ref.format;var format=_ref$format===undefined?null:_ref$format;var _ref$storage=_ref.storage;var storage=_ref$storage===undefined?null:_ref$storage;var _ref$writeOnChange=_ref.writeOnChange;var writeOnChange=_ref$writeOnChange===undefined?true:_ref$writeOnChange;var lodash=arguments[2];var _=lodash.runInContext();var db=_.chain({});if(source){if(format){if(format.serialize){db.serialize=format.serialize}if(format.deserialize){db.deserialize=format.deserialize}}if(storage){if(storage.read){db.read=function(){var s=arguments.length<=0||arguments[0]===undefined?source:arguments[0];var res=storage.read(s,db.deserialize);var init=function init(obj){db.__wrapped__=obj;db._checksum=JSON.stringify(db.__wrapped__)};if(isPromise(res)){return res.then(function(obj){init(obj);return db})}init(res);return db}}if(storage.write){db.write=function(){var dest=arguments.length<=0||arguments[0]===undefined?source:arguments[0];return storage.write(dest,db.__wrapped__,db.serialize)}}}}function persist(){if(db.source&&db.write&&writeOnChange){var str=JSON.stringify(db.__wrapped__);if(str!==db._checksum){db._checksum=str;db.write(db.source)}}}_.prototype.value=_.wrap(_.prototype.value,function(value){var v=value.apply(this);persist();return v});db.getState=function(){return db.__wrapped__};db.setState=function(state){db.__wrapped__=state;persist()};db._=_;db.source=source;if(db.read){return db.read()}else{return db}}},{"is-promise":4}],2:[function(require,module,exports){"use strict";module.exports={read:function read(source){var deserialize=arguments.length<=1||arguments[1]===undefined?JSON.parse:arguments[1];var data=localStorage.getItem(source);if(data){return deserialize(data)}else{localStorage.setItem(source,"{}");return{}}},write:function write(dest,obj){var serialize=arguments.length<=2||arguments[2]===undefined?JSON.stringify:arguments[2];return localStorage.setItem(dest,serialize(obj))}}},{}],3:[function(require,module,exports){"use strict";var index=require("./_index");var storage=require("./browser");module.exports=function low(source){var opts=arguments.length<=1||arguments[1]===undefined?{storage:storage}:arguments[1];return index(source,opts,window._)}},{"./_index":1,"./browser":2}],4:[function(require,module,exports){module.exports=isPromise;function isPromise(obj){return!!obj&&(typeof obj==="object"||typeof obj==="function")&&typeof obj.then==="function"}},{}]},{},[3])(3)});

@@ -22,2 +22,11 @@ 'use strict';

if (source) {
if (format) {
if (format.serialize) {
db.serialize = format.serialize;
}
if (format.deserialize) {
db.deserialize = format.deserialize;
}
}
if (storage) {

@@ -53,10 +62,2 @@ if (storage.read) {

}
if (format) {
var _options = options;
var _format = _options.format;
db.serialize = _format.serialize;
db.deserialize = _format.deserialize;
}
}

@@ -71,3 +72,3 @@

db._checksum = str;
db.write(db.source, db.__wrapped__);
db.write(db.source);
}

@@ -74,0 +75,0 @@ }

@@ -8,5 +8,7 @@ 'use strict';

module.exports = function low(source) {
var opts = arguments.length <= 1 || arguments[1] === undefined ? { storage: storage } : arguments[1];
var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
opts.storage = opts.storage || storage;
return index(source, opts, lodash);
};
{
"name": "lowdb",
"version": "0.13.0",
"version": "0.13.1",
"description": "JSON database for Node and the browser powered by lodash API",

@@ -21,3 +21,3 @@ "keywords": [

"scripts": {
"test": "babel-node test/all | tap-spec",
"test": "tape -r babel-register -r babel-polyfill test/*.js | tap-spec",
"prepublish": "npm run build",

@@ -24,0 +24,0 @@ "precommit": "npm test",

@@ -50,3 +50,3 @@ # 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)

* [JSFiddle live example](https://jsfiddle.net/typicode/4kd7xxbu/)
* [__Migrating from 0.12 to 0.13? See this guide.__](https://github.com/typicode/lowdb/releases/tag/v0.13.0-beta.4)
* [__Migrating from 0.12 to 0.13? See this guide.__](https://github.com/typicode/lowdb/releases/tag/v0.13.0)

@@ -304,6 +304,4 @@ ## Why lowdb?

const myFormat = {
format: {
serialize: (obj) => // must return data (usually string)
deserialize: (data) => // must return an object
}
serialize: (obj) => // must return data (usually string)
deserialize: (data) => // must return an object
}

@@ -310,0 +308,0 @@

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