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

html-parse-stringify

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-parse-stringify - npm Package Compare versions

Comparing version 2.1.1 to 3.0.0

2

dist/html-parse-stringify.js

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

var e,t=(e=require("void-elements"))&&"object"==typeof e&&"default"in e?e.default:e,n=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function r(e){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=e.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(t[i[1].toLowerCase()]||"/"===e.charAt(e.length-2))&&(r.voidElement=!0),r.name.startsWith("!--"))){var s=e.indexOf("--\x3e");return{type:"comment",comment:-1!==s?e.slice(4,s):""}}for(var a=new RegExp(n),c=null;null!==(c=a.exec(e));)if(c[0].trim())if(c[1]){var o=c[1].trim(),u=[o,""];o.indexOf("=")>-1&&(u=o.split("=")),r.attrs[u[0]]=u[1],a.lastIndex--}else c[2]&&(r.attrs[c[2]]=c[3].trim().substring(1,c[3].length-1));return r}var i=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,s=Object.create(null);function a(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(a,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}module.exports={parse:function(e,t){t||(t={}),t.components||(t.components=s);var n,a=[],c=[],o=-1,u=!1;if(0!==e.indexOf("<")){var l=e.indexOf("<");a.push({type:"text",content:-1===l?e:e.substring(0,l)})}return e.replace(i,function(i,s){if(u){if(i!=="</"+n.name+">")return;u=!1}var l,m="/"!==i.charAt(1),d=i.startsWith("\x3c!--"),f=s+i.length,p=e.charAt(f);if(d){var h=r(i);return o<0?(a.push(h),a):((l=c[o]).children.push(h),a)}if(m&&(o++,"tag"===(n=r(i)).type&&t.components[n.name]&&(n.type="component",u=!0),n.voidElement||u||!p||"<"===p||n.children.push({type:"text",content:e.slice(f,e.indexOf("<",f))}),0===o&&a.push(n),(l=c[o-1])&&l.children.push(n),c[o]=n),(!m||n.voidElement)&&(o>-1&&(n.voidElement||n.name===i.slice(2,-1))&&(o--,n=-1===o?a:c[o]),!u&&"<"!==p&&p)){l=-1===o?a:c[o].children;var v=e.indexOf("<",f),x=e.slice(f,-1===v?void 0:v);/^\s*$/.test(x)||l.push({type:"text",content:x})}}),a},stringify:function(e){return e.reduce(function(e,t){return e+a("",t)},"")}};
var e,t=(e=require("void-elements"))&&"object"==typeof e&&"default"in e?e.default:e,n=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function r(e){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=e.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(t[i[1].toLowerCase()]||"/"===e.charAt(e.length-2))&&(r.voidElement=!0),r.name.startsWith("!--"))){var s=e.indexOf("--\x3e");return{type:"comment",comment:-1!==s?e.slice(4,s):""}}for(var a=new RegExp(n),c=null;null!==(c=a.exec(e));)if(c[0].trim())if(c[1]){var o=c[1].trim(),u=[o,""];o.indexOf("=")>-1&&(u=o.split("=")),r.attrs[u[0]]=u[1],a.lastIndex--}else c[2]&&(r.attrs[c[2]]=c[3].trim().substring(1,c[3].length-1));return r}var i=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,s=/^\s*$/,a=Object.create(null);function c(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(c,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}module.exports={parse:function(e,t){t||(t={}),t.components||(t.components=a);var n,c=[],o=[],u=-1,l=!1;if(0!==e.indexOf("<")){var m=e.indexOf("<");c.push({type:"text",content:-1===m?e:e.substring(0,m)})}return e.replace(i,function(i,a){if(l){if(i!=="</"+n.name+">")return;l=!1}var m,d="/"!==i.charAt(1),f=i.startsWith("\x3c!--"),h=a+i.length,p=e.charAt(h);if(f){var v=r(i);return u<0?(c.push(v),c):((m=o[u]).children.push(v),c)}if(d&&(u++,"tag"===(n=r(i)).type&&t.components[n.name]&&(n.type="component",l=!0),n.voidElement||l||!p||"<"===p||n.children.push({type:"text",content:e.slice(h,e.indexOf("<",h))}),0===u&&c.push(n),(m=o[u-1])&&m.children.push(n),o[u]=n),(!d||n.voidElement)&&(u>-1&&(n.voidElement||n.name===i.slice(2,-1))&&(u--,n=-1===u?c:o[u]),!l&&"<"!==p&&p)){m=-1===u?c:o[u].children;var x=e.indexOf("<",h),g=e.slice(h,-1===x?void 0:x);s.test(g)&&(g=" "),(x>-1&&u+m.length>=0||" "!==g)&&m.push({type:"text",content:g})}}),c},stringify:function(e){return e.reduce(function(e,t){return e+c("",t)},"")}};
//# sourceMappingURL=html-parse-stringify.js.map

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

import t from"void-elements";const e=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n(n){const s={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},r=n.match(/<\/?([^\s]+?)[/\s>]/);if(r&&(s.name=r[1],(t[r[1].toLowerCase()]||"/"===n.charAt(n.length-2))&&(s.voidElement=!0),s.name.startsWith("!--"))){const t=n.indexOf("--\x3e");return{type:"comment",comment:-1!==t?n.slice(4,t):""}}const c=new RegExp(e);let i=null;for(;i=c.exec(n),null!==i;)if(i[0].trim())if(i[1]){const t=i[1].trim();let e=[t,""];t.indexOf("=")>-1&&(e=t.split("=")),s.attrs[e[0]]=e[1],c.lastIndex--}else i[2]&&(s.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return s}const s=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,r=Object.create(null);function c(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?function(t){const e=[];for(let n in t)e.push(n+'="'+t[n]+'"');return e.length?" "+e.join(" "):""}(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(c,"")+"</"+e.name+">";case"comment":return t+"\x3c!--"+e.comment+"--\x3e"}}var i={parse:function(t,e){e||(e={}),e.components||(e.components=r);const c=[],i=[];let o,l=-1,a=!1;if(0!==t.indexOf("<")){var m=t.indexOf("<");c.push({type:"text",content:-1===m?t:t.substring(0,m)})}return t.replace(s,function(s,r){if(a){if(s!=="</"+o.name+">")return;a=!1}const m="/"!==s.charAt(1),u=s.startsWith("\x3c!--"),f=r+s.length,p=t.charAt(f);let d;if(u){const t=n(s);return l<0?(c.push(t),c):(d=i[l],d.children.push(t),c)}if(m&&(l++,o=n(s),"tag"===o.type&&e.components[o.name]&&(o.type="component",a=!0),o.voidElement||a||!p||"<"===p||o.children.push({type:"text",content:t.slice(f,t.indexOf("<",f))}),0===l&&c.push(o),d=i[l-1],d&&d.children.push(o),i[l]=o),(!m||o.voidElement)&&(l>-1&&(o.voidElement||o.name===s.slice(2,-1))&&(l--,o=-1===l?c:i[l]),!a&&"<"!==p&&p)){d=-1===l?c:i[l].children;const e=t.indexOf("<",f),n=t.slice(f,-1===e?void 0:e);/^\s*$/.test(n)||d.push({type:"text",content:n})}}),c},stringify:function(t){return t.reduce(function(t,e){return t+c("",e)},"")}};export default i;
import t from"void-elements";const e=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n(n){const s={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},r=n.match(/<\/?([^\s]+?)[/\s>]/);if(r&&(s.name=r[1],(t[r[1].toLowerCase()]||"/"===n.charAt(n.length-2))&&(s.voidElement=!0),s.name.startsWith("!--"))){const t=n.indexOf("--\x3e");return{type:"comment",comment:-1!==t?n.slice(4,t):""}}const c=new RegExp(e);let i=null;for(;i=c.exec(n),null!==i;)if(i[0].trim())if(i[1]){const t=i[1].trim();let e=[t,""];t.indexOf("=")>-1&&(e=t.split("=")),s.attrs[e[0]]=e[1],c.lastIndex--}else i[2]&&(s.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return s}const s=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,r=/^\s*$/,c=Object.create(null);function i(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?function(t){const e=[];for(let n in t)e.push(n+'="'+t[n]+'"');return e.length?" "+e.join(" "):""}(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(i,"")+"</"+e.name+">";case"comment":return t+"\x3c!--"+e.comment+"--\x3e"}}var o={parse:function(t,e){e||(e={}),e.components||(e.components=c);const i=[],o=[];let l,a=-1,m=!1;if(0!==t.indexOf("<")){var u=t.indexOf("<");i.push({type:"text",content:-1===u?t:t.substring(0,u)})}return t.replace(s,function(s,c){if(m){if(s!=="</"+l.name+">")return;m=!1}const u="/"!==s.charAt(1),f=s.startsWith("\x3c!--"),h=c+s.length,p=t.charAt(h);let d;if(f){const t=n(s);return a<0?(i.push(t),i):(d=o[a],d.children.push(t),i)}if(u&&(a++,l=n(s),"tag"===l.type&&e.components[l.name]&&(l.type="component",m=!0),l.voidElement||m||!p||"<"===p||l.children.push({type:"text",content:t.slice(h,t.indexOf("<",h))}),0===a&&i.push(l),d=o[a-1],d&&d.children.push(l),o[a]=l),(!u||l.voidElement)&&(a>-1&&(l.voidElement||l.name===s.slice(2,-1))&&(a--,l=-1===a?i:o[a]),!m&&"<"!==p&&p)){d=-1===a?i:o[a].children;const e=t.indexOf("<",h);let n=t.slice(h,-1===e?void 0:e);r.test(n)&&(n=" "),(e>-1&&a+d.length>=0||" "!==n)&&d.push({type:"text",content:n})}}),i},stringify:function(t){return t.reduce(function(t,e){return t+i("",e)},"")}};export default o;
//# sourceMappingURL=html-parse-stringify.modern.js.map

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

import e from"void-elements";var t=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n(n){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=n.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(e[i[1].toLowerCase()]||"/"===n.charAt(n.length-2))&&(r.voidElement=!0),r.name.startsWith("!--"))){var s=n.indexOf("--\x3e");return{type:"comment",comment:-1!==s?n.slice(4,s):""}}for(var a=new RegExp(t),c=null;null!==(c=a.exec(n));)if(c[0].trim())if(c[1]){var o=c[1].trim(),m=[o,""];o.indexOf("=")>-1&&(m=o.split("=")),r.attrs[m[0]]=m[1],a.lastIndex--}else c[2]&&(r.attrs[c[2]]=c[3].trim().substring(1,c[3].length-1));return r}var r=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,i=Object.create(null);function s(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(s,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}var a={parse:function(e,t){t||(t={}),t.components||(t.components=i);var s,a=[],c=[],o=-1,m=!1;if(0!==e.indexOf("<")){var u=e.indexOf("<");a.push({type:"text",content:-1===u?e:e.substring(0,u)})}return e.replace(r,function(r,i){if(m){if(r!=="</"+s.name+">")return;m=!1}var u,l="/"!==r.charAt(1),f=r.startsWith("\x3c!--"),p=i+r.length,d=e.charAt(p);if(f){var h=n(r);return o<0?(a.push(h),a):((u=c[o]).children.push(h),a)}if(l&&(o++,"tag"===(s=n(r)).type&&t.components[s.name]&&(s.type="component",m=!0),s.voidElement||m||!d||"<"===d||s.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===o&&a.push(s),(u=c[o-1])&&u.children.push(s),c[o]=s),(!l||s.voidElement)&&(o>-1&&(s.voidElement||s.name===r.slice(2,-1))&&(o--,s=-1===o?a:c[o]),!m&&"<"!==d&&d)){u=-1===o?a:c[o].children;var v=e.indexOf("<",p),x=e.slice(p,-1===v?void 0:v);/^\s*$/.test(x)||u.push({type:"text",content:x})}}),a},stringify:function(e){return e.reduce(function(e,t){return e+s("",t)},"")}};export default a;
import e from"void-elements";var t=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n(n){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=n.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(e[i[1].toLowerCase()]||"/"===n.charAt(n.length-2))&&(r.voidElement=!0),r.name.startsWith("!--"))){var s=n.indexOf("--\x3e");return{type:"comment",comment:-1!==s?n.slice(4,s):""}}for(var a=new RegExp(t),c=null;null!==(c=a.exec(n));)if(c[0].trim())if(c[1]){var o=c[1].trim(),l=[o,""];o.indexOf("=")>-1&&(l=o.split("=")),r.attrs[l[0]]=l[1],a.lastIndex--}else c[2]&&(r.attrs[c[2]]=c[3].trim().substring(1,c[3].length-1));return r}var r=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,i=/^\s*$/,s=Object.create(null);function a(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(a,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}var c={parse:function(e,t){t||(t={}),t.components||(t.components=s);var a,c=[],o=[],l=-1,m=!1;if(0!==e.indexOf("<")){var u=e.indexOf("<");c.push({type:"text",content:-1===u?e:e.substring(0,u)})}return e.replace(r,function(r,s){if(m){if(r!=="</"+a.name+">")return;m=!1}var u,f="/"!==r.charAt(1),h=r.startsWith("\x3c!--"),p=s+r.length,d=e.charAt(p);if(h){var v=n(r);return l<0?(c.push(v),c):((u=o[l]).children.push(v),c)}if(f&&(l++,"tag"===(a=n(r)).type&&t.components[a.name]&&(a.type="component",m=!0),a.voidElement||m||!d||"<"===d||a.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===l&&c.push(a),(u=o[l-1])&&u.children.push(a),o[l]=a),(!f||a.voidElement)&&(l>-1&&(a.voidElement||a.name===r.slice(2,-1))&&(l--,a=-1===l?c:o[l]),!m&&"<"!==d&&d)){u=-1===l?c:o[l].children;var x=e.indexOf("<",p),g=e.slice(p,-1===x?void 0:x);i.test(g)&&(g=" "),(x>-1&&l+u.length>=0||" "!==g)&&u.push({type:"text",content:g})}}),c},stringify:function(e){return e.reduce(function(e,t){return e+a("",t)},"")}};export default c;
//# sourceMappingURL=html-parse-stringify.module.js.map

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("void-elements")):"function"==typeof define&&define.amd?define(["void-elements"],t):(e=e||self).htmlParseStringify=t(e.voidElements)}(this,function(e){e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var t=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n(n){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=n.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(e[i[1].toLowerCase()]||"/"===n.charAt(n.length-2))&&(r.voidElement=!0),r.name.startsWith("!--"))){var s=n.indexOf("--\x3e");return{type:"comment",comment:-1!==s?n.slice(4,s):""}}for(var o=new RegExp(t),c=null;null!==(c=o.exec(n));)if(c[0].trim())if(c[1]){var a=c[1].trim(),u=[a,""];a.indexOf("=")>-1&&(u=a.split("=")),r.attrs[u[0]]=u[1],o.lastIndex--}else c[2]&&(r.attrs[c[2]]=c[3].trim().substring(1,c[3].length-1));return r}var r=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,i=Object.create(null);function s(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(s,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}return{parse:function(e,t){t||(t={}),t.components||(t.components=i);var s,o=[],c=[],a=-1,u=!1;if(0!==e.indexOf("<")){var l=e.indexOf("<");o.push({type:"text",content:-1===l?e:e.substring(0,l)})}return e.replace(r,function(r,i){if(u){if(r!=="</"+s.name+">")return;u=!1}var l,f="/"!==r.charAt(1),m=r.startsWith("\x3c!--"),d=i+r.length,p=e.charAt(d);if(m){var h=n(r);return a<0?(o.push(h),o):((l=c[a]).children.push(h),o)}if(f&&(a++,"tag"===(s=n(r)).type&&t.components[s.name]&&(s.type="component",u=!0),s.voidElement||u||!p||"<"===p||s.children.push({type:"text",content:e.slice(d,e.indexOf("<",d))}),0===a&&o.push(s),(l=c[a-1])&&l.children.push(s),c[a]=s),(!f||s.voidElement)&&(a>-1&&(s.voidElement||s.name===r.slice(2,-1))&&(a--,s=-1===a?o:c[a]),!u&&"<"!==p&&p)){l=-1===a?o:c[a].children;var v=e.indexOf("<",d),x=e.slice(d,-1===v?void 0:v);/^\s*$/.test(x)||l.push({type:"text",content:x})}}),o},stringify:function(e){return e.reduce(function(e,t){return e+s("",t)},"")}}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("void-elements")):"function"==typeof define&&define.amd?define(["void-elements"],t):(e=e||self).htmlParseStringify=t(e.voidElements)}(this,function(e){e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var t=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n(n){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=n.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(e[i[1].toLowerCase()]||"/"===n.charAt(n.length-2))&&(r.voidElement=!0),r.name.startsWith("!--"))){var s=n.indexOf("--\x3e");return{type:"comment",comment:-1!==s?n.slice(4,s):""}}for(var o=new RegExp(t),c=null;null!==(c=o.exec(n));)if(c[0].trim())if(c[1]){var a=c[1].trim(),l=[a,""];a.indexOf("=")>-1&&(l=a.split("=")),r.attrs[l[0]]=l[1],o.lastIndex--}else c[2]&&(r.attrs[c[2]]=c[3].trim().substring(1,c[3].length-1));return r}var r=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,i=/^\s*$/,s=Object.create(null);function o(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(o,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}return{parse:function(e,t){t||(t={}),t.components||(t.components=s);var o,c=[],a=[],l=-1,u=!1;if(0!==e.indexOf("<")){var f=e.indexOf("<");c.push({type:"text",content:-1===f?e:e.substring(0,f)})}return e.replace(r,function(r,s){if(u){if(r!=="</"+o.name+">")return;u=!1}var f,m="/"!==r.charAt(1),d=r.startsWith("\x3c!--"),p=s+r.length,h=e.charAt(p);if(d){var v=n(r);return l<0?(c.push(v),c):((f=a[l]).children.push(v),c)}if(m&&(l++,"tag"===(o=n(r)).type&&t.components[o.name]&&(o.type="component",u=!0),o.voidElement||u||!h||"<"===h||o.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===l&&c.push(o),(f=a[l-1])&&f.children.push(o),a[l]=o),(!m||o.voidElement)&&(l>-1&&(o.voidElement||o.name===r.slice(2,-1))&&(l--,o=-1===l?c:a[l]),!u&&"<"!==h&&h)){f=-1===l?c:a[l].children;var x=e.indexOf("<",p),g=e.slice(p,-1===x?void 0:x);i.test(g)&&(g=" "),(x>-1&&l+f.length>=0||" "!==g)&&f.push({type:"text",content:g})}}),c},stringify:function(e){return e.reduce(function(e,t){return e+o("",t)},"")}}});
//# sourceMappingURL=html-parse-stringify.umd.js.map
{
"name": "html-parse-stringify",
"description": "Parses well-formed HTML (meaning all tags closed) into an AST and back. quickly.",
"version": "2.1.1",
"version": "3.0.0",
"author": "Henrik Joreteg <henrik@joreteg.com>",

@@ -6,0 +6,0 @@ "bugs": {

@@ -138,3 +138,4 @@ # html-parse-stringify

- `2.1.1` Merged #41 which, fixed an issue with tag nesting. Thanks [@ericponto](https://github.com/ericponto).
- `3.0.0` Merged #46 which fixed an issue with handling of whitespace. Doing major version bump since this changes behavior if you have whitespace only nodes (see merged PR and #45 for more details). Thanks [@adrai](https://github.com/adrai) for this contribution!
- `2.1.1` Merged #41 which fixed an issue with tag nesting. Thanks [@ericponto](https://github.com/ericponto).
- `2.1.0` Merged support for numeric tags. This allows a use case described in [this PR](https://github.com/HenrikJoreteg/html-parse-stringify/pull/43). Thanks [@kachkaev](https://github.com/kachkaev).

@@ -141,0 +142,0 @@ - `2.0.3` Fixed failed publish. Accidentally published an empty package :sweat_smile:

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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