periodicjs.core.data
Advanced tools
Comparing version 0.7.6 to 0.7.7
@@ -25,3 +25,3 @@ 'use strict'; | ||
//Iteratively checks if value was passed in options argument and conditionally assigns the default value if not passed in options | ||
let { sort, limit, population, fields, skip, } = ['sort', 'limit', 'population', 'fields', 'skip', ].reduce((result, key) => { | ||
let { sort, limit, population, fields, skip, } = ['sort', 'limit', 'population', 'fields', 'skip',].reduce((result, key) => { | ||
if (options[key] && !isNaN(Number(options[key]))) options[key] = Number(options[key]); | ||
@@ -80,3 +80,3 @@ result[key] = options[key] || this[key]; | ||
if (sort[key] < 1) { //descending | ||
return [key, true, ]; | ||
return [key, true,]; | ||
} else { | ||
@@ -140,3 +140,3 @@ return key; | ||
//Iteratively checks if value was passed in options argument and conditionally assigns the default value if not passed in options | ||
let { sort, limit, population, fields, skip, pagelength, query, } = ['sort', 'limit', 'population', 'fields', 'skip', 'pagelength', 'query', ].reduce((result, key) => { | ||
let { sort, limit, population, fields, skip, pagelength, query, } = ['sort', 'limit', 'population', 'fields', 'skip', 'pagelength', 'query',].reduce((result, key) => { | ||
if (options[key] && !isNaN(Number(options[key]))) options[key] = Number(options[key]); | ||
@@ -303,3 +303,3 @@ result[key] = options[key] || this[key]; | ||
//Iteratively checks if value was passed in options argument and conditionally assigns the default value if not passed in options | ||
let { sort, population, fields, docid, } = ['sort', 'population', 'fields', 'docid', ].reduce((result, key) => { | ||
let { sort, population, fields, docid, } = ['sort', 'population', 'fields', 'docid',].reduce((result, key) => { | ||
if (options[key] && !isNaN(Number(options[key]))) options[key] = Number(options[key]); | ||
@@ -540,6 +540,23 @@ result[key] = options[key] || this[key]; | ||
let deleteid = options.deleteid || options.id; | ||
if (typeof deleteid !== 'string') throw new Error('Must specify "deleteid" or "id" for delete'); | ||
let object = Model.findObject({ _id: deleteid, }); | ||
let result = Model.remove(object); | ||
cb(null, result); | ||
if (Array.isArray(deleteid)) { | ||
_QUERY.call(this, { | ||
query: { | ||
_id: { | ||
$in: deleteid, | ||
}, | ||
}, | ||
}, (err, deleteDocs) => { | ||
if (err) { | ||
cb(err); | ||
} else { | ||
let result = Model.remove(deleteDocs); | ||
cb(null, result); | ||
} | ||
}); | ||
} else { | ||
if (typeof deleteid !== 'string') throw new Error('Must specify "deleteid" or "id" for delete'); | ||
let object = Model.findObject({ _id: deleteid, }); | ||
let result = Model.remove(object); | ||
cb(null, result); | ||
} | ||
} catch (e) { | ||
@@ -546,0 +563,0 @@ cb(e); |
@@ -45,3 +45,3 @@ { | ||
"jsdoc": "^3.4.3", | ||
"lowkie": "^1.3.2", | ||
"lowkie": "^1.3.3", | ||
"mocha": "~2.2.5", | ||
@@ -98,4 +98,4 @@ "mocha-lcov-reporter": "^1.2.0", | ||
}, | ||
"version": "0.7.6", | ||
"version": "0.7.7", | ||
"license": "MIT" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5466
1862171
86