This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sort(arrL, arrR) { | |
const newArray = [] | |
while (arrL.length && arrR.length) { | |
arrR[0] < arrL[0] | |
? newArray.push(arrR.shift()) | |
: newArray.push(arrL.shift()) | |
} | |
return newArray.concat(arrL, arrR) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generatePassword(length = 50) { | |
if (length < 5) throw new Error('Length must be minimum of 5') | |
const chars = 'abcdefghijklmopqrstnuvwxyz-[]{}()*-+,./\\1234567890' | |
let result = '' | |
for (let i = 0; i < length; i++) { | |
const randomChars = chars[Math.floor(Math.random() * chars.length)] | |
result += randomChars | |
} | |
return result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs' | |
const ignoreRegex = /_(.*?).md/ | |
const isMd = (value) => /\.md$/.test(value) | |
function generateMdPaths(data, currentPath = '', ext = '') { | |
return data.reduce((acc, value) => { | |
if (ignoreRegex.test(value)) return acc | |
if (!isMd(value)) { | |
const path = `${currentPath}/${value}/` |
NewerOlder