@bbob/plugin-helper
Advanced tools
Comparing version 2.3.2 to 2.4.0
@@ -6,2 +6,29 @@ # Change Log | ||
<a name="2.4.0"></a> | ||
# [2.4.0](https://github.com/JiLiZART/bbob/compare/v2.3.4...v2.4.0) (2019-03-29) | ||
### Features | ||
* **html:** [@bbob](https://github.com/bbob)/html now can be used without [@bbob](https://github.com/bbob)/core ([c9e1dab](https://github.com/JiLiZART/bbob/commit/c9e1dab)) | ||
<a name="2.3.4"></a> | ||
## [2.3.4](https://github.com/JiLiZART/bbob/compare/v2.3.2...v2.3.4) (2019-03-29) | ||
**Note:** Version bump only for package @bbob/plugin-helper | ||
<a name="2.3.3"></a> | ||
## [2.3.3](https://github.com/JiLiZART/bbob/compare/v2.3.2...v2.3.3) (2019-03-29) | ||
**Note:** Version bump only for package @bbob/plugin-helper | ||
<a name="2.3.2"></a> | ||
@@ -8,0 +35,0 @@ ## [2.3.2](https://github.com/JiLiZART/bbob/compare/v2.3.1...v2.3.2) (2019-03-09) |
@@ -31,2 +31,7 @@ (function (global, factory) { | ||
/** | ||
* Appends value to Tag Node | ||
* @param {TagNode} node | ||
* @param value | ||
*/ | ||
var appendToNode = function appendToNode(node, value) { | ||
@@ -36,2 +41,6 @@ node.content.push(value); | ||
/** | ||
* Replaces " to &qquot; | ||
* @param {String} value | ||
*/ | ||
var escapeQuote = function escapeQuote(value) { | ||
@@ -41,2 +50,8 @@ return value.replace(/"/g, '"'); | ||
/** | ||
* Acept name and value and return valid html5 attribute string | ||
* @param {String} name | ||
* @param {String} value | ||
* @return {string} | ||
*/ | ||
var attrValue = function attrValue(name, value) { | ||
@@ -63,2 +78,13 @@ var type = typeof value; | ||
/** | ||
* Transforms attrs to html params string | ||
* @param values | ||
*/ | ||
var attrsToString = function attrsToString(values) { | ||
return Object.keys(values).reduce(function (arr, key) { | ||
return [].concat(arr, [attrValue(key, values[key])]); | ||
}, ['']).join(' '); | ||
}; | ||
exports.attrsToString = attrsToString; | ||
exports.attrValue = attrValue; | ||
@@ -65,0 +91,0 @@ exports.appendToNode = appendToNode; |
@@ -1,1 +0,1 @@ | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(n.BbobPluginHelper={})}(this,function(n){"use strict";var e=function(n){return"object"==typeof n&&!!n.tag},o=function(n){return"string"==typeof n},r=function(n){return n.replace(/"/g,""")};n.attrValue=function(n,e){var t=typeof e,o={boolean:function(){return e?""+n:""},number:function(){return n+'="'+e+'"'},string:function(){return n+'="'+r(e)+'"'},object:function(){return n+'="'+r(JSON.stringify(e))+'"'}};return o[t]?o[t]():""},n.appendToNode=function(n,e){n.content.push(e)},n.getNodeLength=function t(n){return e(n)?n.content.reduce(function(n,e){return n+t(e)},0):o(n)?n.length:0},n.isTagNode=e,n.isStringNode=o,n.isEOL=function(n){return"\n"===n},Object.defineProperty(n,"__esModule",{value:!0})}); | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.BbobPluginHelper={})}(this,function(n){"use strict";var t=function(n){return"object"==typeof n&&!!n.tag},o=function(n){return"string"==typeof n},r=function(n){return n.replace(/"/g,""")},u=function(n,t){var e=typeof t,o={boolean:function(){return t?""+n:""},number:function(){return n+'="'+t+'"'},string:function(){return n+'="'+r(t)+'"'},object:function(){return n+'="'+r(JSON.stringify(t))+'"'}};return o[e]?o[e]():""};n.attrsToString=function(e){return Object.keys(e).reduce(function(n,t){return[].concat(n,[u(t,e[t])])},[""]).join(" ")},n.attrValue=u,n.appendToNode=function(n,t){n.content.push(t)},n.getNodeLength=function e(n){return t(n)?n.content.reduce(function(n,t){return n+e(t)},0):o(n)?n.length:0},n.isTagNode=t,n.isStringNode=o,n.isEOL=function(n){return"\n"===n},Object.defineProperty(n,"__esModule",{value:!0})}); |
@@ -25,2 +25,7 @@ import { N } from './char'; | ||
/** | ||
* Appends value to Tag Node | ||
* @param {TagNode} node | ||
* @param value | ||
*/ | ||
var appendToNode = function appendToNode(node, value) { | ||
@@ -30,2 +35,6 @@ node.content.push(value); | ||
/** | ||
* Replaces " to &qquot; | ||
* @param {String} value | ||
*/ | ||
var escapeQuote = function escapeQuote(value) { | ||
@@ -35,2 +44,8 @@ return value.replace(/"/g, '"'); | ||
/** | ||
* Acept name and value and return valid html5 attribute string | ||
* @param {String} name | ||
* @param {String} value | ||
* @return {string} | ||
*/ | ||
var attrValue = function attrValue(name, value) { | ||
@@ -57,2 +72,12 @@ var type = typeof value; | ||
export { attrValue, appendToNode, getNodeLength, isTagNode, isStringNode, isEOL }; | ||
/** | ||
* Transforms attrs to html params string | ||
* @param values | ||
*/ | ||
var attrsToString = function attrsToString(values) { | ||
return Object.keys(values).reduce(function (arr, key) { | ||
return [].concat(arr, [attrValue(key, values[key])]); | ||
}, ['']).join(' '); | ||
}; | ||
export { attrsToString, attrValue, appendToNode, getNodeLength, isTagNode, isStringNode, isEOL }; |
'use strict'; | ||
exports.__esModule = true; | ||
exports.isEOL = exports.isStringNode = exports.isTagNode = exports.getNodeLength = exports.appendToNode = exports.attrValue = undefined; | ||
exports.isEOL = exports.isStringNode = exports.isTagNode = exports.getNodeLength = exports.appendToNode = exports.attrValue = exports.attrsToString = undefined; | ||
@@ -30,2 +30,7 @@ var _char = require('./char'); | ||
/** | ||
* Appends value to Tag Node | ||
* @param {TagNode} node | ||
* @param value | ||
*/ | ||
var appendToNode = function appendToNode(node, value) { | ||
@@ -35,2 +40,6 @@ node.content.push(value); | ||
/** | ||
* Replaces " to &qquot; | ||
* @param {String} value | ||
*/ | ||
var escapeQuote = function escapeQuote(value) { | ||
@@ -40,2 +49,8 @@ return value.replace(/"/g, '"'); | ||
/** | ||
* Acept name and value and return valid html5 attribute string | ||
* @param {String} name | ||
* @param {String} value | ||
* @return {string} | ||
*/ | ||
var attrValue = function attrValue(name, value) { | ||
@@ -62,2 +77,13 @@ var type = typeof value; | ||
/** | ||
* Transforms attrs to html params string | ||
* @param values | ||
*/ | ||
var attrsToString = function attrsToString(values) { | ||
return Object.keys(values).reduce(function (arr, key) { | ||
return [].concat(arr, [attrValue(key, values[key])]); | ||
}, ['']).join(' '); | ||
}; | ||
exports.attrsToString = attrsToString; | ||
exports.attrValue = attrValue; | ||
@@ -64,0 +90,0 @@ exports.appendToNode = appendToNode; |
{ | ||
"name": "@bbob/plugin-helper", | ||
"version": "2.3.2", | ||
"description": "Set of utils to help write plugins for @bbob bbcode parser", | ||
"version": "2.4.0", | ||
"description": "Set of utils to help write plugins for @bbob/core", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "bbob", |
@@ -17,2 +17,7 @@ import { N } from './char'; | ||
/** | ||
* Appends value to Tag Node | ||
* @param {TagNode} node | ||
* @param value | ||
*/ | ||
const appendToNode = (node, value) => { | ||
@@ -22,4 +27,14 @@ node.content.push(value); | ||
/** | ||
* Replaces " to &qquot; | ||
* @param {String} value | ||
*/ | ||
const escapeQuote = value => value.replace(/"/g, '"'); | ||
/** | ||
* Acept name and value and return valid html5 attribute string | ||
* @param {String} name | ||
* @param {String} value | ||
* @return {string} | ||
*/ | ||
const attrValue = (name, value) => { | ||
@@ -38,3 +53,13 @@ const type = typeof value; | ||
/** | ||
* Transforms attrs to html params string | ||
* @param values | ||
*/ | ||
const attrsToString = values => | ||
Object.keys(values) | ||
.reduce((arr, key) => [...arr, attrValue(key, values[key])], ['']) | ||
.join(' '); | ||
export { | ||
attrsToString, | ||
attrValue, | ||
@@ -41,0 +66,0 @@ appendToNode, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19066
483