c2-mongoose 2.1.2 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -95,8 +95,7 @@ var SearchFlow = /** @class */ (function () {
95
95
  if ((0, Utils_1.isEmpty)(this.populate)) {
96
96
  return;
97
97
  }
98
- var populateStr = this.populate;
99
- var propertiesArray = populateStr.split(',');
98
+ var propertiesArray = typeof this.populate === 'string' ? this.populate.split(',') : [];
100
99
  var populates = [];
101
100
  for (var _i = 0, propertiesArray_1 = propertiesArray; _i < propertiesArray_1.length; _i++) {
102
101
  var property = propertiesArray_1[_i];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "Lib to make any search in database mongoose and use as basic crud",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,10 +27,9 @@ abstract class SearchFlow {
27
27
  public buildPopulate(): any {
28
28
  if (isEmpty(this.populate)) {
29
29
  return
30
- }
30
+ }
31
31
 
32
- var populateStr = this.populate as string
33
- var propertiesArray = populateStr.split(',')
32
+ var propertiesArray = typeof this.populate === 'string' ? this.populate.split(',') : [];
34
33
  var populates = [] as any
35
34
  for (var property of propertiesArray) {
36
35
  let [first, ...rest] = property.split('.')
@@ -190,7 +189,7 @@ abstract class SearchFlow {
190
189
  } else if (key.endsWith('Like')) {
191
190
  console.log(key)
192
191
  var keyAux = key.replace('Like', '')
193
- condition[keyAux] = {$regex: value as any, $options: 'i'}
192
+ condition[keyAux] = { $regex: value as any, $options: 'i' }
194
193
  filters.$and.push(condition)
195
194
  } else {
196
195
  if (!Array.isArray(value)) {