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

feat(plugin-helper): move getUniqAttr from preset to plugin helper (#63)

This commit is contained in:
Nikolay Kostyurin
2020-04-12 16:18:47 +02:00
committed by GitHub
parent 2cfe729d75
commit f28f19e64c
3 changed files with 24 additions and 7 deletions
+12
View File
@@ -63,11 +63,23 @@ const attrsToString = (values) => {
.join(' ');
};
/**
* Gets value from
* @example
* getUniqAttr({ 'foo': true, 'bar': bar' }) => 'bar'
* @param attrs
* @returns {string}
*/
const getUniqAttr = (attrs) => Object
.keys(attrs)
.reduce((res, key) => (attrs[key] === key ? attrs[key] : null), null);
export {
attrsToString,
attrValue,
appendToNode,
getNodeLength,
getUniqAttr,
isTagNode,
isStringNode,
isEOL,