@dotdev/next-components
Advanced tools
Comparing version 0.4.10 to 0.5.0
@@ -7,2 +7,3 @@ import * as React from "react"; | ||
private transform; | ||
private legacyTransform; | ||
render(): JSX.Element; | ||
@@ -9,0 +10,0 @@ } |
@@ -33,3 +33,28 @@ "use strict"; | ||
_this.transform = function (data) { | ||
if (0 < data.length && !data[0]._name) { | ||
return _this.legacyTransform(data); | ||
} | ||
var sections = []; | ||
data.map(function (item, index) { | ||
var blocks = item.blocks; | ||
var fields = item; | ||
delete fields.blocks; | ||
sections.push({ | ||
id: index + "_" + item._name, | ||
type: "dynamic", | ||
name: item._name, | ||
settings: fields, | ||
blocks: blocks | ||
? blocks.map(function (block, i) { return ({ | ||
id: i, | ||
type: "default", | ||
settings: block | ||
}); }) | ||
: [] | ||
}); | ||
}); | ||
return sections; | ||
}; | ||
_this.legacyTransform = function (data) { | ||
var sections = []; | ||
data.map(function (item) { | ||
@@ -36,0 +61,0 @@ Object.keys(item).forEach(function (key) { |
{ | ||
"name": "@dotdev/next-components", | ||
"version": "0.4.10", | ||
"version": "0.5.0", | ||
"license": "UNLICENSED", | ||
@@ -5,0 +5,0 @@ "description": "Common components for Next projects", |
Sorry, the diff of this file is not supported yet
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
120693
1814