mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-17 19:21:20 +03:00
feat(*): react render support, move some helper functions to plugin-helper
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user