c2-mongoose 2.1.1 → 2.1.3

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.
@@ -7,7 +7,7 @@ declare abstract class SearchFlow {
7
7
  page: number;
8
8
  limit: number;
9
9
  select: string;
10
- populate: string | [] | any;
10
+ populate: any;
11
11
  filters: any;
12
12
  constructor(params: any);
13
13
  buildPopulate(): any;
@@ -95,7 +95,7 @@ var SearchFlow = /** @class */ (function () {
95
95
  if ((0, Utils_1.isEmpty)(this.populate)) {
96
96
  return;
97
97
  }
98
- var propertiesArray = this.populate.split(',');
98
+ var propertiesArray = typeof this.populate === 'string' ? this.populate.split(',') : '';
99
99
  var populates = [];
100
100
  for (var _i = 0, propertiesArray_1 = propertiesArray; _i < propertiesArray_1.length; _i++) {
101
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.1",
3
+ "version": "2.1.3",
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",
@@ -10,7 +10,7 @@ abstract class SearchFlow {
10
10
  page: number
11
11
  limit: number
12
12
  select: string
13
- populate: string | [] | any
13
+ populate: any
14
14
  filters: any
15
15
 
16
16
  constructor(params: any) {
@@ -28,7 +28,8 @@ abstract class SearchFlow {
28
28
  if (isEmpty(this.populate)) {
29
29
  return
30
30
  }
31
- var propertiesArray = this.populate.split(',')
31
+
32
+ var propertiesArray = typeof this.populate === 'string' ? this.populate.split(',') : '';
32
33
  var populates = [] as any
33
34
  for (var property of propertiesArray) {
34
35
  let [first, ...rest] = property.split('.')
@@ -188,7 +189,7 @@ abstract class SearchFlow {
188
189
  } else if (key.endsWith('Like')) {
189
190
  console.log(key)
190
191
  var keyAux = key.replace('Like', '')
191
- condition[keyAux] = {$regex: value as any, $options: 'i'}
192
+ condition[keyAux] = { $regex: value as any, $options: 'i' }
192
193
  filters.$and.push(condition)
193
194
  } else {
194
195
  if (!Array.isArray(value)) {