Fixed build script to exclude untagged snippets
This commit is contained in:
14
README.md
14
README.md
@ -46,7 +46,7 @@
|
|||||||
* [Current URL](#current-url)
|
* [Current URL](#current-url)
|
||||||
* [Element is visible in viewport](#element-is-visible-in-viewport)
|
* [Element is visible in viewport](#element-is-visible-in-viewport)
|
||||||
* [Get scroll position](#get-scroll-position)
|
* [Get scroll position](#get-scroll-position)
|
||||||
* [Redirect to URL](#redirect-to-url)
|
* [Redirect to url](#redirect-to-url)
|
||||||
* [Scroll to top](#scroll-to-top)
|
* [Scroll to top](#scroll-to-top)
|
||||||
|
|
||||||
### Function
|
### Function
|
||||||
@ -528,7 +528,17 @@ const getScrollPos = (el = window) =>
|
|||||||
|
|
||||||
[⬆ back to top](#table-of-contents)
|
[⬆ back to top](#table-of-contents)
|
||||||
|
|
||||||
undefined
|
### Redirect to URL
|
||||||
|
|
||||||
|
Use `window.location.href` or `window.location.replace()` to redirect to `url`.
|
||||||
|
Pass a second argument to simulate a link click (`true` - default) or an HTTP redirect (`false`).
|
||||||
|
|
||||||
|
```js
|
||||||
|
const redirect = (url, asLink = true) =>
|
||||||
|
asLink ? window.location.href = url : window.location.replace(url);
|
||||||
|
// redirect('https://google.com')
|
||||||
|
```
|
||||||
|
|
||||||
[⬆ back to top](#table-of-contents)
|
[⬆ back to top](#table-of-contents)
|
||||||
|
|
||||||
### Scroll to top
|
### Scroll to top
|
||||||
|
|||||||
@ -52,13 +52,13 @@ catch (err){
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
output += `${startPart+'\n'}`;
|
output += `${startPart+'\n'}`;
|
||||||
for(var tag of [...new Set(Object.entries(tagDbData).map(t => t[1]))].sort((a,b) => a.localeCompare(b))){
|
for(var tag of [...new Set(Object.entries(tagDbData).map(t => t[1]))].filter(v => v).sort((a,b) => a.localeCompare(b))){
|
||||||
output +=`### ${capitalize(tag, true)}\n`;
|
output +=`### ${capitalize(tag, true)}\n`;
|
||||||
for(var taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag))
|
for(var taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag))
|
||||||
output += `* [${taggedSnippet[0][0].toUpperCase() + taggedSnippet[0].replace(/-/g,' ').slice(1)}](#${taggedSnippet[0].replace(/\(/g,'').replace(/\)/g,'').toLowerCase()})\n`
|
output += `* [${taggedSnippet[0][0].toUpperCase() + taggedSnippet[0].replace(/-/g,' ').slice(1)}](#${taggedSnippet[0].replace(/\(/g,'').replace(/\)/g,'').toLowerCase()})\n`
|
||||||
output += '\n';
|
output += '\n';
|
||||||
}
|
}
|
||||||
for(var tag of [...new Set(Object.entries(tagDbData).map(t => t[1]))].sort((a,b) => a.localeCompare(b))){
|
for(var tag of [...new Set(Object.entries(tagDbData).map(t => t[1]))].filter(v => v).sort((a,b) => a.localeCompare(b))){
|
||||||
output +=`## ${capitalize(tag, true)}\n`;
|
output +=`## ${capitalize(tag, true)}\n`;
|
||||||
for(var taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag))
|
for(var taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag))
|
||||||
output += `\n${snippets[taggedSnippet[0]+'.md']+'\n[⬆ back to top](#table-of-contents)\n'}`;
|
output += `\n${snippets[taggedSnippet[0]+'.md']+'\n[⬆ back to top](#table-of-contents)\n'}`;
|
||||||
|
|||||||
@ -58,7 +58,7 @@ powerset:math
|
|||||||
promisify:function
|
promisify:function
|
||||||
random-integer-in-range:utility
|
random-integer-in-range:utility
|
||||||
random-number-in-range:utility
|
random-number-in-range:utility
|
||||||
redirect-to-URL:browser
|
redirect-to-url:browser
|
||||||
reverse-a-string:string
|
reverse-a-string:string
|
||||||
RGB-to-hexadecimal:utility
|
RGB-to-hexadecimal:utility
|
||||||
run-promises-in-series:function
|
run-promises-in-series:function
|
||||||
|
|||||||
Reference in New Issue
Block a user