mirror of
https://github.com/Shiva108/ai-llm-red-team-handbook.git
synced 2026-08-28 22:00:37 +02:00
adding mermaid packages
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
const TAB = ' ';
|
||||
const SIZE_PROPS = key => /(width|height|background\-size)/g.test(key);
|
||||
const PROP_VALUE = (size, key) => (key === 'background-size') ?
|
||||
`${size.width}px ${size.height}px`
|
||||
: `${size[key]}px`;
|
||||
const PROP_SIZE = (size, key) => `${TAB}${key}: ${PROP_VALUE(size, key)};`;
|
||||
const BASE_CSS = (data) => [
|
||||
'',
|
||||
`.${data.class.replace(/\s+/gi, '_')} {`,
|
||||
`${TAB}background-image: url('${data.background}');`
|
||||
];
|
||||
const SIZE = data => Object.keys(data).filter(SIZE_PROPS).map(PROP_SIZE.bind(null, data.dimensions));
|
||||
module.exports = data => BASE_CSS(data).concat(SIZE(data), ['}']).join('\n');
|
||||
Reference in New Issue
Block a user