console.log(hered0c);
- !
.
,
!
... © HEREDOC
!function (root) { function heredoc(fn) { return fn.toString().split('\n').slice(1,-1).join('\n') + '\n' } var stripPattern = /^\s*(?=[^\s]+)/mg heredoc.strip = function(fn) { var text = heredoc(fn) var indentLen = text.match(stripPattern) .reduce(function (min, line) { return Math.min(min, line.length) }, Infinity) var indent = new RegExp('^\\s{' + indentLen + '}', 'mg') return indentLen > 0 ? text.replace(indent, '') : text } if (typeof exports === 'object') { module.exports = heredoc } else if (typeof define === 'function' && define.amd) { define(function() { return heredoc }) } else { root.heredoc = heredoc } }(this)
var hered0c = heredoc(function () {/* - ! . , ! ... © HEREDOC */}); console.log(hered0c);
Source: https://habr.com/ru/post/230887/
All Articles