2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-17 19:21:20 +03:00

fix: remove useless optimizations

This commit is contained in:
Nikolay Kostyurin
2021-10-17 21:31:21 +02:00
parent 2ee5141d8e
commit 0c92d2bb3e
@@ -2,14 +2,14 @@
import { getUniqAttr, isStringNode, isTagNode } from '@bbob/plugin-helper/lib/index'; import { getUniqAttr, isStringNode, isTagNode } from '@bbob/plugin-helper/lib/index';
import TagNode from '@bbob/plugin-helper/lib/TagNode'; import TagNode from '@bbob/plugin-helper/lib/TagNode';
/* @__PURE__ */const isStartsWith = (node, type) => (node[0] === type); const isStartsWith = (node, type) => (node[0] === type);
const styleMap = { const styleMap = {
color: (val) => `color:${val};`, color: (val) => `color:${val};`,
size: (val) => `font-size:${val};`, size: (val) => `font-size:${val};`,
}; };
/* @__PURE__ */const getStyleFromAttrs = (attrs) => Object const getStyleFromAttrs = (attrs) => Object
.keys(attrs) .keys(attrs)
.reduce((acc, key) => (styleMap[key] ? acc.concat(styleMap[key](attrs[key])) : acc), []) .reduce((acc, key) => (styleMap[key] ? acc.concat(styleMap[key](attrs[key])) : acc), [])
.join(' '); .join(' ');
@@ -59,13 +59,13 @@ const renderUrl = (node, render) => (getUniqAttr(node.attrs)
? getUniqAttr(node.attrs) ? getUniqAttr(node.attrs)
: render(node.content)); : render(node.content));
/* @__PURE__ */const toNode = (tag, attrs, content) => ({ const toNode = (tag, attrs, content) => ({
tag, tag,
attrs, attrs,
content, content,
}); });
/* @__PURE__ */const toStyle = (style) => ({ style }); const toStyle = (style) => ({ style });
export default { export default {
b: (node) => toNode('span', toStyle('font-weight: bold;'), node.content), b: (node) => toNode('span', toStyle('font-weight: bold;'), node.content),