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.6.0 to 2.6.1

8

CHANGELOG.md

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

## [2.6.1](https://github.com/JiLiZART/bbob/compare/v2.5.8...v2.6.1) (2020-12-15)
**Note:** Version bump only for package @bbob/html
# [2.6.0](https://github.com/JiLiZART/bbob/compare/v2.5.8...v2.6.0) (2020-12-10)

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

3

dist/index.js

@@ -1094,2 +1094,3 @@ (function (global, factory) {

var hasSpace = tagGrabber.includes(char_1.SPACE);
tagMode = TAG_STATE_NAME;

@@ -1159,2 +1160,4 @@ while (tagGrabber.hasNext()) {

function tokenize() {
stateMode = STATE_WORD;
while (chars.hasNext()) {

@@ -1161,0 +1164,0 @@ switch (stateMode) {

2

dist/index.min.js

@@ -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 i=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(i);var o=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===i.N};var o=function(t,e,n){return Object.keys(t).reduce(e,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 u=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=u;var a=function(t,e){var n=typeof e,r={boolean:function(){return e?""+t:""},number:function(){return t+'="'+e+'"'},string:function(){return t+'="'+u(e)+'"'},object:function(){return t+'="'+u(JSON.stringify(e))+'"'}};return r[n]?r[n]():""};e.attrValue=a;e.attrsToString=function(t){return null==t?"":o(t,(function(e,n){return[].concat(e,[a(n,t[n])])}),[""]).join(" ")};e.getUniqAttr=function(t){return o(t,(function(e,n){return t[n]===n?t[n]:null}),null)}}));n(o);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=Array.isArray(n)?n:[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,o.appendToNode)(this,t)},s.toTagNode=function(){return new t(this.tag.toLowerCase(),this.attrs,this.content)},s.toString=function(){var t=i.OPEN_BRAKET,e=i.CLOSE_BRAKET,n=0===this.content.length,u=this.content.reduce((function(t,e){return t+""+e}),""),a=function(t,e){var n=(0,o.getUniqAttr)(e);if(n){var i=(0,o.attrValue)(t,n),u=r({},e);return delete u[n],""+i+(0,o.attrsToString)(u)}return""+t+(0,o.attrsToString)(e)}(this.tag,this.attrs);return n?""+t+a+e:""+t+a+e+u+t+i.SLASH+this.tag+e},e=t,(u=[{key:"length",get:function(){return(0,o.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.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)===i.SLASH.charCodeAt(0)},o=function(){function t(t,e,n,r){this.type=Number(t),this.value=e+"",this.line=Number(n),this.row=Number(r)}var e=t.prototype;return e.isEmpty=function(){return isNaN(this.type)},e.isText=function(){return!(!(t=this)||void 0===t.type||5!==t.type&&6!==t.type&&1!==t.type);var t},e.isTag=function(){return!(!(t=this)||void 0===t.type)&&2===t.type;var t},e.isAttrName=function(){return!(!(t=this)||void 0===t.type)&&3===t.type;var t},e.isAttrValue=function(){return!(!(t=this)||void 0===t.type)&&4===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=i.OPEN_BRAKET,t+=n(this),t+=i.CLOSE_BRAKET;var t},t}();e.Token=o;e.TYPE_ID="type";e.VALUE_ID="value";e.LINE_ID="line";e.COLUMN_ID="row";e.TYPE_WORD=1;e.TYPE_TAG=2;e.TYPE_ATTR_NAME=3;e.TYPE_ATTR_VALUE=4;e.TYPE_SPACE=5;e.TYPE_NEW_LINE=6,e.default=o}));n(a);var s=r((function(t,e){function n(t,e){var n={pos:0,len:t.length},r=function(){return n.len>n.pos},i=function(t,r){void 0===t&&(t=1),n.pos+=t,e&&e.onSkip&&!r&&e.onSkip()},o=function(){return t[n.pos]};this.skip=i,this.hasNext=r,this.getCurr=o,this.getRest=function(){return t.substr(n.pos)},this.getNext=function(){var e=n.pos+1;return e>t.length-1?null:t[e]},this.getPrev=function(){var e=n.pos-1;return void 0!==t[e]?t[e]:null},this.isLast=function(){return n.pos===n.len},this.includes=function(e){return t.indexOf(e,n.pos)>=0},this.grabWhile=function(e,u){var a=0;if(r())for(a=n.pos;r()&&e(o());)i(1,u);return t.substr(a,n.pos-a)},this.substrUntilChar=function(e){var r=n.pos,i=t.indexOf(e,r);return 0>i?"":t.substr(r,i-r)}}e.__esModule=!0,e.createList=e.unquote=e.trimChar=e.createCharGrabber=void 0;e.createCharGrabber=function(t,e){return new n(t,e)};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};function r(t){void 0===t&&(t=[]);var e=t;this.push=function(t){return e.push(t)},this.toArray=function(){return e},this.getLast=function(){return Array.isArray(e)&&e.length>0&&void 0!==e[e.length-1]?e[e.length-1]:null},this.flushLast=function(){return!!e.length&&e.pop()}}e.unquote=function(t){return t.replace(i.BACKSLASH+i.QUOTEMARK,i.QUOTEMARK)};e.createList=function(t){return void 0===t&&(t=[]),new r(t)}}));n(s);var c=r((function(t,e){e.__esModule=!0,e.createLexer=function(t,e){void 0===e&&(e={});var r=0,o=0,u=-1,c=0,f=0,l=Array(Math.floor(t.length)),p=e.openTag||i.OPEN_BRAKET,g=e.closeTag||i.CLOSE_BRAKET,A=!!e.enableEscapeTags,d=e.onToken||function(){},T=[g,p,i.QUOTEMARK,i.BACKSLASH,i.SPACE,i.TAB,i.EQ,i.N,"!"],E=[p,i.SPACE,i.TAB,i.N],v=[i.SPACE,i.TAB],h=[i.EQ,i.SPACE,i.TAB],_=function(t){return v.indexOf(t)>=0},L=function(t){return-1===E.indexOf(t)},y=function(t){return t===i.BACKSLASH},S=function(){o++},O=function(t){return(0,s.unquote)((0,s.trimChar)(t,i.QUOTEMARK))},N=(0,s.createCharGrabber)(t,{onSkip:S});function P(t,e){var i=n(t,e,r,o);d(i),l[u+=1]=i}function b(t,e){if(1===f){var n=t.grabWhile((function(t){return!(t===i.EQ||_(t))})),r=t.isLast(),o=t.getCurr()!==i.EQ;return t.skip(),r||o?P(a.TYPE_ATTR_VALUE,O(n)):P(a.TYPE_ATTR_NAME,n),r?0:o?1:2}if(2===f){var u=!1,s=t.grabWhile((function(n){var r=n===i.QUOTEMARK,o=t.getPrev(),a=t.getNext(),s=o===i.BACKSLASH,c=a===i.EQ,f=_(n),l=_(a);return!(!u||!function(t){return h.indexOf(t)>=0}(n))||!!(!r||s||(u=!u)||c||l)&&(!!e||!1===f)}));return t.skip(),P(a.TYPE_ATTR_VALUE,O(s)),t.isLast()?0:1}var c=t.grabWhile((function(e){return!(e===i.EQ||_(e)||t.isLast())}));return P(a.TYPE_TAG,c),t.skip(),e?2:t.includes(i.EQ)?1:2}function C(){var t=N.getCurr();if(t===p){var e=N.getNext();N.skip();var n=N.substrUntilChar(g),r=0===n.length||n.indexOf(p)>=0;if(T.indexOf(e)>=0||r||N.isLast())return P(a.TYPE_WORD,t),0;if(-1===n.indexOf(i.EQ)||n[0]===i.SLASH){var o=N.grabWhile((function(t){return t!==g}));return N.skip(),P(a.TYPE_TAG,o),0}return 2}return 0}function R(){for(var t=N.grabWhile((function(t){return t!==g}),!0),e=(0,s.createCharGrabber)(t,{onSkip:S}),n=e.includes(i.SPACE);e.hasNext();)f=b(e,!n);return N.skip(),0}function k(){if(N.getCurr()===i.N)return P(a.TYPE_NEW_LINE,N.getCurr()),N.skip(),o=0,r++,0;if(_(N.getCurr()))return P(a.TYPE_SPACE,N.grabWhile(_)),0;if(N.getCurr()===p)return N.includes(g)?1:(P(a.TYPE_WORD,N.getCurr()),N.skip(),0);if(A){if(y(N.getCurr())){var t=N.getCurr(),e=N.getNext();return N.skip(),function(t){return t===p||t===g||t===i.BACKSLASH}(e)?(N.skip(),P(a.TYPE_WORD,e),0):(P(a.TYPE_WORD,t),0)}return P(a.TYPE_WORD,N.grabWhile((function(t){return L(t)&&!y(t)}))),0}return P(a.TYPE_WORD,N.grabWhile(L)),0}return{tokenize:function(){for(;N.hasNext();)switch(c){case 1:c=C();break;case 2:c=R();break;case 0:c=k();break;default:c=0}return l.length=u+1,l},isTokenNested:function(e){var n=p+i.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 a.Token(t,e,n,r)};e.createTokenOfType=n}));n(c);var f=r((function(t,e){e.__esModule=!0,e.default=e.parse=void 0;var n,r=(n=u)&&n.__esModule?n:{default:n};var i=function(t,e){void 0===e&&(e={});var n=e,i=null,u=(0,s.createList)(),a=(0,s.createList)(),f=(0,s.createList)(),l=(0,s.createList)(),p={},g=function(){f.flushLast()&&l.flushLast()},A=function(t){var e,r,i=(e=a.getLast())&&Array.isArray(e.content)?e.content:u.toArray();Array.isArray(i)&&((0,o.isTagNode)(t)?(r=t.tag,n.onlyAllowTags&&n.onlyAllowTags.length&&0>n.onlyAllowTags.indexOf(r)?i.push(""+t):i.push(t.toTagNode())):i.push(t))},d=function(t){g();var e=r.default.create(t.getValue()),n=function(t){return void 0===p[t.getValue()]&&(p[t.getValue()]=i.isTokenNested(t)),p[t.getValue()]}(t);f.push(e),n?a.push(e):A(e)},T=function(t){t.isStart()&&d(t),t.isEnd()&&function(t){g();var e=a.flushLast();if(e)A(e);else if("function"==typeof n.onError){var r=t.getValue(),i=t.getLine(),o=t.getColumn();n.onError({message:"Inconsistent tag '"+r+"' on line "+i+" and column "+o,tagName:r,lineNumber:i,columnNumber:o})}}(t)},E=function(t){var e=f.getLast(),n=t.getValue(),r=!!p[t];if(e)if(t.isAttrName())l.push(n),e.attr(l.getLast(),"");else if(t.isAttrValue()){var i=l.getLast();i?(e.attr(i,n),l.flushLast()):e.attr(n,n)}else t.isText()?r?e.append(n):A(n):t.isTag()&&A(""+t);else t.isText()?A(n):t.isTag()&&A(""+t)};(i=(e.createTokenizer?e.createTokenizer:c.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 u.toArray()};e.parse=i,e.default=i}));n(f);var l=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={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var u=i?Object.getOwnPropertyDescriptor(t,o):null;u&&(u.get||u.set)?Object.defineProperty(n,o,u):n[o]=t[o]}n.default=t,e&&e.set(t,n);return n}(f);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(l);var p=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(i(t[r],n))return e(n);return n}:function(n){return i(t,n)?e(n):n})};var n=function(t){return"object"==typeof t};function r(t,e){var i=t;if(Array.isArray(i))for(var o=0;i.length>o;o++)i[o]=r(e(i[o]),e);else i&&n(i)&&i.content&&r(i.content,e);return i}function i(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 i(t,e)}))})):Object.keys(t).every((function(r){var o=e[r],u=t[r];return n(u)&&null!==u&&null!==o?i(u,o):"boolean"==typeof u?u!==(null===o):o===u})):t===e)}}));n(p);var g=n(r((function(t,e){function n(t){return(0,p.iterate)(this,t)}e.__esModule=!0,e.default=function(t){var e="function"==typeof t?[t]:t||[],r={skipParse:!1};return{process:function(t,i){var o=(r=i||{}).parser||l.parse,u=r.render,a=r.data||null;if("function"!=typeof o)throw Error('"parser" is not a function, please pass to "process(input, { parser })" right function');var s=r.skipParse?t||[]:o(t,r),c=s;return s.messages=[],s.options=r,s.walk=n,s.match=p.match,e.forEach((function(t){s=t(s,{parse:o,render:u,iterate:p.iterate,match:p.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}}}}}))),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 d=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};var i=function(t,e,n){return Object.keys(t).reduce(e,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 u=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=u;e.attrsToString=function(t){return null==t?"":i(t,(function(e,n){return[].concat(e,[u(n,t[n])])}),[""]).join(" ")};e.getUniqAttr=function(t){return i(t,(function(e,n){return t[n]===n?t[n]:null}),null)}}));n(d);var T=d.attrsToString,E="/>",v="</",h="<",_=">",L=function(t,e){var n=e.stripTags,r=void 0!==n&&n;if(!t)return"";var i=typeof t;return"string"===i||"number"===i?t:"object"===i?!0===r?y(t.content,{stripTags:r}):null===t.content?""+h+t.tag+T(t.attrs)+E:""+h+t.tag+T(t.attrs)+_+y(t.content)+v+t.tag+_:Array.isArray(t)?y(t,{stripTags:r}):""},y=function(t,e){var n=(void 0===e?{}:e).stripTags,r=void 0!==n&&n;return[].concat(t).reduce((function(t,e){return t+L(e,{stripTags:r})}),"")},S=y;t.default=function(t,n,r){return g(n).process(t,e({},r,{render:y})).html},t.render=S,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 i=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(i);var o=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===i.N};var o=function(t,e,n){return Object.keys(t).reduce(e,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 u=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=u;var a=function(t,e){var n=typeof e,r={boolean:function(){return e?""+t:""},number:function(){return t+'="'+e+'"'},string:function(){return t+'="'+u(e)+'"'},object:function(){return t+'="'+u(JSON.stringify(e))+'"'}};return r[n]?r[n]():""};e.attrValue=a;e.attrsToString=function(t){return null==t?"":o(t,(function(e,n){return[].concat(e,[a(n,t[n])])}),[""]).join(" ")};e.getUniqAttr=function(t){return o(t,(function(e,n){return t[n]===n?t[n]:null}),null)}}));n(o);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=Array.isArray(n)?n:[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,o.appendToNode)(this,t)},s.toTagNode=function(){return new t(this.tag.toLowerCase(),this.attrs,this.content)},s.toString=function(){var t=i.OPEN_BRAKET,e=i.CLOSE_BRAKET,n=0===this.content.length,u=this.content.reduce((function(t,e){return t+""+e}),""),a=function(t,e){var n=(0,o.getUniqAttr)(e);if(n){var i=(0,o.attrValue)(t,n),u=r({},e);return delete u[n],""+i+(0,o.attrsToString)(u)}return""+t+(0,o.attrsToString)(e)}(this.tag,this.attrs);return n?""+t+a+e:""+t+a+e+u+t+i.SLASH+this.tag+e},e=t,(u=[{key:"length",get:function(){return(0,o.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.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)===i.SLASH.charCodeAt(0)},o=function(){function t(t,e,n,r){this.type=Number(t),this.value=e+"",this.line=Number(n),this.row=Number(r)}var e=t.prototype;return e.isEmpty=function(){return isNaN(this.type)},e.isText=function(){return!(!(t=this)||void 0===t.type||5!==t.type&&6!==t.type&&1!==t.type);var t},e.isTag=function(){return!(!(t=this)||void 0===t.type)&&2===t.type;var t},e.isAttrName=function(){return!(!(t=this)||void 0===t.type)&&3===t.type;var t},e.isAttrValue=function(){return!(!(t=this)||void 0===t.type)&&4===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=i.OPEN_BRAKET,t+=n(this),t+=i.CLOSE_BRAKET;var t},t}();e.Token=o;e.TYPE_ID="type";e.VALUE_ID="value";e.LINE_ID="line";e.COLUMN_ID="row";e.TYPE_WORD=1;e.TYPE_TAG=2;e.TYPE_ATTR_NAME=3;e.TYPE_ATTR_VALUE=4;e.TYPE_SPACE=5;e.TYPE_NEW_LINE=6,e.default=o}));n(a);var s=r((function(t,e){function n(t,e){var n={pos:0,len:t.length},r=function(){return n.len>n.pos},i=function(t,r){void 0===t&&(t=1),n.pos+=t,e&&e.onSkip&&!r&&e.onSkip()},o=function(){return t[n.pos]};this.skip=i,this.hasNext=r,this.getCurr=o,this.getRest=function(){return t.substr(n.pos)},this.getNext=function(){var e=n.pos+1;return e>t.length-1?null:t[e]},this.getPrev=function(){var e=n.pos-1;return void 0!==t[e]?t[e]:null},this.isLast=function(){return n.pos===n.len},this.includes=function(e){return t.indexOf(e,n.pos)>=0},this.grabWhile=function(e,u){var a=0;if(r())for(a=n.pos;r()&&e(o());)i(1,u);return t.substr(a,n.pos-a)},this.substrUntilChar=function(e){var r=n.pos,i=t.indexOf(e,r);return 0>i?"":t.substr(r,i-r)}}e.__esModule=!0,e.createList=e.unquote=e.trimChar=e.createCharGrabber=void 0;e.createCharGrabber=function(t,e){return new n(t,e)};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};function r(t){void 0===t&&(t=[]);var e=t;this.push=function(t){return e.push(t)},this.toArray=function(){return e},this.getLast=function(){return Array.isArray(e)&&e.length>0&&void 0!==e[e.length-1]?e[e.length-1]:null},this.flushLast=function(){return!!e.length&&e.pop()}}e.unquote=function(t){return t.replace(i.BACKSLASH+i.QUOTEMARK,i.QUOTEMARK)};e.createList=function(t){return void 0===t&&(t=[]),new r(t)}}));n(s);var c=r((function(t,e){e.__esModule=!0,e.createLexer=function(t,e){void 0===e&&(e={});var r=0,o=0,u=-1,c=0,f=0,l=Array(Math.floor(t.length)),p=e.openTag||i.OPEN_BRAKET,g=e.closeTag||i.CLOSE_BRAKET,A=!!e.enableEscapeTags,d=e.onToken||function(){},T=[g,p,i.QUOTEMARK,i.BACKSLASH,i.SPACE,i.TAB,i.EQ,i.N,"!"],E=[p,i.SPACE,i.TAB,i.N],v=[i.SPACE,i.TAB],h=[i.EQ,i.SPACE,i.TAB],_=function(t){return v.indexOf(t)>=0},L=function(t){return-1===E.indexOf(t)},y=function(t){return t===i.BACKSLASH},S=function(){o++},O=function(t){return(0,s.unquote)((0,s.trimChar)(t,i.QUOTEMARK))},N=(0,s.createCharGrabber)(t,{onSkip:S});function P(t,e){var i=n(t,e,r,o);d(i),l[u+=1]=i}function b(t,e){if(1===f){var n=t.grabWhile((function(t){return!(t===i.EQ||_(t))})),r=t.isLast(),o=t.getCurr()!==i.EQ;return t.skip(),r||o?P(a.TYPE_ATTR_VALUE,O(n)):P(a.TYPE_ATTR_NAME,n),r?0:o?1:2}if(2===f){var u=!1,s=t.grabWhile((function(n){var r=n===i.QUOTEMARK,o=t.getPrev(),a=t.getNext(),s=o===i.BACKSLASH,c=a===i.EQ,f=_(n),l=_(a);return!(!u||!function(t){return h.indexOf(t)>=0}(n))||!!(!r||s||(u=!u)||c||l)&&(!!e||!1===f)}));return t.skip(),P(a.TYPE_ATTR_VALUE,O(s)),t.isLast()?0:1}var c=t.grabWhile((function(e){return!(e===i.EQ||_(e)||t.isLast())}));return P(a.TYPE_TAG,c),t.skip(),e?2:t.includes(i.EQ)?1:2}function C(){var t=N.getCurr();if(t===p){var e=N.getNext();N.skip();var n=N.substrUntilChar(g),r=0===n.length||n.indexOf(p)>=0;if(T.indexOf(e)>=0||r||N.isLast())return P(a.TYPE_WORD,t),0;if(-1===n.indexOf(i.EQ)||n[0]===i.SLASH){var o=N.grabWhile((function(t){return t!==g}));return N.skip(),P(a.TYPE_TAG,o),0}return 2}return 0}function R(){var t=N.grabWhile((function(t){return t!==g}),!0),e=(0,s.createCharGrabber)(t,{onSkip:S}),n=e.includes(i.SPACE);for(f=0;e.hasNext();)f=b(e,!n);return N.skip(),0}function k(){if(N.getCurr()===i.N)return P(a.TYPE_NEW_LINE,N.getCurr()),N.skip(),o=0,r++,0;if(_(N.getCurr()))return P(a.TYPE_SPACE,N.grabWhile(_)),0;if(N.getCurr()===p)return N.includes(g)?1:(P(a.TYPE_WORD,N.getCurr()),N.skip(),0);if(A){if(y(N.getCurr())){var t=N.getCurr(),e=N.getNext();return N.skip(),function(t){return t===p||t===g||t===i.BACKSLASH}(e)?(N.skip(),P(a.TYPE_WORD,e),0):(P(a.TYPE_WORD,t),0)}return P(a.TYPE_WORD,N.grabWhile((function(t){return L(t)&&!y(t)}))),0}return P(a.TYPE_WORD,N.grabWhile(L)),0}return{tokenize:function(){for(c=0;N.hasNext();)switch(c){case 1:c=C();break;case 2:c=R();break;case 0:c=k();break;default:c=0}return l.length=u+1,l},isTokenNested:function(e){var n=p+i.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 a.Token(t,e,n,r)};e.createTokenOfType=n}));n(c);var f=r((function(t,e){e.__esModule=!0,e.default=e.parse=void 0;var n,r=(n=u)&&n.__esModule?n:{default:n};var i=function(t,e){void 0===e&&(e={});var n=e,i=null,u=(0,s.createList)(),a=(0,s.createList)(),f=(0,s.createList)(),l=(0,s.createList)(),p={},g=function(){f.flushLast()&&l.flushLast()},A=function(t){var e,r,i=(e=a.getLast())&&Array.isArray(e.content)?e.content:u.toArray();Array.isArray(i)&&((0,o.isTagNode)(t)?(r=t.tag,n.onlyAllowTags&&n.onlyAllowTags.length&&0>n.onlyAllowTags.indexOf(r)?i.push(""+t):i.push(t.toTagNode())):i.push(t))},d=function(t){g();var e=r.default.create(t.getValue()),n=function(t){return void 0===p[t.getValue()]&&(p[t.getValue()]=i.isTokenNested(t)),p[t.getValue()]}(t);f.push(e),n?a.push(e):A(e)},T=function(t){t.isStart()&&d(t),t.isEnd()&&function(t){g();var e=a.flushLast();if(e)A(e);else if("function"==typeof n.onError){var r=t.getValue(),i=t.getLine(),o=t.getColumn();n.onError({message:"Inconsistent tag '"+r+"' on line "+i+" and column "+o,tagName:r,lineNumber:i,columnNumber:o})}}(t)},E=function(t){var e=f.getLast(),n=t.getValue(),r=!!p[t];if(e)if(t.isAttrName())l.push(n),e.attr(l.getLast(),"");else if(t.isAttrValue()){var i=l.getLast();i?(e.attr(i,n),l.flushLast()):e.attr(n,n)}else t.isText()?r?e.append(n):A(n):t.isTag()&&A(""+t);else t.isText()?A(n):t.isTag()&&A(""+t)};(i=(e.createTokenizer?e.createTokenizer:c.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 u.toArray()};e.parse=i,e.default=i}));n(f);var l=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={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var u=i?Object.getOwnPropertyDescriptor(t,o):null;u&&(u.get||u.set)?Object.defineProperty(n,o,u):n[o]=t[o]}n.default=t,e&&e.set(t,n);return n}(f);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(l);var p=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(i(t[r],n))return e(n);return n}:function(n){return i(t,n)?e(n):n})};var n=function(t){return"object"==typeof t};function r(t,e){var i=t;if(Array.isArray(i))for(var o=0;i.length>o;o++)i[o]=r(e(i[o]),e);else i&&n(i)&&i.content&&r(i.content,e);return i}function i(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 i(t,e)}))})):Object.keys(t).every((function(r){var o=e[r],u=t[r];return n(u)&&null!==u&&null!==o?i(u,o):"boolean"==typeof u?u!==(null===o):o===u})):t===e)}}));n(p);var g=n(r((function(t,e){function n(t){return(0,p.iterate)(this,t)}e.__esModule=!0,e.default=function(t){var e="function"==typeof t?[t]:t||[],r={skipParse:!1};return{process:function(t,i){var o=(r=i||{}).parser||l.parse,u=r.render,a=r.data||null;if("function"!=typeof o)throw Error('"parser" is not a function, please pass to "process(input, { parser })" right function');var s=r.skipParse?t||[]:o(t,r),c=s;return s.messages=[],s.options=r,s.walk=n,s.match=p.match,e.forEach((function(t){s=t(s,{parse:o,render:u,iterate:p.iterate,match:p.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}}}}}))),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 d=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};var i=function(t,e,n){return Object.keys(t).reduce(e,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 u=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=u;e.attrsToString=function(t){return null==t?"":i(t,(function(e,n){return[].concat(e,[u(n,t[n])])}),[""]).join(" ")};e.getUniqAttr=function(t){return i(t,(function(e,n){return t[n]===n?t[n]:null}),null)}}));n(d);var T=d.attrsToString,E="/>",v="</",h="<",_=">",L=function(t,e){var n=e.stripTags,r=void 0!==n&&n;if(!t)return"";var i=typeof t;return"string"===i||"number"===i?t:"object"===i?!0===r?y(t.content,{stripTags:r}):null===t.content?""+h+t.tag+T(t.attrs)+E:""+h+t.tag+T(t.attrs)+_+y(t.content)+v+t.tag+_:Array.isArray(t)?y(t,{stripTags:r}):""},y=function(t,e){var n=(void 0===e?{}:e).stripTags,r=void 0!==n&&n;return[].concat(t).reduce((function(t,e){return t+L(e,{stripTags:r})}),"")},S=y;t.default=function(t,n,r){return g(n).process(t,e({},r,{render:y})).html},t.render=S,Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "@bbob/html",
"version": "2.6.0",
"version": "2.6.1",
"description": "HTML renderer for @bbob bbcode parser",
"keywords": [],
"dependencies": {
"@bbob/core": "^2.6.0",
"@bbob/plugin-helper": "^2.6.0"
"@bbob/core": "^2.6.1",
"@bbob/plugin-helper": "^2.6.1"
},

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

],
"gitHead": "99f503df0cc35d33c9e57d49b6581631d49ab6c3"
"gitHead": "58e6fba8ac5ac8fe368cade48d439671f86e727d"
}
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