01.09.2021, 02:32 | #1 |
Участник
|
crmtipoftheday: Tip #1410: 50 Shades of Regex
Источник: https://crmtipoftheday.com/1410/50-s...hades-of-regex
============== I usually don’t drool over code but this one is just way too elegant for me not to. StackEdit – In-browser Markdown editor is an awesome app for markdown editing. One of the standout features is ability to comment and review – something sorely missing from the standard markdown. StackEdit very cleverly serializes reviews and notes as a base64 string and inserts it at the end of the document using HTML comment . As part of the exercise this comment is saved very tidily in a 50 char wide column. So how does one wrap a string at a fixed width? This is the genius line: const serializedData = utils.encodeBase64(JSON.stringify(data)) .replace(/(.{50})/g, '$1\n'); What does it do?
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|