| /** | |
| * Stringifies a comment. | |
| * | |
| * Empty comment lines are left empty, | |
| * lines consisting of a single space are replaced by `#`, | |
| * and all other lines are prefixed with a `#`. | |
| */ | |
| const stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, '#'); | |
| function indentComment(comment, indent) { | |
| if (/^\n+$/.test(comment)) | |
| return comment.substring(1); | |
| return indent ? comment.replace(/^(?! *$)/gm, indent) : comment; | |
| } | |
| const lineComment = (str, indent, comment) => str.endsWith('\n') | |
| ? indentComment(comment, indent) | |
| : comment.includes('\n') | |
| ? '\n' + indentComment(comment, indent) | |
| : (str.endsWith(' ') ? '' : ' ') + comment; | |
| export { indentComment, lineComment, stringifyComment }; | |
Xet Storage Details
- Size:
- 724 Bytes
- Xet hash:
- 0af8bfd969f6d80f03a8a2b8b1ca3c21ba4991097c9db6eebcee1613beb20cb4
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.