Skip to content

Commit

Permalink
fix: Revert "fix: Remove unnecessary use of underscore for Array find…
Browse files Browse the repository at this point in the history
…/filter/map. Bump dcmjs version" (#49)

This reverts commit 8b3ecfe.
  • Loading branch information
swederik authored Jun 11, 2020
1 parent e7aa179 commit a757f44
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 26 deletions.
47 changes: 26 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"axios": "^0.19.0",
"chai": "^4.2.0",
"chai-http": "^4.3.0",
"dcmjs": "0.13.2",
"dcmjs": "0.8.3",
"fastify": "^2.10.0",
"fastify-basic-auth": "^0.5.0",
"fastify-cors": "^3.0.0",
Expand All @@ -23,6 +23,7 @@
"p-queue": "^6.2.1",
"split2": "^3.1.1",
"to-array-buffer": "^3.2.0",
"underscore": "^1.9.1",
"xmlhttprequest": "^1.8.0"
},
"devDependencies": {
Expand Down
9 changes: 5 additions & 4 deletions plugins/CouchDB.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-underscore-dangle, no-async-promise-executor */
const fp = require('fastify-plugin');
const _ = require('underscore');
const toArrayBuffer = require('to-array-buffer');
// eslint-disable-next-line no-global-assign
window = {};
Expand Down Expand Up @@ -176,7 +177,7 @@ async function couchdb(fastify, options) {
Promise.all([bodySeriesInfo, bodyStudies])
.then(values => {
const studies = {};
studies.rows = values[1].rows.filter(obj =>
studies.rows = _.filter(values[1].rows, obj =>
fastify.queryObj(request.query, obj.key[1], queryKeys)
);
const res = [];
Expand Down Expand Up @@ -222,7 +223,7 @@ async function couchdb(fastify, options) {
// if both studies have values, cumulate them but don't make duplicates
(typeof studySeriesObj[tag].Value[0] === 'string' &&
!studySeriesObj[tag].Value.includes(val)) ||
!studySeriesObj[tag].Value.findIndex(val) === -1
!_.findIndex(studySeriesObj[tag].Value, val) === -1
) {
studySeriesObj[tag].Value.push(val);
}
Expand Down Expand Up @@ -743,7 +744,7 @@ async function couchdb(fastify, options) {
},
async (error, body) => {
if (!error) {
const docs = body.rows.map(instance => {
const docs = _.map(body.rows, instance => {
return { _id: instance.key[2], _rev: instance.doc._rev, _deleted: true };
});
await fastify.dbPqueue.add(() => {
Expand Down Expand Up @@ -787,7 +788,7 @@ async function couchdb(fastify, options) {
},
async (error, body) => {
if (!error) {
const docs = body.rows.map(instance => {
const docs = _.map(body.rows, instance => {
return { _id: instance.key[2], _rev: instance.doc._rev, _deleted: true };
});
await fastify.dbPqueue.add(() => {
Expand Down

0 comments on commit a757f44

Please sign in to comment.