2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-14 18:42:24 +03:00

feat(*): react render support, move some helper functions to plugin-helper

This commit is contained in:
Nikolay Kostyurin
2018-08-09 02:45:19 +02:00
parent 846d93a2a4
commit 1a84968ea2
20 changed files with 471 additions and 169 deletions
+1 -16
View File
@@ -1,19 +1,4 @@
function escapeQuote(value) {
return value.replace(/"/g, '"');
}
function attrValue(name, value) {
const type = typeof value;
const types = {
boolean: () => (value ? `${name}` : ''),
number: () => `${name}="${value}"`,
string: () => `${name}="${escapeQuote(value)}"`,
object: () => `${name}="${escapeQuote(JSON.stringify(value))}"`,
};
return types[type] ? types[type]() : '';
}
const { attrValue } = require('@bbob/plugin-helper');
/**
* Transforms attrs to html params string
+3
View File
@@ -3,6 +3,9 @@
"version": "1.0.7",
"description": "HTML renderer for BBCode pareser BBob",
"main": "lib/index.js",
"dependencies": {
"@bbob/plugin-helper": "^1.0.0"
},
"devDependencies": {
"@bbob/parser": "^1.1.0"
},