@xcrap/transformer 0.0.6 → 0.0.8

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.
@@ -53,13 +53,13 @@ class TransformingModel {
53
53
  }
54
54
  async transformNestedValue(value, localData, rootData) {
55
55
  if (value.multiple) {
56
- if (!Array.isArray(localData)) {
56
+ if (!Array.isArray(localData[value.key])) {
57
57
  throw new Error("Input data for a 'multiple' nested model must be an array.");
58
58
  }
59
- return await Promise.all(localData.map((item) => value.model.transform(item, rootData[value.key])));
59
+ return await Promise.all(localData[value.key].map((item) => value.model.transform(item, item)));
60
60
  }
61
61
  else {
62
- return await value.model.transform({}, rootData[value.key]);
62
+ return await value.model.transform({}, localData[value.key]);
63
63
  }
64
64
  }
65
65
  after({ delete: delete_, append }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xcrap/transformer",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "Xcrap Transformer is the data transformation package extracted from the Web Scraping framework Xcrap.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",