Заменил lazy.js на lodash

This commit is contained in:
Book Pauk
2018-12-30 15:37:26 +07:00
parent 040461ed59
commit ef352dff14
3 changed files with 11 additions and 10 deletions

14
package-lock.json generated
View File

@@ -949,6 +949,12 @@
"integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=",
"dev": true "dev": true
}, },
"babel-plugin-syntax-dynamic-import": {
"version": "6.18.0",
"resolved": "http://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz",
"integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=",
"dev": true
},
"babel-plugin-syntax-exponentiation-operator": { "babel-plugin-syntax-exponentiation-operator": {
"version": "6.13.0", "version": "6.13.0",
"resolved": "http://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", "resolved": "http://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz",
@@ -4728,11 +4734,6 @@
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
"dev": true "dev": true
}, },
"lazy.js": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/lazy.js/-/lazy.js-0.5.1.tgz",
"integrity": "sha512-p9v24vaKrzS2mEx3yuzva/3M6I3+HwvXd0pB1Xf/IvsFIMdhQgmym7JBO0e7c0OZmKTo07sCuiCIm6jazSWFNw=="
},
"lcid": { "lcid": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz",
@@ -4799,8 +4800,7 @@
"lodash": { "lodash": {
"version": "4.17.11", "version": "4.17.11",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
"dev": true
}, },
"lodash.debounce": { "lodash.debounce": {
"version": "4.0.8", "version": "4.0.8",

View File

@@ -20,6 +20,7 @@
"babel-core": "^6.22.1", "babel-core": "^6.22.1",
"babel-eslint": "^10.0.1", "babel-eslint": "^10.0.1",
"babel-loader": "^7.1.1", "babel-loader": "^7.1.1",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-preset-env": "^1.3.2", "babel-preset-env": "^1.3.2",
"css-loader": "^1.0.0", "css-loader": "^1.0.0",
"eslint": "^5.11.1", "eslint": "^5.11.1",
@@ -43,7 +44,7 @@
"axios": "^0.18.0", "axios": "^0.18.0",
"bluebird": "^3.5.3", "bluebird": "^3.5.3",
"express": "^4.16.4", "express": "^4.16.4",
"lazy.js": "^0.5.1", "lodash": "^4.17.11",
"sql-template-strings": "^2.2.2", "sql-template-strings": "^2.2.2",
"sqlite": "^3.0.0", "sqlite": "^3.0.0",
"vue": "^2.5.21", "vue": "^2.5.21",

View File

@@ -1,11 +1,11 @@
const log = require('../core/getLogger').getLog(); const log = require('../core/getLogger').getLog();
const BaseController = require('./BaseController'); const BaseController = require('./BaseController');
const Lazy = require('lazy.js'); const _ = require('lodash');
class MiscController extends BaseController { class MiscController extends BaseController {
async getConfig(req, res) { async getConfig(req, res) {
if (Array.isArray(req.body.params)) if (Array.isArray(req.body.params))
return Lazy(this.config).pick(req.body.params).toObject(); return _.pick(this.config, req.body.params);
//bad request //bad request
res.status(400).send({error: 'params is not an array'}); res.status(400).send({error: 'params is not an array'});
return false; return false;