forked from gcanti/fp-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode2comment.html
More file actions
29 lines (26 loc) · 751 Bytes
/
code2comment.html
File metadata and controls
29 lines (26 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>code 2 comment</title>
</head>
<body>
<div id="app">
<textarea id="code" cols="100" rows="20"></textarea>
<textarea id="comment" cols="100" rows="20"></textarea>
<button id="transform">transform</button>
</div>
<script>
const transform = document.getElementById('transform')
const code = document.getElementById('code')
const comment = document.getElementById('comment')
transform.onclick = () => {
comment.value = t(code.value)
}
function t(src) {
const lines = src.split('\n').map(line => '* ' + line.replace('../src/', 'fp-ts/lib/'))
return '*\n* @example\n' + lines.join('\n') + '\n'
}
</script>
</body>
</html>