Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bbob/html

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bbob/html - npm Package Compare versions

Comparing version 2.5.7 to 2.5.8

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [2.5.8](https://github.com/JiLiZART/bbob/compare/v2.5.7...v2.5.8) (2020-07-08)
**Note:** Version bump only for package @bbob/html
## [2.5.7](https://github.com/JiLiZART/bbob/compare/v2.5.6...v2.5.7) (2020-07-05)

@@ -8,0 +16,0 @@

4

dist/index.js

@@ -141,3 +141,3 @@ (function (global, factory) {

return value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;') // eslint-disable-next-line no-script-url
.replace('javascript:', 'javascript%3A');
.replace(/(javascript):/gi, '$1%3A');
};

@@ -466,3 +466,3 @@ /**

return value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;') // eslint-disable-next-line no-script-url
.replace('javascript:', 'javascript%3A');
.replace(/(javascript):/gi, '$1%3A');
};

@@ -469,0 +469,0 @@ /**

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).BbobHtml={})}(this,(function(t){"use strict";function e(){return(e=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function r(t,e){return t(e={exports:{}},e.exports),e.exports}var o=r((function(t,e){e.__esModule=!0,e.BACKSLASH=e.PLACEHOLDER_SPACE=e.PLACEHOLDER_SPACE_TAB=e.SLASH=e.CLOSE_BRAKET=e.OPEN_BRAKET=e.SPACE=e.QUOTEMARK=e.EQ=e.TAB=e.R=e.F=e.N=void 0;e.N="\n";e.TAB="\t";e.F="\f";e.R="\r";e.EQ="=";e.QUOTEMARK='"';e.SPACE=" ";e.OPEN_BRAKET="[";e.CLOSE_BRAKET="]";e.SLASH="/";e.BACKSLASH="\\";e.PLACEHOLDER_SPACE_TAB=" ";e.PLACEHOLDER_SPACE=" "}));n(o);var i=r((function(t,e){e.__esModule=!0,e.isEOL=e.isStringNode=e.isTagNode=e.getUniqAttr=e.getNodeLength=e.escapeHTML=e.appendToNode=e.attrValue=e.attrsToString=void 0;var n=function(t){return"object"==typeof t&&!!t.tag};e.isTagNode=n;var r=function(t){return"string"==typeof t};e.isStringNode=r;e.isEOL=function(t){return t===o.N};e.getNodeLength=function t(e){return n(e)?e.content.reduce((function(e,n){return e+t(n)}),0):r(e)?e.length:0};e.appendToNode=function(t,e){t.content.push(e)};var i=function(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace("javascript:","javascript%3A")};e.escapeHTML=i;var u=function(t,e){var n=typeof e,r={boolean:function(){return e?""+t:""},number:function(){return t+'="'+e+'"'},string:function(){return t+'="'+i(e)+'"'},object:function(){return t+'="'+i(JSON.stringify(e))+'"'}};return r[n]?r[n]():""};e.attrValue=u;e.attrsToString=function(t){return void 0===t?"":Object.keys(t).reduce((function(e,n){return[].concat(e,[u(n,t[n])])}),[""]).join(" ")};e.getUniqAttr=function(t){return Object.keys(t).reduce((function(e,n){return t[n]===n?t[n]:null}),null)}}));n(i);var u=r((function(t,e){function n(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function r(){return(r=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}e.__esModule=!0,e.default=e.TagNode=void 0;var u=function(){function t(t,e,n){this.tag=t,this.attrs=e,this.content=[].concat(n)}var e,u,a,s=t.prototype;return s.attr=function(t,e){return void 0!==e&&(this.attrs[t]=e),this.attrs[t]},s.append=function(t){return(0,i.appendToNode)(this,t)},s.toTagNode=function(){return new t(this.tag.toLowerCase(),this.attrs,this.content)},s.toString=function(){var t=o.OPEN_BRAKET,e=o.CLOSE_BRAKET,n=0===this.content.length,u=this.content.reduce((function(t,e){return t+""+e}),""),a=function(t,e){var n=(0,i.getUniqAttr)(e);if(n){var o=(0,i.attrValue)(t,n),u=r({},e);return delete u[n],""+o+(0,i.attrsToString)(u)}return""+t+(0,i.attrsToString)(e)}(this.tag,this.attrs);return n?""+t+a+e:""+t+a+e+u+t+o.SLASH+this.tag+e},e=t,(u=[{key:"length",get:function(){return(0,i.getNodeLength)(this)}}])&&n(e.prototype,u),a&&n(e,a),t}();e.TagNode=u,u.create=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n=[]),new u(t,e,n)},u.isOf=function(t,e){return t.tag===e},e.default=u}));n(u);var a=r((function(t,e){e.__esModule=!0,e.BACKSLASH=e.PLACEHOLDER_SPACE=e.PLACEHOLDER_SPACE_TAB=e.SLASH=e.CLOSE_BRAKET=e.OPEN_BRAKET=e.SPACE=e.QUOTEMARK=e.EQ=e.TAB=e.R=e.F=e.N=void 0;e.N="\n";e.TAB="\t";e.F="\f";e.R="\r";e.EQ="=";e.QUOTEMARK='"';e.SPACE=" ";e.OPEN_BRAKET="[";e.CLOSE_BRAKET="]";e.SLASH="/";e.BACKSLASH="\\";e.PLACEHOLDER_SPACE_TAB=" ";e.PLACEHOLDER_SPACE=" "}));n(a);var s=r((function(t,e){e.__esModule=!0,e.isEOL=e.isStringNode=e.isTagNode=e.getUniqAttr=e.getNodeLength=e.escapeHTML=e.appendToNode=e.attrValue=e.attrsToString=void 0;var n=function(t){return"object"==typeof t&&!!t.tag};e.isTagNode=n;var r=function(t){return"string"==typeof t};e.isStringNode=r;e.isEOL=function(t){return t===a.N};e.getNodeLength=function t(e){return n(e)?e.content.reduce((function(e,n){return e+t(n)}),0):r(e)?e.length:0};e.appendToNode=function(t,e){t.content.push(e)};var o=function(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace("javascript:","javascript%3A")};e.escapeHTML=o;var i=function(t,e){var n=typeof e,r={boolean:function(){return e?""+t:""},number:function(){return t+'="'+e+'"'},string:function(){return t+'="'+o(e)+'"'},object:function(){return t+'="'+o(JSON.stringify(e))+'"'}};return r[n]?r[n]():""};e.attrValue=i;e.attrsToString=function(t){return void 0===t?"":Object.keys(t).reduce((function(e,n){return[].concat(e,[i(n,t[n])])}),[""]).join(" ")};e.getUniqAttr=function(t){return Object.keys(t).reduce((function(e,n){return t[n]===n?t[n]:null}),null)}}));n(s);var c=s.attrsToString,f=r((function(t,e){e.__esModule=!0,e.default=e.Token=e.TYPE_NEW_LINE=e.TYPE_SPACE=e.TYPE_ATTR_VALUE=e.TYPE_ATTR_NAME=e.TYPE_TAG=e.TYPE_WORD=e.COLUMN_ID=e.LINE_ID=e.VALUE_ID=e.TYPE_ID=void 0;var n=function(t){return t&&void 0!==t.value?t.value:""},r=function(t){return n(t).charCodeAt(0)===o.SLASH.charCodeAt(0)},i=function(){function t(t,e,n,r){this.type=t+"",this.value=e+"",this.line=Number(n),this.row=Number(r)}var e=t.prototype;return e.isEmpty=function(){return!!this.type},e.isText=function(){return!(!(t=this)||void 0===t.type||"space"!==t.type&&"new-line"!==t.type&&"word"!==t.type);var t},e.isTag=function(){return!(!(t=this)||void 0===t.type)&&"tag"===t.type;var t},e.isAttrName=function(){return!(!(t=this)||void 0===t.type)&&"attr-name"===t.type;var t},e.isAttrValue=function(){return!(!(t=this)||void 0===t.type)&&"attr-value"===t.type;var t},e.isStart=function(){return!r(this)},e.isEnd=function(){return r(this)},e.getName=function(){return e=n(t=this),r(t)?e.slice(1):e;var t,e},e.getValue=function(){return n(this)},e.getLine=function(){return(t=this)&&t.line||0;var t},e.getColumn=function(){return(t=this)&&t.row||0;var t},e.toString=function(){return t=o.OPEN_BRAKET,t+=n(this),t+=o.CLOSE_BRAKET;var t},t}();e.Token=i;e.TYPE_ID="type";e.VALUE_ID="value";e.LINE_ID="line";e.COLUMN_ID="row";e.TYPE_WORD="word";e.TYPE_TAG="tag";e.TYPE_ATTR_NAME="attr-name";e.TYPE_ATTR_VALUE="attr-value";e.TYPE_SPACE="space";e.TYPE_NEW_LINE="new-line",e.default=i}));n(f);var l=r((function(t,e){e.__esModule=!0,e.createList=e.unquote=e.trimChar=e.createCharGrabber=void 0;e.createCharGrabber=function(t,e){var n={pos:0,length:t.length},r=function(){n.pos+=1,e&&e.onSkip&&e.onSkip()},o=function(){return n.length>n.pos},i=function(){return t.substr(n.pos)},u=function(){return t[n.pos]};return{skip:r,hasNext:o,isLast:function(){return n.pos===n.length},grabWhile:function(e){var i=0;if(o())for(i=n.pos;o()&&e(u());)r();return t.substr(i,n.pos-i)},getNext:function(){var e=n.pos+1;return e>t.length-1?null:t[e]},getPrev:function(){var e=n.pos-1;return void 0!==t[e]?t[e]:null},getCurr:u,getRest:i,substrUntilChar:function(t){var e=i(),n=e.indexOf(t);return 0>n?"":e.substr(0,n)}}};e.trimChar=function(t,e){for(;t.charAt(0)===e;)t=t.substring(1);for(;t.charAt(t.length-1)===e;)t=t.substring(0,t.length-1);return t};e.unquote=function(t){return t.replace(o.BACKSLASH+o.QUOTEMARK,o.QUOTEMARK)};e.createList=function(t){void 0===t&&(t=[]);var e=t;return{getLast:function(){return Array.isArray(e)&&e.length>0&&void 0!==e[e.length-1]?e[e.length-1]:null},flushLast:function(){return!!e.length&&e.pop()},push:function(t){return e.push(t)},toArray:function(){return e}}}}));n(l);var p=r((function(t,e){e.__esModule=!0,e.createLexer=function(t,e){void 0===e&&(e={});var r=0,i=0,u=-1,a=Array(Math.floor(t.length)),s=e.openTag||o.OPEN_BRAKET,c=e.closeTag||o.CLOSE_BRAKET,p=e.enableEscapeTags,g=[c,s,o.QUOTEMARK,o.BACKSLASH,o.SPACE,o.TAB,o.EQ,o.N,"!"],d=[s,o.SPACE,o.TAB,o.N],A=[o.SPACE,o.TAB],T=[o.EQ,o.SPACE,o.TAB],E=function(t){return A.indexOf(t)>=0},v=function(t){return-1===d.indexOf(t)},h=function(t){return t===s||t===c||t===o.BACKSLASH},_=function(t){return t===o.BACKSLASH},y=function(t){e.onToken&&e.onToken(t),a[u+=1]=t},L=function(t){for(var e=null,u=!1,a=[],s=(0,l.createCharGrabber)(t),c=function(t){var n=t===o.EQ,r=E(t),i=s.getPrev(),a=s.getNext(),c=i===o.BACKSLASH;return null===e?!1===(n||r||s.isLast()):!(!u||!function(t){return T.indexOf(t)>=0}(t))||!!(t!==o.QUOTEMARK||c||(u=!u)||a===o.EQ||E(a))&&!1===(n||r)},p=function(){var t=s.grabWhile(c),u=s.getCurr();if(null===e)e=t;else if(E(u)||u===o.QUOTEMARK||!s.hasNext()){var p=(0,l.unquote)((0,l.trimChar)(t,o.QUOTEMARK));a.push(n(f.TYPE_ATTR_VALUE,p,r,i))}else a.push(n(f.TYPE_ATTR_NAME,t,r,i));s.skip()};s.hasNext();)p();return{tag:e,attrs:a}},O=(0,l.createCharGrabber)(t,{onSkip:function(){i++}}),S=function(){var t=O.getCurr(),e=O.getNext();if(t===o.N)O.skip(),r++,y(n(f.TYPE_NEW_LINE,t,r,i=0));else if(E(t)){var u=O.grabWhile(E);y(n(f.TYPE_SPACE,u,r,i))}else if(p&&_(t)&&h(e))O.skip(),O.skip(),y(n(f.TYPE_WORD,e,r,i));else if(t===s){O.skip();var a=O.substrUntilChar(c),l=0===a.length||a.indexOf(s)>=0;if(g.indexOf(e)>=0||l||O.isLast())y(n(f.TYPE_WORD,t,r,i));else{var d=O.grabWhile((function(t){return t!==c}));if(O.skip(),-1===d.indexOf(o.EQ)||d[0]===o.SLASH)y(n(f.TYPE_TAG,d,r,i));else{var A=L(d);y(n(f.TYPE_TAG,A.tag,r,i)),A.attrs.map(y)}}}else if(t===c)O.skip(),y(n(f.TYPE_WORD,t,r,i));else if(v(t))if(p&&_(t)&&!h(e))O.skip(),y(n(f.TYPE_WORD,t,r,i));else{var T=O.grabWhile((function(t){return p?v(t)&&!_(t):v(t)}));y(n(f.TYPE_WORD,T,r,i))}};return{tokenize:function(){for(;O.hasNext();)S();return a.length=u+1,a},isTokenNested:function(e){var n=s+o.SLASH+e.getValue();return t.indexOf(n)>-1}}},e.createTokenOfType=void 0;var n=function(t,e,n,r){return void 0===n&&(n=0),void 0===r&&(r=0),new f.Token(t,e,n,r)};e.createTokenOfType=n}));n(p);var g=r((function(t,e){e.__esModule=!0,e.default=e.parse=void 0;var n,r=(n=u)&&n.__esModule?n:{default:n};var o=function(t,e){void 0===e&&(e={});var n=e,o=null,i=(0,l.createList)(),u=(0,l.createList)(),a=(0,l.createList)(),c=(0,l.createList)(),f={},g=function(){a.flushLast()&&c.flushLast()},d=function(t){var e,r,o=(e=u.getLast())&&Array.isArray(e.content)?e.content:i.toArray();Array.isArray(o)&&((0,s.isTagNode)(t)?(r=t.tag,n.onlyAllowTags&&n.onlyAllowTags.length&&0>n.onlyAllowTags.indexOf(r)?o.push(""+t):o.push(t.toTagNode())):o.push(t))},A=function(t){g();var e=r.default.create(t.getValue()),n=function(t){return void 0===f[t.getValue()]&&(f[t.getValue()]=o.isTokenNested(t)),f[t.getValue()]}(t);a.push(e),n?u.push(e):d(e)},T=function(t){t.isStart()&&A(t),t.isEnd()&&function(t){g();var e=u.flushLast();if(e)d(e);else if("function"==typeof n.onError){var r=t.getValue(),o=t.getLine(),i=t.getColumn();n.onError({message:"Inconsistent tag '"+r+"' on line "+o+" and column "+i,tagName:r,lineNumber:o,columnNumber:i})}}(t)},E=function(t){var e=a.getLast(),n=t.getValue(),r=!!f[t];if(e)if(t.isAttrName())c.push(n),e.attr(c.getLast(),"");else if(t.isAttrValue()){var o=c.getLast();o?(e.attr(o,n),c.flushLast()):e.attr(n,n)}else t.isText()?r?e.append(n):d(n):t.isTag()&&d(""+t);else t.isText()?d(n):t.isTag()&&d(""+t)};(o=(e.createTokenizer?e.createTokenizer:p.createLexer)(t,{onToken:function(t){t.isTag()?T(t):E(t)},onlyAllowTags:n.onlyAllowTags,openTag:n.openTag,closeTag:n.closeTag,enableEscapeTags:n.enableEscapeTags})).tokenize();return i.toArray()};e.parse=o,e.default=o}));n(g);var d=r((function(t,e){e.__esModule=!0,e.TagNode=e.parse=e.default=void 0;var n=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var e=r();if(e&&e.has(t))return e.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var u=o?Object.getOwnPropertyDescriptor(t,i):null;u&&(u.get||u.set)?Object.defineProperty(n,i,u):n[i]=t[i]}n.default=t,e&&e.set(t,n);return n}(g);function r(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return r=function(){return t},t}e.default=n.default,e.parse=n.parse,e.TagNode=u.TagNode}));n(d);var A=r((function(t,e){e.__esModule=!0,e.iterate=r,e.match=function(t,e){return r(this,Array.isArray(t)?function(n){for(var r=0;t.length>r;r++)if(o(t[r],n))return e(n);return n}:function(n){return o(t,n)?e(n):n})};var n=function(t){return"object"==typeof t};function r(t,e){var o=t;if(Array.isArray(o))for(var i=0;o.length>i;i++)o[i]=r(e(o[i]),e);else o&&n(o)&&o.content&&r(o.content,e);return o}function o(t,e){return typeof t==typeof e&&(n(t)&&null!==t?Array.isArray(t)?t.every((function(t){return[].some.call(e,(function(e){return o(t,e)}))})):Object.keys(t).every((function(r){var i=e[r],u=t[r];return n(u)&&null!==u&&null!==i?o(u,i):"boolean"==typeof u?u!==(null===i):i===u})):t===e)}}));n(A);var T=n(r((function(t,e){function n(t){return(0,A.iterate)(this,t)}e.__esModule=!0,e.default=function(t){var e="function"==typeof t?[t]:t||[],r={skipParse:!1};return{process:function(t,o){var i=(r=o||{}).parser||d.parse,u=r.render,a=r.data||null;if("function"!=typeof i)throw Error('"parser" is not a function, please pass to "process(input, { parser })" right function');var s=r.skipParse?t||[]:i(t,r),c=s;return s.messages=[],s.options=r,s.walk=n,s.match=A.match,e.forEach((function(t){s=t(s,{parse:i,render:u,iterate:A.iterate,match:A.match,data:a})||s})),{get html(){if("function"!=typeof u)throw Error('"render" function not defined, please pass to "process(input, { render })"');return u(s,s.options)},tree:s,raw:c,messages:s.messages}}}}}))),E="/>",v="</",h="<",_=">",y=function(t,e){var n=e.stripTags,r=void 0!==n&&n;if(!t)return"";var o=typeof t;return"string"===o||"number"===o?t:"object"===o?!0===r?L(t.content,{stripTags:r}):null===t.content?""+h+t.tag+c(t.attrs)+E:""+h+t.tag+c(t.attrs)+_+L(t.content)+v+t.tag+_:Array.isArray(t)?L(t,{stripTags:r}):""},L=function(t,e){var n=(void 0===e?{}:e).stripTags,r=void 0!==n&&n;return[].concat(t).reduce((function(t,e){return t+y(e,{stripTags:r})}),"")},O=L;t.default=function(t,n,r){return T(n).process(t,e({},r,{render:L})).html},t.render=O,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).BbobHtml={})}(this,(function(t){"use strict";function e(){return(e=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function r(t,e){return t(e={exports:{}},e.exports),e.exports}var o=r((function(t,e){e.__esModule=!0,e.BACKSLASH=e.PLACEHOLDER_SPACE=e.PLACEHOLDER_SPACE_TAB=e.SLASH=e.CLOSE_BRAKET=e.OPEN_BRAKET=e.SPACE=e.QUOTEMARK=e.EQ=e.TAB=e.R=e.F=e.N=void 0;e.N="\n";e.TAB="\t";e.F="\f";e.R="\r";e.EQ="=";e.QUOTEMARK='"';e.SPACE=" ";e.OPEN_BRAKET="[";e.CLOSE_BRAKET="]";e.SLASH="/";e.BACKSLASH="\\";e.PLACEHOLDER_SPACE_TAB=" ";e.PLACEHOLDER_SPACE=" "}));n(o);var i=r((function(t,e){e.__esModule=!0,e.isEOL=e.isStringNode=e.isTagNode=e.getUniqAttr=e.getNodeLength=e.escapeHTML=e.appendToNode=e.attrValue=e.attrsToString=void 0;var n=function(t){return"object"==typeof t&&!!t.tag};e.isTagNode=n;var r=function(t){return"string"==typeof t};e.isStringNode=r;e.isEOL=function(t){return t===o.N};e.getNodeLength=function t(e){return n(e)?e.content.reduce((function(e,n){return e+t(n)}),0):r(e)?e.length:0};e.appendToNode=function(t,e){t.content.push(e)};var i=function(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/(javascript):/gi,"$1%3A")};e.escapeHTML=i;var u=function(t,e){var n=typeof e,r={boolean:function(){return e?""+t:""},number:function(){return t+'="'+e+'"'},string:function(){return t+'="'+i(e)+'"'},object:function(){return t+'="'+i(JSON.stringify(e))+'"'}};return r[n]?r[n]():""};e.attrValue=u;e.attrsToString=function(t){return void 0===t?"":Object.keys(t).reduce((function(e,n){return[].concat(e,[u(n,t[n])])}),[""]).join(" ")};e.getUniqAttr=function(t){return Object.keys(t).reduce((function(e,n){return t[n]===n?t[n]:null}),null)}}));n(i);var u=r((function(t,e){function n(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function r(){return(r=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}e.__esModule=!0,e.default=e.TagNode=void 0;var u=function(){function t(t,e,n){this.tag=t,this.attrs=e,this.content=[].concat(n)}var e,u,a,s=t.prototype;return s.attr=function(t,e){return void 0!==e&&(this.attrs[t]=e),this.attrs[t]},s.append=function(t){return(0,i.appendToNode)(this,t)},s.toTagNode=function(){return new t(this.tag.toLowerCase(),this.attrs,this.content)},s.toString=function(){var t=o.OPEN_BRAKET,e=o.CLOSE_BRAKET,n=0===this.content.length,u=this.content.reduce((function(t,e){return t+""+e}),""),a=function(t,e){var n=(0,i.getUniqAttr)(e);if(n){var o=(0,i.attrValue)(t,n),u=r({},e);return delete u[n],""+o+(0,i.attrsToString)(u)}return""+t+(0,i.attrsToString)(e)}(this.tag,this.attrs);return n?""+t+a+e:""+t+a+e+u+t+o.SLASH+this.tag+e},e=t,(u=[{key:"length",get:function(){return(0,i.getNodeLength)(this)}}])&&n(e.prototype,u),a&&n(e,a),t}();e.TagNode=u,u.create=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n=[]),new u(t,e,n)},u.isOf=function(t,e){return t.tag===e},e.default=u}));n(u);var a=r((function(t,e){e.__esModule=!0,e.BACKSLASH=e.PLACEHOLDER_SPACE=e.PLACEHOLDER_SPACE_TAB=e.SLASH=e.CLOSE_BRAKET=e.OPEN_BRAKET=e.SPACE=e.QUOTEMARK=e.EQ=e.TAB=e.R=e.F=e.N=void 0;e.N="\n";e.TAB="\t";e.F="\f";e.R="\r";e.EQ="=";e.QUOTEMARK='"';e.SPACE=" ";e.OPEN_BRAKET="[";e.CLOSE_BRAKET="]";e.SLASH="/";e.BACKSLASH="\\";e.PLACEHOLDER_SPACE_TAB=" ";e.PLACEHOLDER_SPACE=" "}));n(a);var s=r((function(t,e){e.__esModule=!0,e.isEOL=e.isStringNode=e.isTagNode=e.getUniqAttr=e.getNodeLength=e.escapeHTML=e.appendToNode=e.attrValue=e.attrsToString=void 0;var n=function(t){return"object"==typeof t&&!!t.tag};e.isTagNode=n;var r=function(t){return"string"==typeof t};e.isStringNode=r;e.isEOL=function(t){return t===a.N};e.getNodeLength=function t(e){return n(e)?e.content.reduce((function(e,n){return e+t(n)}),0):r(e)?e.length:0};e.appendToNode=function(t,e){t.content.push(e)};var o=function(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/(javascript):/gi,"$1%3A")};e.escapeHTML=o;var i=function(t,e){var n=typeof e,r={boolean:function(){return e?""+t:""},number:function(){return t+'="'+e+'"'},string:function(){return t+'="'+o(e)+'"'},object:function(){return t+'="'+o(JSON.stringify(e))+'"'}};return r[n]?r[n]():""};e.attrValue=i;e.attrsToString=function(t){return void 0===t?"":Object.keys(t).reduce((function(e,n){return[].concat(e,[i(n,t[n])])}),[""]).join(" ")};e.getUniqAttr=function(t){return Object.keys(t).reduce((function(e,n){return t[n]===n?t[n]:null}),null)}}));n(s);var c=s.attrsToString,f=r((function(t,e){e.__esModule=!0,e.default=e.Token=e.TYPE_NEW_LINE=e.TYPE_SPACE=e.TYPE_ATTR_VALUE=e.TYPE_ATTR_NAME=e.TYPE_TAG=e.TYPE_WORD=e.COLUMN_ID=e.LINE_ID=e.VALUE_ID=e.TYPE_ID=void 0;var n=function(t){return t&&void 0!==t.value?t.value:""},r=function(t){return n(t).charCodeAt(0)===o.SLASH.charCodeAt(0)},i=function(){function t(t,e,n,r){this.type=t+"",this.value=e+"",this.line=Number(n),this.row=Number(r)}var e=t.prototype;return e.isEmpty=function(){return!!this.type},e.isText=function(){return!(!(t=this)||void 0===t.type||"space"!==t.type&&"new-line"!==t.type&&"word"!==t.type);var t},e.isTag=function(){return!(!(t=this)||void 0===t.type)&&"tag"===t.type;var t},e.isAttrName=function(){return!(!(t=this)||void 0===t.type)&&"attr-name"===t.type;var t},e.isAttrValue=function(){return!(!(t=this)||void 0===t.type)&&"attr-value"===t.type;var t},e.isStart=function(){return!r(this)},e.isEnd=function(){return r(this)},e.getName=function(){return e=n(t=this),r(t)?e.slice(1):e;var t,e},e.getValue=function(){return n(this)},e.getLine=function(){return(t=this)&&t.line||0;var t},e.getColumn=function(){return(t=this)&&t.row||0;var t},e.toString=function(){return t=o.OPEN_BRAKET,t+=n(this),t+=o.CLOSE_BRAKET;var t},t}();e.Token=i;e.TYPE_ID="type";e.VALUE_ID="value";e.LINE_ID="line";e.COLUMN_ID="row";e.TYPE_WORD="word";e.TYPE_TAG="tag";e.TYPE_ATTR_NAME="attr-name";e.TYPE_ATTR_VALUE="attr-value";e.TYPE_SPACE="space";e.TYPE_NEW_LINE="new-line",e.default=i}));n(f);var l=r((function(t,e){e.__esModule=!0,e.createList=e.unquote=e.trimChar=e.createCharGrabber=void 0;e.createCharGrabber=function(t,e){var n={pos:0,length:t.length},r=function(){n.pos+=1,e&&e.onSkip&&e.onSkip()},o=function(){return n.length>n.pos},i=function(){return t.substr(n.pos)},u=function(){return t[n.pos]};return{skip:r,hasNext:o,isLast:function(){return n.pos===n.length},grabWhile:function(e){var i=0;if(o())for(i=n.pos;o()&&e(u());)r();return t.substr(i,n.pos-i)},getNext:function(){var e=n.pos+1;return e>t.length-1?null:t[e]},getPrev:function(){var e=n.pos-1;return void 0!==t[e]?t[e]:null},getCurr:u,getRest:i,substrUntilChar:function(t){var e=i(),n=e.indexOf(t);return 0>n?"":e.substr(0,n)}}};e.trimChar=function(t,e){for(;t.charAt(0)===e;)t=t.substring(1);for(;t.charAt(t.length-1)===e;)t=t.substring(0,t.length-1);return t};e.unquote=function(t){return t.replace(o.BACKSLASH+o.QUOTEMARK,o.QUOTEMARK)};e.createList=function(t){void 0===t&&(t=[]);var e=t;return{getLast:function(){return Array.isArray(e)&&e.length>0&&void 0!==e[e.length-1]?e[e.length-1]:null},flushLast:function(){return!!e.length&&e.pop()},push:function(t){return e.push(t)},toArray:function(){return e}}}}));n(l);var p=r((function(t,e){e.__esModule=!0,e.createLexer=function(t,e){void 0===e&&(e={});var r=0,i=0,u=-1,a=Array(Math.floor(t.length)),s=e.openTag||o.OPEN_BRAKET,c=e.closeTag||o.CLOSE_BRAKET,p=e.enableEscapeTags,g=[c,s,o.QUOTEMARK,o.BACKSLASH,o.SPACE,o.TAB,o.EQ,o.N,"!"],d=[s,o.SPACE,o.TAB,o.N],A=[o.SPACE,o.TAB],T=[o.EQ,o.SPACE,o.TAB],E=function(t){return A.indexOf(t)>=0},v=function(t){return-1===d.indexOf(t)},h=function(t){return t===s||t===c||t===o.BACKSLASH},_=function(t){return t===o.BACKSLASH},y=function(t){e.onToken&&e.onToken(t),a[u+=1]=t},L=function(t){for(var e=null,u=!1,a=[],s=(0,l.createCharGrabber)(t),c=function(t){var n=t===o.EQ,r=E(t),i=s.getPrev(),a=s.getNext(),c=i===o.BACKSLASH;return null===e?!1===(n||r||s.isLast()):!(!u||!function(t){return T.indexOf(t)>=0}(t))||!!(t!==o.QUOTEMARK||c||(u=!u)||a===o.EQ||E(a))&&!1===(n||r)},p=function(){var t=s.grabWhile(c),u=s.getCurr();if(null===e)e=t;else if(E(u)||u===o.QUOTEMARK||!s.hasNext()){var p=(0,l.unquote)((0,l.trimChar)(t,o.QUOTEMARK));a.push(n(f.TYPE_ATTR_VALUE,p,r,i))}else a.push(n(f.TYPE_ATTR_NAME,t,r,i));s.skip()};s.hasNext();)p();return{tag:e,attrs:a}},O=(0,l.createCharGrabber)(t,{onSkip:function(){i++}}),S=function(){var t=O.getCurr(),e=O.getNext();if(t===o.N)O.skip(),r++,y(n(f.TYPE_NEW_LINE,t,r,i=0));else if(E(t)){var u=O.grabWhile(E);y(n(f.TYPE_SPACE,u,r,i))}else if(p&&_(t)&&h(e))O.skip(),O.skip(),y(n(f.TYPE_WORD,e,r,i));else if(t===s){O.skip();var a=O.substrUntilChar(c),l=0===a.length||a.indexOf(s)>=0;if(g.indexOf(e)>=0||l||O.isLast())y(n(f.TYPE_WORD,t,r,i));else{var d=O.grabWhile((function(t){return t!==c}));if(O.skip(),-1===d.indexOf(o.EQ)||d[0]===o.SLASH)y(n(f.TYPE_TAG,d,r,i));else{var A=L(d);y(n(f.TYPE_TAG,A.tag,r,i)),A.attrs.map(y)}}}else if(t===c)O.skip(),y(n(f.TYPE_WORD,t,r,i));else if(v(t))if(p&&_(t)&&!h(e))O.skip(),y(n(f.TYPE_WORD,t,r,i));else{var T=O.grabWhile((function(t){return p?v(t)&&!_(t):v(t)}));y(n(f.TYPE_WORD,T,r,i))}};return{tokenize:function(){for(;O.hasNext();)S();return a.length=u+1,a},isTokenNested:function(e){var n=s+o.SLASH+e.getValue();return t.indexOf(n)>-1}}},e.createTokenOfType=void 0;var n=function(t,e,n,r){return void 0===n&&(n=0),void 0===r&&(r=0),new f.Token(t,e,n,r)};e.createTokenOfType=n}));n(p);var g=r((function(t,e){e.__esModule=!0,e.default=e.parse=void 0;var n,r=(n=u)&&n.__esModule?n:{default:n};var o=function(t,e){void 0===e&&(e={});var n=e,o=null,i=(0,l.createList)(),u=(0,l.createList)(),a=(0,l.createList)(),c=(0,l.createList)(),f={},g=function(){a.flushLast()&&c.flushLast()},d=function(t){var e,r,o=(e=u.getLast())&&Array.isArray(e.content)?e.content:i.toArray();Array.isArray(o)&&((0,s.isTagNode)(t)?(r=t.tag,n.onlyAllowTags&&n.onlyAllowTags.length&&0>n.onlyAllowTags.indexOf(r)?o.push(""+t):o.push(t.toTagNode())):o.push(t))},A=function(t){g();var e=r.default.create(t.getValue()),n=function(t){return void 0===f[t.getValue()]&&(f[t.getValue()]=o.isTokenNested(t)),f[t.getValue()]}(t);a.push(e),n?u.push(e):d(e)},T=function(t){t.isStart()&&A(t),t.isEnd()&&function(t){g();var e=u.flushLast();if(e)d(e);else if("function"==typeof n.onError){var r=t.getValue(),o=t.getLine(),i=t.getColumn();n.onError({message:"Inconsistent tag '"+r+"' on line "+o+" and column "+i,tagName:r,lineNumber:o,columnNumber:i})}}(t)},E=function(t){var e=a.getLast(),n=t.getValue(),r=!!f[t];if(e)if(t.isAttrName())c.push(n),e.attr(c.getLast(),"");else if(t.isAttrValue()){var o=c.getLast();o?(e.attr(o,n),c.flushLast()):e.attr(n,n)}else t.isText()?r?e.append(n):d(n):t.isTag()&&d(""+t);else t.isText()?d(n):t.isTag()&&d(""+t)};(o=(e.createTokenizer?e.createTokenizer:p.createLexer)(t,{onToken:function(t){t.isTag()?T(t):E(t)},onlyAllowTags:n.onlyAllowTags,openTag:n.openTag,closeTag:n.closeTag,enableEscapeTags:n.enableEscapeTags})).tokenize();return i.toArray()};e.parse=o,e.default=o}));n(g);var d=r((function(t,e){e.__esModule=!0,e.TagNode=e.parse=e.default=void 0;var n=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var e=r();if(e&&e.has(t))return e.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var u=o?Object.getOwnPropertyDescriptor(t,i):null;u&&(u.get||u.set)?Object.defineProperty(n,i,u):n[i]=t[i]}n.default=t,e&&e.set(t,n);return n}(g);function r(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return r=function(){return t},t}e.default=n.default,e.parse=n.parse,e.TagNode=u.TagNode}));n(d);var A=r((function(t,e){e.__esModule=!0,e.iterate=r,e.match=function(t,e){return r(this,Array.isArray(t)?function(n){for(var r=0;t.length>r;r++)if(o(t[r],n))return e(n);return n}:function(n){return o(t,n)?e(n):n})};var n=function(t){return"object"==typeof t};function r(t,e){var o=t;if(Array.isArray(o))for(var i=0;o.length>i;i++)o[i]=r(e(o[i]),e);else o&&n(o)&&o.content&&r(o.content,e);return o}function o(t,e){return typeof t==typeof e&&(n(t)&&null!==t?Array.isArray(t)?t.every((function(t){return[].some.call(e,(function(e){return o(t,e)}))})):Object.keys(t).every((function(r){var i=e[r],u=t[r];return n(u)&&null!==u&&null!==i?o(u,i):"boolean"==typeof u?u!==(null===i):i===u})):t===e)}}));n(A);var T=n(r((function(t,e){function n(t){return(0,A.iterate)(this,t)}e.__esModule=!0,e.default=function(t){var e="function"==typeof t?[t]:t||[],r={skipParse:!1};return{process:function(t,o){var i=(r=o||{}).parser||d.parse,u=r.render,a=r.data||null;if("function"!=typeof i)throw Error('"parser" is not a function, please pass to "process(input, { parser })" right function');var s=r.skipParse?t||[]:i(t,r),c=s;return s.messages=[],s.options=r,s.walk=n,s.match=A.match,e.forEach((function(t){s=t(s,{parse:i,render:u,iterate:A.iterate,match:A.match,data:a})||s})),{get html(){if("function"!=typeof u)throw Error('"render" function not defined, please pass to "process(input, { render })"');return u(s,s.options)},tree:s,raw:c,messages:s.messages}}}}}))),E="/>",v="</",h="<",_=">",y=function(t,e){var n=e.stripTags,r=void 0!==n&&n;if(!t)return"";var o=typeof t;return"string"===o||"number"===o?t:"object"===o?!0===r?L(t.content,{stripTags:r}):null===t.content?""+h+t.tag+c(t.attrs)+E:""+h+t.tag+c(t.attrs)+_+L(t.content)+v+t.tag+_:Array.isArray(t)?L(t,{stripTags:r}):""},L=function(t,e){var n=(void 0===e?{}:e).stripTags,r=void 0!==n&&n;return[].concat(t).reduce((function(t,e){return t+y(e,{stripTags:r})}),"")},O=L;t.default=function(t,n,r){return T(n).process(t,e({},r,{render:L})).html},t.render=O,Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "@bbob/html",
"version": "2.5.7",
"version": "2.5.8",
"description": "HTML renderer for @bbob bbcode parser",
"keywords": [],
"dependencies": {
"@bbob/core": "^2.5.7",
"@bbob/plugin-helper": "^2.5.7"
"@bbob/core": "^2.5.8",
"@bbob/plugin-helper": "^2.5.8"
},

@@ -56,3 +56,3 @@ "main": "lib/index.js",

],
"gitHead": "fe6a16b6d9850bdfe3569649583c9957bf8ebe9c"
"gitHead": "2eb1fbcccf065a95df2c1a28020119582d4a64d1"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc