Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "aul", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Elegant database queries executor", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -202,1 +202,2 @@ # AUL | ||
[![](https://img.shields.io/badge/flattr-donate-yellow.svg)](https://flattr.com/profile/red_rabbit) | ||
@@ -101,2 +101,17 @@ "use strict"; | ||
/** | ||
* Helper function to return first element of result | ||
* | ||
* @param {Criteria|{}} criteria | ||
*/ | ||
findOne(criteria) { | ||
return this.execute(criteria) | ||
.then(r => { | ||
if (Array.isArray(r)) { | ||
return r[0]; | ||
} | ||
return r; | ||
}); | ||
} | ||
/** | ||
* Build query by passed criteria and run it. Each filter can be defined as async await function or return Promise. | ||
@@ -121,2 +136,3 @@ * | ||
} | ||
// TODO: check if results is array | ||
return criteria.mappers.reduce((results, mapper) => { | ||
@@ -123,0 +139,0 @@ if (typeof mapper === "function") { |
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
18724
15
318
203