Created
June 3, 2022 11:36
-
-
Save guillemcanal/cb4dcc2a8833bb48fc764f0b7ee2c6cf to your computer and use it in GitHub Desktop.
theredoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(){"use sctrict";function n(n){return/^\s*$/.test(n)}window.theredoc=function(t,...e){const c=function(t){const e=n(t[0]),c=n(t[t.length-1]);return e||c?t.slice(e?1:0,c?t.length-1:t.length):t}(function(n,t){let e="";return n.forEach((n,c)=>{e+=n+(t[c]||"")}),e}(t,e).split("\n"));return function(n,t){const e=new RegExp(`^ {${t}}`);return n.map(n=>e.test(n)?n.replace(e,""):n)}(c,function(n){let t=null;return n.forEach(n=>{const e=n.search(/[^ ]/);-1!==e&&(null===t||e<t)&&(t=e)}),t}(c)).join("\n")}}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment