c2-mongoose 2.1.241 → 2.1.243

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.
@@ -63,8 +63,11 @@ var BuildPopulateSingleFlowItem = /** @class */ (function () {
63
63
  // var populate = {} as IPopulate
64
64
  var _a;
65
65
  if (nested === void 0) { nested = ""; }
66
- if (!((_a = populateAcc.path) === null || _a === void 0 ? void 0 : _a.includes(target))) {
67
- populateAcc.path += " ".concat(target);
66
+ if (populateAcc.path === undefined) {
67
+ populateAcc.path = target;
68
+ }
69
+ else if (!((_a = populateAcc.path) === null || _a === void 0 ? void 0 : _a.includes(target))) {
70
+ populateAcc.path += " ".concat(target).trim();
68
71
  }
69
72
  if ((0, Utils_1.isNotEmpty)(nested)) {
70
73
  var _b = nested.split('.'), first = _b[0], rest = _b.slice(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.241",
3
+ "version": "2.1.243",
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",
@@ -55,8 +55,10 @@ class BuildPopulateSingleFlowItem {
55
55
  public buildPath(target: string, nested: string = "", populateAcc: IPopulate): IPopulate {
56
56
  // var populate = {} as IPopulate
57
57
 
58
- if (!populateAcc.path?.includes(target)){
59
- populateAcc.path += ` ${target}`
58
+ if (populateAcc.path === undefined) {
59
+ populateAcc.path = target
60
+ } else if (!populateAcc.path?.includes(target)){
61
+ populateAcc.path += ` ${target}`.trim()
60
62
  }
61
63
 
62
64
  if (isNotEmpty(nested)) {