@ekino/rendr-core
Advanced tools
Comparing version 0.0.5 to 0.0.6
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
function __export(m) { | ||
@@ -12,2 +23,3 @@ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
__export(require("./types")); | ||
__export(require("./errors")); | ||
function isObject(data) { | ||
@@ -100,7 +112,8 @@ return data !== null && typeof data === "object"; | ||
page.template = "template" in data ? data.template : "default"; | ||
page.id = "id" in data ? data.template : "id"; | ||
page.id = "id" in data ? data.id : "id"; | ||
page.cache = normalizeCache(data.cache); | ||
page.head = normalizeHead(data.head); | ||
page.blocks = normalizeBlockDefinitions(data.blocks); | ||
page.settings = "settings" in data ? data.settings : []; | ||
page.settings = "settings" in data && isObject(data.settings) ? data.settings : {}; | ||
page.path = "path" in data ? data.path : ""; | ||
return page; | ||
@@ -114,2 +127,3 @@ } | ||
var ctx = { | ||
hostname: url.hostname, | ||
pathname: url.pathname, | ||
@@ -127,2 +141,25 @@ query: url.query, | ||
exports.createContext = createContext; | ||
function mergePages(pages) { | ||
var page = new types_1.Page(); | ||
pages.forEach(function (p) { | ||
page.cache.ttl = p.cache.ttl; | ||
page.head = { | ||
titleTemplate: p.head.titleTemplate.length > 0 ? p.head.titleTemplate : page.head.titleTemplate, | ||
defaultTitle: p.head.defaultTitle.length > 0 ? p.head.defaultTitle : page.head.defaultTitle, | ||
title: p.head.title.length > 0 ? p.head.title : page.head.title, | ||
link: p.head.link.length > 0 ? p.head.link : page.head.link, | ||
htmlAttributes: Object.keys(p.head.htmlAttributes).length > 0 ? p.head.htmlAttributes : page.head.htmlAttributes, | ||
meta: page.head.meta.concat(p.head.meta), | ||
}; | ||
page.path = p.path; | ||
page.template = p.template.length > 0 ? p.template : page.template; | ||
page.type = p.type.length > 0 ? p.type : page.type; | ||
page.id = p.id; | ||
page.statusCode = p.statusCode; | ||
page.settings = __assign({}, page.settings, p.settings); | ||
page.blocks = page.blocks.concat(p.blocks); | ||
}); | ||
return page; | ||
} | ||
exports.mergePages = mergePages; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@ekino/rendr-core", | ||
"license": "MIT", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"main": "dist/lib/index.js", | ||
@@ -25,3 +25,3 @@ "typing": "dist/lib/index.d.ts", | ||
}, | ||
"gitHead": "e0cc2f1ec7ac893f0c887530133a801be4cc225f" | ||
"gitHead": "f076cb1668c97b27aa696a5c1bf6a0c35cb1c850" | ||
} |
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
7379
4
160
1
16