diff options
| author | 8cy <[email protected]> | 2020-04-03 02:48:28 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-04-03 02:48:28 -0700 |
| commit | f9159ea2d994e14180fb02ab562f0119513e67cf (patch) | |
| tree | 09d14cdf05456567156738b681379d4bccd64e5c /node_modules/lowdb | |
| parent | 2020/04/03, 02:42, V1.2.1 (diff) | |
| download | s5nical-f9159ea2d994e14180fb02ab562f0119513e67cf.tar.xz s5nical-f9159ea2d994e14180fb02ab562f0119513e67cf.zip | |
2020/04/03, 02:47, V1.2.2
Diffstat (limited to 'node_modules/lowdb')
| -rw-r--r-- | node_modules/lowdb/.babelrc | 6 | ||||
| -rw-r--r-- | node_modules/lowdb/.npmignore | 3 | ||||
| -rw-r--r-- | node_modules/lowdb/LICENSE | 20 | ||||
| -rw-r--r-- | node_modules/lowdb/README.md | 352 | ||||
| -rw-r--r-- | node_modules/lowdb/dist/lowdb.js | 143 | ||||
| -rw-r--r-- | node_modules/lowdb/dist/lowdb.min.js | 1 | ||||
| -rw-r--r-- | node_modules/lowdb/examples/README.md | 135 | ||||
| -rw-r--r-- | node_modules/lowdb/lib/_index.js | 100 | ||||
| -rw-r--r-- | node_modules/lowdb/lib/browser.js | 21 | ||||
| -rw-r--r-- | node_modules/lowdb/lib/file-async.js | 22 | ||||
| -rw-r--r-- | node_modules/lowdb/lib/file-sync.js | 37 | ||||
| -rw-r--r-- | node_modules/lowdb/lib/index.browser.js | 10 | ||||
| -rw-r--r-- | node_modules/lowdb/lib/index.node.js | 13 | ||||
| -rw-r--r-- | node_modules/lowdb/lib/json.js | 10 | ||||
| -rw-r--r-- | node_modules/lowdb/lowdb.d.ts | 530 | ||||
| -rw-r--r-- | node_modules/lowdb/package.json | 107 | ||||
| -rw-r--r-- | node_modules/lowdb/webpack.config.js | 23 |
17 files changed, 0 insertions, 1533 deletions
diff --git a/node_modules/lowdb/.babelrc b/node_modules/lowdb/.babelrc deleted file mode 100644 index e36182a..0000000 --- a/node_modules/lowdb/.babelrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "presets": [ - "es2015", - "stage-3" - ] -} diff --git a/node_modules/lowdb/.npmignore b/node_modules/lowdb/.npmignore deleted file mode 100644 index 47c680c..0000000 --- a/node_modules/lowdb/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -.travis.yml -src -test diff --git a/node_modules/lowdb/LICENSE b/node_modules/lowdb/LICENSE deleted file mode 100644 index 3a2b740..0000000 --- a/node_modules/lowdb/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 typicode - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/lowdb/README.md b/node_modules/lowdb/README.md deleted file mode 100644 index 47b6a80..0000000 --- a/node_modules/lowdb/README.md +++ /dev/null @@ -1,352 +0,0 @@ -# Lowdb [](http://badge.fury.io/js/lowdb) [](https://travis-ci.org/typicode/lowdb) - -> A small local database for small projects :cat: (powered by lodash API) - -```js -const db = low('db.json') - -db.defaults({ posts: [], user: {} }) - .value() - -db.get('posts') - .push({ id: 1, title: 'lowdb is awesome'}) - .value() - -db.set('user.name', 'typicode') - .value() -``` - -Data is __automatically__ saved to `db.json` - -```json -{ - "posts": [ - { "id": 1, "title": "lowdb is awesome"} - ], - "user": { - "name": "typicode" - } -} -``` - -And you can query it using [lodash API](https://lodash.com/docs) - -```js -db.get('posts') - .find({ id: 1 }) - .value() -``` - -Lowdb is perfect for CLIs, small servers, Electron apps and npm packages in general. - -It supports __Node__, the __browser__ and uses __lodash API__, so it's very simple to learn. Actually... you may already know how to use lowdb :wink: - -* [Usage examples](https://github.com/typicode/lowdb/tree/master/examples) - * [CLI](https://github.com/typicode/lowdb/tree/master/examples#cli) - * [Browser](https://github.com/typicode/lowdb/tree/master/examples#browser) - * [Server](https://github.com/typicode/lowdb/tree/master/examples#server) - * [In-memory](https://github.com/typicode/lowdb/tree/master/examples#in-memory) -* [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) - -## Why lowdb? - -* Lodash API -* Minimal and simple to use -* Highly flexible - * __Custom storage__ (file, browser, in-memory, ...) - * __Custom format__ (JSON, BSON, YAML, XML, ...) - * Mixins (id support, ...) - * Read-only or write-only modes - * Encryption - -__Important__ lowdb doesn't support Cluster. - -## Install - -```sh -npm install lowdb --save -yarn add lowdb # if you prefer to use yarn -``` - -A UMD build is also available on [unpkg](https://unpkg.com/) for testing and quick prototyping: - -```html -<script src="https://unpkg.com/lodash@4/lodash.min.js"></script> -<script src="https://unpkg.com/lowdb/dist/lowdb.min.js"></script> -<script> - var db = low('db') -</script> -``` - -## API - -__low([source, [options])__ - -* `source` string or null, will be passed to storage -* `options` object - * `storage` object, by default `lowdb/lib/file-sync` or `lowdb/lib/browser`. - * `read` function or null - * `write` function or null - * `format` object - * `serialize` function, by default `JSON.stringify` - * `deserialize` function, by default `JSON.parse` - * `writeOnChange`boolean - -Creates a __lodash chain__, you can use __any__ lodash method on it. When `.value()` is called data is saved using `storage`. - -You can use `options` to configure how lowdb should persist data. Here are some examples: - -```js -// in-memory -low() - -// persisted using async file storage -low('db.json', { storage: require('lowdb/lib/file-async') }) - -// persisted using a custom storage -low('some-source', { storage: require('./my-custom-storage') }) - -// write on change disabled -low('db.json', { writeOnChange: false }) - -// read-only -const fileSync = require('lowdb/lib/file-sync') -low('db.json', { - storage: { - read: fileSync.read - } -}) - -// write-only -low('db.json', { - storage: { - write: fileSync.write - } -}) -``` - -__db.___ - -Database lodash instance. Use it to add your own utility functions or third-party mixins like [underscore-contrib](https://github.com/documentcloud/underscore-contrib) or [underscore-db](https://github.com/typicode/underscore-db). - -```js -db._.mixin({ - second: function(array) { - return array[1] - } -}) - -const post1 = db.get('posts').first().value() -const post2 = db.get('posts').second().value() -``` - -__db.getState()__ - -Use whenever you want to access the database state. - -```js -db.getState() // { posts: [ ... ] } -``` - -__db.setState(newState)__ - -Use it to drop database or set a new state (database will be automatically persisted). - -```js -const newState = {} -db.setState(newState) -``` - -__db.write([source])__ - -Persists database using `storage.write` option. Depending on the storage, it may return a promise (for example, with `file-async'). - -By default, lowdb automatically calls it when database changes. - -```js -const db = low('db.json') -db.write() // writes to db.json -db.write('copy.json') // writes to copy.json -``` - -__db.read([source])__ - -Reads source using `storage.read` option. Depending on the storage, it may return a promise. - -```js -const db = low('db.json') -db.read() // reads db.json -db.read('copy.json') // reads copy.json -``` - -## Guide - -### How to query - -With lowdb, you get access to the entire [lodash API](http://lodash.com/), so there are many ways to query and manipulate data. Here are a few examples to get you started. - -Please note that data is returned by reference, this means that modifications to returned objects may change the database. To avoid such behaviour, you need to use `.cloneDeep()`. - -Also, the execution of methods is lazy, that is, execution is deferred until `.value()` is called. - -#### Examples - -Check if posts exists. - -```js -db.has('posts') - .value() -``` - -Set posts. - -```js -db.set('posts', []) - .value() -``` - - -Sort the top five posts. - -```js -db.get('posts') - .filter({published: true}) - .sortBy('views') - .take(5) - .value() -``` - -Get post titles. - -```js -db.get('posts') - .map('title') - .value() -``` - -Get the number of posts. - -```js -db.get('posts') - .size() - .value() -``` - -Get the title of first post using a path. - -```js -db.get('posts[0].title') - .value() -``` - -Update a post. - -```js -db.get('posts') - .find({ title: 'low!' }) - .assign({ title: 'hi!'}) - .value() -``` - -Remove posts. - -```js -db.get('posts') - .remove({ title: 'low!' }) - .value() -``` - -Make a deep clone of posts. - -```js -db.get('posts') - .cloneDeep() - .value() -``` - - -### How to use id based resources - -Being able to get data using an id can be quite useful, particularly in servers. To add id-based resources support to lowdb, you have 2 options. - -[underscore-db](https://github.com/typicode/underscore-db) provides a set of helpers for creating and manipulating id-based resources. - -```js -const db = low('db.json') - -db._.mixin(require('underscore-db')) - -const postId = db.get('posts').insert({ title: 'low!' }).value().id -const post = db.get('posts').getById(postId).value() -``` - -[uuid](https://github.com/broofa/node-uuid) is more minimalist and returns a unique id that you can use when creating resources. - -```js -const uuid = require('uuid') - -const postId = db.get('posts').push({ id: uuid(), title: 'low!' }).value().id -const post = db.get('posts').find({ id: postId }).value() -``` - -### How to use a custom storage or format - -`low()` accepts custom storage or format. Simply create objects with `read/write` or `serialize/deserialize` methods. See `src/browser.js` code source for a full example. - -```js -const myStorage = { - read: (source, deserialize) => // must return an object or a Promise - write: (source, obj, serialize) => // must return undefined or a Promise -} - -const myFormat = { - serialize: (obj) => // must return data (usually string) - deserialize: (data) => // must return an object -} - -low(source, { - storage: myStorage, - format: myFormat -}) -``` - -### How to encrypt data - -Simply `encrypt` and `decrypt` data in `format.serialize` and `format.deserialize` methods. - -For example, using [cryptr](https://github.com/MauriceButler/cryptr): - -```js -const Cryptr = require("./cryptr"), -const cryptr = new Cryptr('my secret key') - -const db = low('db.json', { - format: { - deserialize: (str) => { - const decrypted = cryptr.decrypt(str) - const obj = JSON.parse(decrypted) - return obj - }, - serialize: (obj) => { - const str = JSON.stringify(obj) - const encrypted = cryptr.encrypt(str) - return encrypted - } - } -}) -``` - -## Changelog - -See changes for each version in the [release notes](https://github.com/typicode/lowdb/releases). - -## Limits - -lowdb is a convenient method for storing data without setting up a database server. It is fast enough and safe to be used as an embedded database. - -However, if you seek high performance and scalability more than simplicity, you should probably stick to traditional databases like MongoDB. - -## License - -MIT - [Typicode](https://github.com/typicode) diff --git a/node_modules/lowdb/dist/lowdb.js b/node_modules/lowdb/dist/lowdb.js deleted file mode 100644 index 4f74fad..0000000 --- a/node_modules/lowdb/dist/lowdb.js +++ /dev/null @@ -1,143 +0,0 @@ -(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] : {}, - _ref$format = _ref.format, - format = _ref$format === undefined ? null : _ref$format, - _ref$storage = _ref.storage, - storage = _ref$storage === undefined ? null : _ref$storage, - _ref$writeOnChange = _ref.writeOnChange, - writeOnChange = _ref$writeOnChange === undefined ? true : _ref$writeOnChange; - - var lodash = arguments[2]; - - // Create a fresh copy of lodash - 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 ? arguments[0] : source; - - 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 ? arguments[0] : source; - return storage.write(dest, db.__wrapped__, db.serialize); - }; - } - } - } - - // Persist database state - 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); - } - } - } - - // Modify value function to call save before returning result - _.prototype.value = _.wrap(_.prototype.value, function (value) { - var v = value.apply(this); - persist(); - return v; - }); - - // Get or set database state - db.getState = function () { - return db.__wrapped__; - }; - db.setState = function (state) { - db.__wrapped__ = state; - persist(); - }; - - db._ = _; - db.source = source; - - // Read - if (db.read) { - return db.read(); - } else { - return db; - } -}; -},{"is-promise":4}],2:[function(require,module,exports){ -'use strict'; - -/* global localStorage */ - -module.exports = { - read: function read(source) { - var deserialize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : JSON.parse; - - 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 ? arguments[2] : JSON.stringify; - 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 ? arguments[1] : { storage: storage }; - - 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) -});
\ No newline at end of file diff --git a/node_modules/lowdb/dist/lowdb.min.js b/node_modules/lowdb/dist/lowdb.min.js deleted file mode 100644 index 51baab4..0000000 --- a/node_modules/lowdb/dist/lowdb.min.js +++ /dev/null @@ -1 +0,0 @@ -(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]:{},_ref$format=_ref.format,format=_ref$format===undefined?null:_ref$format,_ref$storage=_ref.storage,storage=_ref$storage===undefined?null:_ref$storage,_ref$writeOnChange=_ref.writeOnChange,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?arguments[0]:source;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?arguments[0]:source;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?arguments[1]:JSON.parse;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?arguments[2]:JSON.stringify;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?arguments[1]:{storage:storage};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)});
\ No newline at end of file diff --git a/node_modules/lowdb/examples/README.md b/node_modules/lowdb/examples/README.md deleted file mode 100644 index 8e7022b..0000000 --- a/node_modules/lowdb/examples/README.md +++ /dev/null @@ -1,135 +0,0 @@ -# Examples - -## CLI - -```js -// cli.js -const low = require('lowdb') -const db = low('db.json') - -db.defaults({ posts: [] }) - .value() - -const result = db.get('posts') - .push({ name: process.argv[2] }) - .value() - -console.log(result) -``` - -```sh -$ node cli.js hello -# [ { title: 'hello' } ] -``` - -## Browser - -```js -import low from 'lowdb' -const db = low('db') - -db.defaults({ posts: [] }) - .value() - -// Data is automatically saved to localStorage -db.get('posts') - .push({ title: 'lowdb' }) - .value() -``` - -## Server - -Please __note__ that if you're developing a local server and don't expect to get concurrent requests, it's often easier to use `file-sync` storage, which is the default. - -But if you need to avoid blocking requests, you can do so by using `file-async` storage. - -```js -const express = require('express') -const low = require('lowdb') -const fileAsync = require('lowdb/lib/file-async') - -// Create server -const app = express() - -// Start database using file-async storage -const db = low('db.json', { - storage: fileAsync -}) - -// Init -db.defaults({ posts: [] }) - .value() - -// Define posts -const posts = db.get('posts') - -// Routes -// GET /posts/:id -app.get('/posts/:id', (req, res) => { - const post = posts - .find({ id: req.params.id }) - .value() - - res.send(post) -}) - -// POST /posts -app.post('/posts', (req, res) => { - // Some basic id generation, use uuid ideally - req.body.id = Date.now() - - // post will be created asynchronously in the background - const post = posts - .push(req.body) - .last() - .value() - - res.send(post) -}) - -app.listen(3000, () => console.log('Server is listening')) -``` - -In the example above, data is written asynchronously in the background. If you want to send the response only after it has been written, set `writeOnChange` to `false` and call `db.write()` manually. - -```js -const db = low('db.json', { - storage: fileAsync, - writeOnChange: false -}) - -//... -app.post('/posts', (req, res) => { - const post = posts - .push(req.body) - .last() - .value() - - db.write() - .then(() => res.send(post)) -}) -// ... -``` - -## In-memory - -In this mode, no storage is used. Everything is done in memory. - -You can still persist data but you'll have to do it yourself. Here's an example: - -```js -const fs = require('fs') -const db = low() - -db.defaults({ posts: [] }) - .value() - -db.get('posts') - .push({ title: 'lowdb' }) - .value() - -// Manual writing -fs.writeFileSync('db.json', JSON.stringify(db.getState())) -``` - -In this case, it's recommended to create a custom storage. diff --git a/node_modules/lowdb/lib/_index.js b/node_modules/lowdb/lib/_index.js deleted file mode 100644 index c4c475b..0000000 --- a/node_modules/lowdb/lib/_index.js +++ /dev/null @@ -1,100 +0,0 @@ -'use strict'; - -var isPromise = require('is-promise'); - -module.exports = function (source) { - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - _ref$format = _ref.format, - format = _ref$format === undefined ? null : _ref$format, - _ref$storage = _ref.storage, - storage = _ref$storage === undefined ? null : _ref$storage, - _ref$writeOnChange = _ref.writeOnChange, - writeOnChange = _ref$writeOnChange === undefined ? true : _ref$writeOnChange; - - var lodash = arguments[2]; - - // Create a fresh copy of lodash - 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 ? arguments[0] : source; - - 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 ? arguments[0] : source; - return storage.write(dest, db.__wrapped__, db.serialize); - }; - } - } - } - - // Persist database state - 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); - } - } - } - - // Modify value function to call save before returning result - _.prototype.value = _.wrap(_.prototype.value, function (value) { - var v = value.apply(this); - persist(); - return v; - }); - - // Get or set database state - db.getState = function () { - return db.__wrapped__; - }; - db.setState = function (state) { - db.__wrapped__ = state; - persist(); - }; - - db._ = _; - db.source = source; - - // Read - if (db.read) { - return db.read(); - } else { - return db; - } -};
\ No newline at end of file diff --git a/node_modules/lowdb/lib/browser.js b/node_modules/lowdb/lib/browser.js deleted file mode 100644 index e0bd3fb..0000000 --- a/node_modules/lowdb/lib/browser.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -/* global localStorage */ - -module.exports = { - read: function read(source) { - var deserialize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : JSON.parse; - - 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 ? arguments[2] : JSON.stringify; - return localStorage.setItem(dest, serialize(obj)); - } -};
\ No newline at end of file diff --git a/node_modules/lowdb/lib/file-async.js b/node_modules/lowdb/lib/file-async.js deleted file mode 100644 index d5c30c6..0000000 --- a/node_modules/lowdb/lib/file-async.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -var steno = require('steno'); - -var _require = require('./json'), - stringify = _require.stringify; - -module.exports = { - read: require('./file-sync').read, - write: function write(dest, obj) { - var serialize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringify; - - return new Promise(function (resolve, reject) { - var data = serialize(obj); - - steno.writeFile(dest, data, function (err) { - if (err) return reject(err); - resolve(); - }); - }); - } -};
\ No newline at end of file diff --git a/node_modules/lowdb/lib/file-sync.js b/node_modules/lowdb/lib/file-sync.js deleted file mode 100644 index 03def0e..0000000 --- a/node_modules/lowdb/lib/file-sync.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -var fs = require('graceful-fs'); - -var _require = require('./json'), - parse = _require.parse, - stringify = _require.stringify; - -module.exports = { - read: function read(source) { - var deserialize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : parse; - - if (fs.existsSync(source)) { - // Read database - var data = fs.readFileSync(source, 'utf-8').trim() || '{}'; - - try { - return deserialize(data); - } catch (e) { - if (e instanceof SyntaxError) { - e.message = 'Malformed JSON in file: ' + source + '\n' + e.message; - } - throw e; - } - } else { - // Initialize empty database - fs.writeFileSync(source, '{}'); - return {}; - } - }, - write: function write(dest, obj) { - var serialize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringify; - - var data = serialize(obj); - fs.writeFileSync(dest, data); - } -};
\ No newline at end of file diff --git a/node_modules/lowdb/lib/index.browser.js b/node_modules/lowdb/lib/index.browser.js deleted file mode 100644 index 3f38342..0000000 --- a/node_modules/lowdb/lib/index.browser.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -var index = require('./_index'); -var storage = require('./browser'); - -module.exports = function low(source) { - var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { storage: storage }; - - return index(source, opts, window._); -};
\ No newline at end of file diff --git a/node_modules/lowdb/lib/index.node.js b/node_modules/lowdb/lib/index.node.js deleted file mode 100644 index 506165e..0000000 --- a/node_modules/lowdb/lib/index.node.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -var lodash = require('lodash'); -var index = require('./_index'); -var storage = require('./file-sync'); - -module.exports = function low(source) { - var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - opts.storage = opts.storage || storage; - - return index(source, opts, lodash); -};
\ No newline at end of file diff --git a/node_modules/lowdb/lib/json.js b/node_modules/lowdb/lib/json.js deleted file mode 100644 index 77b0ac0..0000000 --- a/node_modules/lowdb/lib/json.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -var jph = require('json-parse-helpfulerror'); - -module.exports = { - parse: jph.parse, - stringify: function stringify(obj) { - return JSON.stringify(obj, null, 2); - } -};
\ No newline at end of file diff --git a/node_modules/lowdb/lowdb.d.ts b/node_modules/lowdb/lowdb.d.ts deleted file mode 100644 index baa8b26..0000000 --- a/node_modules/lowdb/lowdb.d.ts +++ /dev/null @@ -1,530 +0,0 @@ -interface PromiseLike<T> { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>; - then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>; -} - -interface StringRepresentable { - toString(): string; -} - -interface List<T> { - [index: number]: T; - length: number; -} - -interface Dictionary<T> { - [index: string]: T; -} - -interface DictionaryIterator<T, TResult> { - (value: T, key?: string, collection?: Dictionary<T>): TResult; -} - -interface ListIterator<T, TResult> { - (value: T, index: number, collection: List<T>): TResult; -} - -interface StringIterator<TResult> { - (char: string, index?: number, string?: string): TResult; -} - -interface MixinOptions { - chain?: boolean; -} - -interface LoDashWrapper { - - /** - * @see _.has - */ - has(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; - - /** - * @see _.hasIn - */ - hasIn(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; - - /** - * @see _.assign - */ - assign<TSource extends {}, TResult extends {}>( - source: TSource - ): LoDashWrapper; - - /** - * @see _.assign - */ - assign<TSource1 extends {}, TSource2 extends {}, TResult extends {}>( - source1: TSource1, - source2: TSource2 - ): LoDashWrapper; - - /** - * @see _.assign - */ - assign<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TResult extends {}>( - source1: TSource1, - source2: TSource2, - source3: TSource3 - ): LoDashWrapper; - - /** - * @see _.assign - */ - assign<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TSource4 extends {}, TResult extends {}>( - source1: TSource1, - source2: TSource2, - source3: TSource3, - source4: TSource4 - ): LoDashWrapper; - - /** - * @see _.assign - */ - assign(): LoDashWrapper; - - /** - * @see _.assign - */ - assign<TResult extends {}>(...otherArgs: any[]): LoDashWrapper; - - /** - * @see _.cloneDeep - */ - cloneDeep<T>(): LoDashWrapper; - - /** - * @see _.cloneDeep - */ - cloneDeep<T>(): LoDashWrapper; - - /** - * @see _.cloneDeep - */ - cloneDeepWith<T>(customizer: (value: any) => any): LoDashWrapper[]; - - /** - * @see _.cloneDeep - */ - cloneDeepWith<T>(customizer: (value: any) => any): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults<S1 extends {}, TResult extends {}>( - source1: S1, - ...sources: {}[] - ): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults<S1 extends {}, S2 extends {}, TResult extends {}>( - source1: S1, - source2: S2, - ...sources: {}[] - ): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults<S1 extends {}, S2 extends {}, S3 extends {}, TResult extends {}>( - source1: S1, - source2: S2, - source3: S3, - ...sources: {}[] - ): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults<S1 extends {}, S2 extends {}, S3 extends {}, S4 extends {}, TResult extends {}>( - source1: S1, - source2: S2, - source3: S3, - source4: S4, - ...sources: {}[] - ): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults(): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults<TResult>(...sources: {}[]): LoDashWrapper; - - /** - * @see _.get - */ - get<TResult>(object: Object, - path: string | number | boolean | Array<string | number | boolean>, - defaultValue?: TResult - ): LoDashWrapper; - - /** - * @see _.get - */ - get<TResult>(path: string | number | boolean | Array<string | number | boolean>, - defaultValue?: TResult - ): LoDashWrapper; - - - /** - * @see _.mixin - */ - mixin<TResult>( - source: Dictionary<Function>, - options?: MixinOptions - ): LoDashWrapper; - - /** - * @see _.mixin - */ - mixin<TResult>( - options?: MixinOptions - ): LoDashWrapper; - - /** - * @see _.set - */ - set<TResult>( - path: StringRepresentable | StringRepresentable[], - value: any - ): LoDashWrapper; - - /** - * @see _.set - */ - set<V, TResult>( - path: StringRepresentable | StringRepresentable[], - value: V - ): LoDashWrapper; - - /** - * @see _.find - */ - find<T>( - predicate?: ListIterator<T, boolean>, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.find - */ - find( - predicate?: string, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.find - */ - find<TObject extends {}>( - predicate?: TObject - ): LoDashWrapper; - - /** - * @see _.find - */ - filter<TObject extends {}>( - predicate?: TObject - ): LoDashWrapper; - - /** - * @see _.filter - */ - filter<T>( - predicate?: ListIterator<T, boolean>, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.filter - */ - filter( - predicate: string, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.filter - */ - filter<T>( - predicate: ListIterator<T, boolean> | DictionaryIterator<T, boolean>, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.filter - */ - filter( - predicate?: StringIterator<boolean>, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.filter - */ - filter<W>(predicate: W): LoDashWrapper; - /** - * @see _.map - */ - map<T, TResult>( - iteratee?: ListIterator<T, TResult>, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.map - */ - map<TResult>( - iteratee?: string - ): LoDashWrapper; - - /** - * @see _.map - */ - map<TObject extends {}>( - iteratee?: TObject - ): LoDashWrapper; - /** - * @see _.map - */ - map<TValue, TResult>( - iteratee?: ListIterator<TValue, TResult> | DictionaryIterator<TValue, TResult>, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.range - */ - range( - end?: number, - step?: number - ): LoDashWrapper; - - /** - * @see _.rangeRight - */ - rangeRight( - end?: number, - step?: number - ): LoDashWrapper; - - /** - * @see _.remove - */ - remove<T>( - predicate?: ListIterator<T, boolean>, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.remove - */ - remove( - predicate?: string, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.remove - */ - remove<W>( - predicate?: W - ): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy<T, TSort>( - iteratee?: ListIterator<T, TSort> - ): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy(iteratee: string): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy<W extends {}>(whereValue: W): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy(): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy<T>(...iteratees: (ListIterator<T, boolean> | Object | string)[]): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy<T>(iteratees: (ListIterator<T, any> | string | Object)[]): LoDashWrapper; - - /** - * @see _.slice - */ - slice( - start?: number, - end?: number - ): LoDashWrapper; - - /** - * @see _.size - */ - size(): LoDashWrapper; - - /** - * @see _.take - */ - take(n?: number): LoDashWrapper; - - /** - * @see _.times - */ - times<TResult>( - iteratee: (num: number) => TResult - ): LoDashWrapper; - - /** - * @see _.times - */ - times(): LoDashWrapper; - - /** - * @see _.uniqueId - */ - uniqueId(): LoDashWrapper; - - value<T>(): T; - - pop<T>(): T; - push<T>(...items: T[]): LoDashWrapper; - shift<T>(): T; - sort<T>(compareFn?: (a: T, b: T) => number): LoDashWrapper; - splice<T>(start: number): LoDashWrapper; - splice<T>(start: number, deleteCount: number, ...items: any[]): LoDashWrapper; - unshift<T>(...items: T[]): LoDashWrapper; -} - -interface Storage { - /** - * Reads the database. - * - * @param source The source location. - * @param deserialize The deserialize function to apply. - * @return Returns a promise with the deserialized db object. - */ - read?(source: string, deserialize: any): PromiseLike<any> - /** - * Reads the database. - * - * @param source The source location. - * @param deserialize The deserialize function to apply. - * @return Returns the deserialized db object. - */ - read?(source: string, deserialize: any): Object - /** - * Writes to the database. - * - * @param destination The destination location. - * @param obj The object to write. - * @param serialize The serialize function to apply. - */ - write?(destination: string, obj: any, serialize: any): void - /** - * Writes to the database. - * - * @param destination The destination location. - * @param obj The object to write. - * @param serialize The serialize function to apply. - */ - write?(destination: string, obj: any, serialize: any): PromiseLike<void> -} - -interface Format { - /** - * Writes to the database. - * - * @param obj The object to serialize. - * @return Returns the serialized object string. - */ - serialize(obj: Object): string - /** - * Writes to the database. - * - * @param data The object to deserialize. - * @return Returns the deserialized object. - */ - deserialize(data: string): Object -} - -interface Options { - /** - * The custom "storage" object. - */ - storage?: Storage - /** - * The custom "format" object. - */ - format?: Format - /** - * The flag to automatically persist changes. - */ - writeOnChange?: boolean -} - -interface Low extends LoDashWrapper, Format { - /** - * Access current database state. - * Returns Returns the database state. - */ - getState(): Object - /** - * Drop or reset database state. - * @param newState New state of the database - */ - setState(newState: Object): void - /** - * Persist database. - * @param source The source location. - */ - write(source: string): void - /** - * Persist database. - * @param source The source location. - */ - write(source: string): PromiseLike<any> - /** - * Read database. - * @param source The source location. - */ - read(source?: string): Object - /** - * Read database. - * @param source The source location. - */ - read(source?: string): PromiseLike<Object> -} - -interface LowFactory { - new (source?: string, opts?: Options): Low; -} - -declare var low: LowFactory; - -export = low
\ No newline at end of file diff --git a/node_modules/lowdb/package.json b/node_modules/lowdb/package.json deleted file mode 100644 index 310f498..0000000 --- a/node_modules/lowdb/package.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "_from": "lowdb@^0.14.0", - "_id": "[email protected]", - "_inBundle": false, - "_integrity": "sha1-zOTmr/6GfGzUsZazgtM1m00577U=", - "_location": "/lowdb", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "lowdb@^0.14.0", - "name": "lowdb", - "escapedName": "lowdb", - "rawSpec": "^0.14.0", - "saveSpec": null, - "fetchSpec": "^0.14.0" - }, - "_requiredBy": [ - "/node-file-cache" - ], - "_resolved": "https://registry.npmjs.org/lowdb/-/lowdb-0.14.0.tgz", - "_shasum": "cce4e6affe867c6cd4b196b382d3359b4d39efb5", - "_spec": "lowdb@^0.14.0", - "_where": "E:\\Documents\\GitHub\\s5nical\\node_modules\\node-file-cache", - "author": { - "name": "Typicode", - "email": "[email protected]" - }, - "browser": { - "./lib/index.node.js": "./lib/index.browser.js" - }, - "bugs": { - "url": "https://github.com/typicode/lowdb/issues" - }, - "bundleDependencies": false, - "dependencies": { - "graceful-fs": "^4.1.3", - "is-promise": "^2.1.0", - "json-parse-helpfulerror": "^1.0.3", - "lodash": "4", - "steno": "^0.4.1" - }, - "deprecated": false, - "description": "JSON database for Node and the browser powered by lodash API", - "devDependencies": { - "babel-cli": "^6.2.0", - "babel-eslint": "^7.0.0", - "babel-loader": "^6.2.2", - "babel-polyfill": "^6.9.1", - "babel-preset-es2015": "^6.1.18", - "babel-preset-stage-3": "^6.3.13", - "babel-register": "^6.9.0", - "browserify": "^13.0.1", - "husky": "^0.11.9", - "lodash": "^4.12.0", - "sinon": "^1.17.2", - "standard": "^8.5.0", - "tap-spec": "^4.1.1", - "tape": "^4.2.2", - "tempfile": "^1.1.1", - "uglify-js": "^2.6.2", - "underscore-db": "^0.12.0", - "webpack": "^1.12.13" - }, - "engines": { - "node": ">= 0.12" - }, - "homepage": "https://github.com/typicode/lowdb", - "keywords": [ - "flat", - "file", - "local", - "database", - "storage", - "JSON", - "lo-dash", - "lodash", - "underscore", - "localStorage", - "embed", - "embeddable" - ], - "license": "MIT", - "main": "./lib/index.node.js", - "name": "lowdb", - "repository": { - "type": "git", - "url": "git://github.com/typicode/lowdb.git" - }, - "scripts": { - "babel": "babel src --out-dir lib", - "browserify": "mkdir -p dist && browserify lib/index.browser.js -o dist/lowdb.js --standalone low", - "build": "npm run babel && npm run browserify && npm run uglify", - "precommit": "npm test", - "prepublish": "npm run build", - "test": "tape -r babel-register -r babel-polyfill test/*.js | tap-spec", - "uglify": "uglifyjs dist/lowdb.js -o dist/lowdb.min.js" - }, - "standard": { - "parser": "babel-eslint" - }, - "typescript": { - "definition": "./lowdb.d.ts" - }, - "typings": "./lowdb.d.ts", - "version": "0.14.0" -} diff --git a/node_modules/lowdb/webpack.config.js b/node_modules/lowdb/webpack.config.js deleted file mode 100644 index 999983d..0000000 --- a/node_modules/lowdb/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -var webpack = require('webpack') -var pkg = require('./package.json') -var banner = 'lowdb v' + pkg.version - -module.exports = { - entry: './src/index.js', - output: { - path: './dist', - library: 'low', - libraryTarget: 'umd' - }, - externals: { - 'lodash': '_' - }, - plugins: [ - new webpack.BannerPlugin(banner) - ], - module: { - loaders: [ - { test: /\.js$/, exclude: /node_modules/, loader: 'babel' } - ] - } -} |