Socket
Socket
Sign inDemoInstall

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.17.2 to 1.0.0

2

dist/LocalStorage.js

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

/*! lowdb v0.17.2 */
/*! lowdb v1.0.0 */
var LocalStorage =

@@ -3,0 +3,0 @@ /******/ (function(modules) { // webpackBootstrap

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

/*! lowdb v0.17.2 */
/*! lowdb v1.0.0 */
var LocalStorage=function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([,,,function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(4),s=function(e){function t(){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),u(t,[{key:"read",value:function(){var e=localStorage.getItem(this.source);return e?this.deserialize(e):(localStorage.setItem(this.source,this.serialize(this.defaultValue)),this.defaultValue)}},{key:"write",value:function(e){localStorage.setItem(this.source,this.serialize(e))}}]),t}(a);e.exports=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=r(5),i=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.defaultValue,u=void 0===i?{}:i,a=r.serialize,s=void 0===a?o:a,c=r.deserialize,l=void 0===c?JSON.parse:c;n(this,e),this.source=t,this.defaultValue=u,this.serialize=s,this.deserialize=l};e.exports=i},function(e,t,r){"use strict";e.exports=function(e){return JSON.stringify(e,null,2)}}]);

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

/*! lowdb v0.17.2 */
/*! lowdb v1.0.0 */
var low =

@@ -3,0 +3,0 @@ /******/ (function(modules) { // webpackBootstrap

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

/*! lowdb v0.17.2 */
/*! lowdb v1.0.0 */
var low=function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){"use strict";var n=r(1),o=r(2);t.exports=function(t){function e(t){return u.__wrapped__=t,u}if("object"!=typeof t)throw new Error("An adapter must be provided, see https://github.com/typicode/lowdb/#usage");var r=n.runInContext(),u=r.chain({});return r.prototype.write=r.wrap(r.prototype.value,function(t){var e=t.apply(this);return u.write(e)}),u._=r,u.read=function(){var r=t.read();return o(r)?r.then(e):e(r)},u.write=function(e){var r=t.write(u.getState());return o(r)?r.then(function(){return e}):e},u.getState=function(){return u.__wrapped__},u.setState=function(t){return e(t)},u.read()}},function(t,e){t.exports=_},function(t,e){function r(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}t.exports=r}]);
# lowdb/lib/fp
__:warning: Experimental__
`lowdb/lib/fp` lets you use [`lodash/fp`](https://github.com/lodash/lodash/wiki/FP-Guide), [`Ramda`](https://github.com/ramda/ramda) or simple JavaScript functions with lowdb.
It can help reducing the size of your `bundle.js`.
It can help reducing the size of your `bundle.js`
_Note `fp` is a recent addition to `lowdb`, feedbacks are welcome :)_
## Usage

@@ -10,0 +10,0 @@

@@ -54,3 +54,3 @@ # Examples

const low = require('lowdb')
const FileAsync = require('lowdb/lib/adapters/FileAsync')
const FileAsync = require('lowdb/adapters/FileAsync')

@@ -57,0 +57,0 @@ // Create server

{
"name": "lowdb",
"version": "0.17.2",
"description": "JSON database for Node and the browser powered by lodash API",
"version": "1.0.0",
"description": "Small JSON database for Node, Electron and the browser. Powered by Lodash.",
"keywords": [

@@ -12,6 +12,5 @@ "flat",

"JSON",
"lo-dash",
"lodash",
"underscore",
"localStorage",
"electron",
"embed",

@@ -58,3 +57,3 @@ "embeddable"

"delay": "^2.0.0",
"eslint": "^3.19.0",
"eslint": "^4.5.0",
"eslint-config-prettier": "^2.3.0",

@@ -76,3 +75,3 @@ "eslint-config-standard": "^10.2.1",

"rimraf": "^2.5.4",
"sinon": "^2.3.8",
"sinon": "^3.2.1",
"tempfile": "^2.0.0",

@@ -79,0 +78,0 @@ "webpack": "^3.3.0"

# Lowdb
[![](http://img.shields.io/npm/dm/lowdb.svg?style=flat)](https://www.npmjs.org/package/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) [![Support on Patreon](https://img.shields.io/badge/Patreon-%E2%99%A5-ff69b4.svg)](https://www.patreon.com/typicode)
[![](http://img.shields.io/npm/dm/lowdb.svg?style=flat)](https://www.npmjs.org/package/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) [![Donate](https://img.shields.io/badge/patreon-donate-ff69b4.svg)](https://www.patreon.com/typicode)
> Lodash powered mini database
> Small JSON database for Node, Electron and the browser. Powered by Lodash. :zap:

@@ -26,3 +26,3 @@ ```js

// Set some defaults if your JSON file is empty
// Set some defaults
db.defaults({ posts: [], user: {} })

@@ -36,3 +36,3 @@ .write()

// Set a user using Lodash powerful shorthand syntax
// Set a user using Lodash shorthand syntax
db.set('user.name', 'typicode')

@@ -73,3 +73,2 @@ .write()

* [In-memory](https://github.com/typicode/lowdb/tree/master/examples#in-memory)
* [lowdb/lib/fp](https://github.com/typicode/lowdb/tree/master/examples/fp.md)
* [JSFiddle live example](https://jsfiddle.net/typicode/4kd7xxbu/)

@@ -95,4 +94,4 @@

<script src="https://unpkg.com/lodash@4/lodash.min.js"></script>
<script src="https://unpkg.com/lowdb/dist/low.min.js"></script>
<script src="https://unpkg.com/lowdb/dist/LocalStorage.min.js"></script>
<script src="https://unpkg.com/lowdb@0.17/dist/low.min.js"></script>
<script src="https://unpkg.com/lowdb@0.17/dist/LocalStorage.min.js"></script>
<script>

@@ -110,7 +109,11 @@ var adapter = new LocalStorage('db')

__db.[...].write()__ and __db.[...].value()__
__db.[...].write()__
`write()` is syntactic sugar for calling `value()` and `db.write()` in one line. On the other side, `value()` is just [\_.protoype.value()](https://lodash.com/docs/4.17.4#prototype-value), use it to execute a chain.
__db.[...].value()__
`write()` is syntactic sugar for calling `value()` and `db.write()` in one line.
On the other hand, `value()` is just [\_.protoype.value()](https://lodash.com/docs/4.17.4#prototype-value) and should be used to execute a chain that doesn't change database state.
```js

@@ -117,0 +120,0 @@ db.set('user.name', 'typicode')

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