mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-07 02:05:08 +08:00
chore: Merge pull request #727 from defaude/fix/586-build-pipeline
Proposal: Clean up CI job a bit
This commit is contained in:
108
.github/workflows/UpdateDirectory.js
vendored
108
.github/workflows/UpdateDirectory.js
vendored
@ -1,108 +0,0 @@
|
||||
// requiring path and fs modules
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
let URL_BASE = "https://github.com/TheAlgorithms/Javascript/blob/master";
|
||||
let g_output = [];
|
||||
|
||||
let filepaths = [];
|
||||
function good_filepaths(top_dir = ".") {
|
||||
fs.readdir(top_dir, function(err, list) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return;
|
||||
}
|
||||
list.forEach(function(file) {
|
||||
let path = top_dir + "/" + file;
|
||||
if (!file.startsWith(".")) {
|
||||
fs.stat(path, function(err, stat) {
|
||||
if (stat && stat.isDirectory()) {
|
||||
good_filepaths(path);
|
||||
} else {
|
||||
if (file.toLowerCase().endsWith(".js")) {
|
||||
filepaths.push(path.slice(2));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function md_prefix(i) {
|
||||
if (i) {
|
||||
let res = ' '.repeat(i);
|
||||
return res + "*";
|
||||
} else {
|
||||
return "\n##"
|
||||
}
|
||||
}
|
||||
|
||||
function print_path(old_path, new_path) {
|
||||
let old_parts = old_path.split(path.sep);
|
||||
let new_parts = new_path.split(path.sep);
|
||||
for (let i = 0; i < new_parts.length; ++i) {
|
||||
let new_part = new_parts[i];
|
||||
if (i + 1 > old_parts.len || old_parts[i] != new_part) {
|
||||
if (new_part) {
|
||||
g_output.push(`${md_prefix(i)} ${new_part.replace('_', ' ')}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new_path;
|
||||
}
|
||||
|
||||
function build_directory_md(top_dir = ".") {
|
||||
old_path = "";
|
||||
filepaths.sort(function(a, b) {
|
||||
if (a.toLowerCase() < b.toLowerCase()) return -1;
|
||||
if (a.toLowerCase() > b.toLowerCase()) return 1;
|
||||
return 0;
|
||||
});
|
||||
for (let filepath of filepaths) {
|
||||
file = filepath.split(path.sep);
|
||||
if (file.length == 1) {
|
||||
filepath = "";
|
||||
filename = file[0];
|
||||
} else {
|
||||
let total = file.length;
|
||||
filename = file[total - 1];
|
||||
filepath = file.splice(0, total - 1).join(path.sep);
|
||||
}
|
||||
if (filepath != old_path) {
|
||||
old_path = print_path(old_path, filepath);
|
||||
}
|
||||
let indent = 0;
|
||||
for (let i = 0; i < filepath.length; ++i) {
|
||||
if (filepath[i] == path.sep) {
|
||||
++indent;
|
||||
}
|
||||
}
|
||||
if (filepath) {
|
||||
++indent;
|
||||
}
|
||||
let urls = [URL_BASE, filepath, filename];
|
||||
let url = urls.join("/").replace(" ", "%20");
|
||||
// remove extension from filename
|
||||
filename = filename.split(".")[0];
|
||||
g_output.push(`${md_prefix(indent)} [${filename}](${url})`);
|
||||
}
|
||||
g_output = g_output.join('\n');
|
||||
return g_output;
|
||||
}
|
||||
|
||||
good_filepaths();
|
||||
setTimeout(() => {
|
||||
// once the filepaths have been computed
|
||||
build_directory_md();
|
||||
// console.log(filepaths);
|
||||
}, 1000);
|
||||
setTimeout(() => {
|
||||
// once the g_output has been constructed, write to the file
|
||||
fs.writeFile('DIRECTORY.md', g_output + '\n', (err) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
})
|
||||
// console.log(g_output);
|
||||
}, 1000);
|
83
.github/workflows/UpdateDirectory.mjs
vendored
Normal file
83
.github/workflows/UpdateDirectory.mjs
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import { globby } from 'globby'
|
||||
|
||||
const URL_BASE = 'https://github.com/TheAlgorithms/Javascript/blob/master'
|
||||
|
||||
function pathPrefix (i) {
|
||||
if (i) {
|
||||
const res = ' '.repeat(i)
|
||||
return res + '*'
|
||||
} else {
|
||||
return '\n##'
|
||||
}
|
||||
}
|
||||
|
||||
function printPath (oldPath, newPath, output) {
|
||||
const oldParts = oldPath.split(path.sep)
|
||||
const newParts = newPath.split(path.sep)
|
||||
for (let i = 0; i < newParts.length; ++i) {
|
||||
const newPart = newParts[i]
|
||||
if (i + 1 > oldParts.length || oldParts[i] !== newPart) {
|
||||
if (newPart) {
|
||||
output.push(`${pathPrefix(i)} ${newPart.replace('_', ' ')}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
return newPath
|
||||
}
|
||||
|
||||
function pathsToMarkdown (filePaths) {
|
||||
const output = []
|
||||
|
||||
let oldPath = ''
|
||||
filePaths.sort(function (a, b) {
|
||||
if (a.toLowerCase() < b.toLowerCase()) return -1
|
||||
if (a.toLowerCase() > b.toLowerCase()) return 1
|
||||
return 0
|
||||
})
|
||||
for (let filepath of filePaths) {
|
||||
const file = filepath.split(path.sep)
|
||||
let filename = ''
|
||||
if (file.length === 1) {
|
||||
filepath = ''
|
||||
filename = file[0]
|
||||
} else {
|
||||
const total = file.length
|
||||
filename = file[total - 1]
|
||||
filepath = file.splice(0, total - 1).join(path.sep)
|
||||
}
|
||||
if (filepath !== oldPath) {
|
||||
oldPath = printPath(oldPath, filepath, output)
|
||||
}
|
||||
let indent = 0
|
||||
for (let i = 0; i < filepath.length; ++i) {
|
||||
if (filepath[i] === path.sep) {
|
||||
++indent
|
||||
}
|
||||
}
|
||||
if (filepath) {
|
||||
++indent
|
||||
}
|
||||
|
||||
// prepare the markdown-esque prefix to the file's line
|
||||
const prefix = pathPrefix(indent)
|
||||
|
||||
// remove extension from filename
|
||||
const name = filename.split('.')[0]
|
||||
|
||||
// create URL to the actual file on github
|
||||
const url = encodeURI([URL_BASE, filepath, filename].join('/'))
|
||||
|
||||
output.push(`${prefix} [${name}](${url})`)
|
||||
}
|
||||
|
||||
return output.join('\n')
|
||||
}
|
||||
|
||||
// get paths of all .js files - excluding node_modules, the .github folder, tests and config stuff
|
||||
globby(['**/*.js', '!(node_modules|.github)/**/*', '!**/*.test.js', '!babel.config.js'])
|
||||
// create markdown content
|
||||
.then(pathsToMarkdown)
|
||||
// write markdown to file
|
||||
.then(markdown => fs.writeFileSync('DIRECTORY.md', markdown + '\n', { encoding: 'utf8' }))
|
23
.github/workflows/ci.yml
vendored
Normal file
23
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
name: Continuous Integration
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
|
||||
- name: 📦 Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: 🧪 Run tests
|
||||
run: |
|
||||
npm run doctest || true # TODO: Add all doctests
|
||||
npm test
|
||||
|
||||
- name: 💄 Code style
|
||||
run: npm run style
|
10
.github/workflows/commitAndPushDirectory.sh
vendored
Executable file
10
.github/workflows/commitAndPushDirectory.sh
vendored
Executable file
@ -0,0 +1,10 @@
|
||||
if ! git diff --quiet DIRECTORY.md; then
|
||||
echo Changes found, attempting to commit and push...
|
||||
git add DIRECTORY.md
|
||||
git commit -am "Auto-update DIRECTORY.md" || true
|
||||
git push --force origin HEAD:$GITHUB_REF || true
|
||||
echo ... done.
|
||||
else
|
||||
echo No changes found, exiting.
|
||||
fi
|
||||
|
24
.github/workflows/nodejs.yml
vendored
24
.github/workflows/nodejs.yml
vendored
@ -1,24 +0,0 @@
|
||||
name: Node CI
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: npm install, build, and test
|
||||
run: |
|
||||
npm install doctest standard --save-dev
|
||||
npx doctest **/*.js || true # TODO: Add all doctests
|
||||
npx standard
|
||||
npm ci
|
||||
npm run build --if-present
|
||||
npm test
|
||||
env:
|
||||
CI: true
|
28
.github/workflows/update_directory_md.yml
vendored
28
.github/workflows/update_directory_md.yml
vendored
@ -1,18 +1,26 @@
|
||||
# This GitHub Action updates the DIRECTORY.md file (if needed) when doing a git push
|
||||
name: update_directory_md
|
||||
name: Update Directory
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
update_directory_md:
|
||||
updateDirectory:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/setup-node@v1
|
||||
- run: |
|
||||
node .github/workflows/UpdateDirectory.js
|
||||
cat DIRECTORY.md
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
|
||||
- name: 📦 Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: 🗄️ Create Directory from JS files
|
||||
run: node .github/workflows/UpdateDirectory.mjs
|
||||
|
||||
- name: 🤓 Commit & push new Directory (if needed)
|
||||
run: |
|
||||
git config --global user.name github-actions
|
||||
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
|
||||
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
|
||||
git add DIRECTORY.md
|
||||
git commit -am "updating DIRECTORY.md" || true
|
||||
git push --force origin HEAD:$GITHUB_REF || true
|
||||
.github/workflows/commitAndPushDirectory.sh
|
||||
|
98
DIRECTORY.md
98
DIRECTORY.md
@ -1,6 +1,4 @@
|
||||
|
||||
## [babel](https://github.com/TheAlgorithms/Javascript/blob/master//babel.config.js)
|
||||
|
||||
## Backtracking
|
||||
* [GeneratePermutations](https://github.com/TheAlgorithms/Javascript/blob/master/Backtracking/GeneratePermutations.js)
|
||||
* [KnightTour](https://github.com/TheAlgorithms/Javascript/blob/master/Backtracking/KnightTour.js)
|
||||
@ -8,17 +6,10 @@
|
||||
* [RatInAMaze](https://github.com/TheAlgorithms/Javascript/blob/master/Backtracking/RatInAMaze.js)
|
||||
* [Sudoku](https://github.com/TheAlgorithms/Javascript/blob/master/Backtracking/Sudoku.js)
|
||||
* [SumOfSubset](https://github.com/TheAlgorithms/Javascript/blob/master/Backtracking/SumOfSubset.js)
|
||||
* tests
|
||||
* [NQueen](https://github.com/TheAlgorithms/Javascript/blob/master/Backtracking/tests/NQueen.test.js)
|
||||
* [RatInAMaze](https://github.com/TheAlgorithms/Javascript/blob/master/Backtracking/tests/RatInAMaze.test.js)
|
||||
* [Sudoku](https://github.com/TheAlgorithms/Javascript/blob/master/Backtracking/tests/Sudoku.test.js)
|
||||
* [SumOfSubset](https://github.com/TheAlgorithms/Javascript/blob/master/Backtracking/tests/SumOfSubset.test.js)
|
||||
|
||||
## Bit-Manipulation
|
||||
* [BinaryCountSetBits](https://github.com/TheAlgorithms/Javascript/blob/master/Bit-Manipulation/BinaryCountSetBits.js)
|
||||
* [SetBit](https://github.com/TheAlgorithms/Javascript/blob/master/Bit-Manipulation/SetBit.js)
|
||||
* test
|
||||
* [SetBit](https://github.com/TheAlgorithms/Javascript/blob/master/Bit-Manipulation/test/SetBit.test.js)
|
||||
|
||||
## Cache
|
||||
* [LFUCache](https://github.com/TheAlgorithms/Javascript/blob/master/Cache/LFUCache.js)
|
||||
@ -56,18 +47,12 @@
|
||||
* [RgbHsvConversion](https://github.com/TheAlgorithms/Javascript/blob/master/Conversions/RgbHsvConversion.js)
|
||||
* [RGBToHex](https://github.com/TheAlgorithms/Javascript/blob/master/Conversions/RGBToHex.js)
|
||||
* [RomanToDecimal](https://github.com/TheAlgorithms/Javascript/blob/master/Conversions/RomanToDecimal.js)
|
||||
* test
|
||||
* [DecimalToHex](https://github.com/TheAlgorithms/Javascript/blob/master/Conversions/test/DecimalToHex.test.js)
|
||||
* [DecimalToRoman](https://github.com/TheAlgorithms/Javascript/blob/master/Conversions/test/DecimalToRoman.test.js)
|
||||
* [TitleCaseConversion](https://github.com/TheAlgorithms/Javascript/blob/master/Conversions/test/TitleCaseConversion.test.js)
|
||||
* [UpperCaseConverstion](https://github.com/TheAlgorithms/Javascript/blob/master/Conversions/test/UpperCaseConverstion.test.js)
|
||||
* [TitleCaseConversion](https://github.com/TheAlgorithms/Javascript/blob/master/Conversions/TitleCaseConversion.js)
|
||||
* [UpperCaseConversion](https://github.com/TheAlgorithms/Javascript/blob/master/Conversions/UpperCaseConversion.js)
|
||||
|
||||
## Data-Structures
|
||||
* Array
|
||||
* [QuickSelect](https://github.com/TheAlgorithms/Javascript/blob/master/Data-Structures/Array/QuickSelect.js)
|
||||
* [QuickSelect](https://github.com/TheAlgorithms/Javascript/blob/master/Data-Structures/Array/QuickSelect.test.js)
|
||||
* Graph
|
||||
* [Graph](https://github.com/TheAlgorithms/Javascript/blob/master/Data-Structures/Graph/Graph.js)
|
||||
* [Graph2](https://github.com/TheAlgorithms/Javascript/blob/master/Data-Structures/Graph/Graph2.js)
|
||||
@ -112,11 +97,6 @@
|
||||
* [Shuf](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/Shuf.js)
|
||||
* [SieveOfEratosthenes](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/SieveOfEratosthenes.js)
|
||||
* [SudokuSolver](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/SudokuSolver.js)
|
||||
* tests
|
||||
* [CoinChange](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/tests/CoinChange.test.js)
|
||||
* [LongestPalindromicSubsequence](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/tests/LongestPalindromicSubsequence.test.js)
|
||||
* [LongestValidParentheses](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/tests/LongestValidParentheses.test.js)
|
||||
* [TrappingRainWater](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/tests/TrappingRainWater.test.js)
|
||||
* [TrappingRainWater](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/TrappingRainWater.js)
|
||||
* [ZeroOneKnapsack](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/ZeroOneKnapsack.js)
|
||||
|
||||
@ -138,8 +118,6 @@
|
||||
* [NodeNeighbors](https://github.com/TheAlgorithms/Javascript/blob/master/Graphs/NodeNeighbors.js)
|
||||
* [NumberOfIslands](https://github.com/TheAlgorithms/Javascript/blob/master/Graphs/NumberOfIslands.js)
|
||||
* [PrimMST](https://github.com/TheAlgorithms/Javascript/blob/master/Graphs/PrimMST.js)
|
||||
* test
|
||||
* [BellmanFord](https://github.com/TheAlgorithms/Javascript/blob/master/Graphs/test/BellmanFord.test.js)
|
||||
|
||||
## Hashes
|
||||
* [SHA1](https://github.com/TheAlgorithms/Javascript/blob/master/Hashes/SHA1.js)
|
||||
@ -204,52 +182,11 @@
|
||||
* [Softmax](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/Softmax.js)
|
||||
* [SquareRoot](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/SquareRoot.js)
|
||||
* [SumOfDigits](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/SumOfDigits.js)
|
||||
* test
|
||||
* [Abs](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/Abs.test.js)
|
||||
* [Area](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/Area.test.js)
|
||||
* [ArmstrongNumber](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/ArmstrongNumber.test.js)
|
||||
* [AverageMean](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/AverageMean.test.js)
|
||||
* [AverageMedian](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/AverageMedian.test.js)
|
||||
* [BInaryConvert](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/BInaryConvert.test.js)
|
||||
* [BinaryExponentiationIterative](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/BinaryExponentiationIterative.test.js)
|
||||
* [Coordinate](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/Coordinate.test.js)
|
||||
* [DegreeToRadian](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/DegreeToRadian.test.js)
|
||||
* [DigitSum](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/DigitSum.test.js)
|
||||
* [EulersTotientFunction](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/EulersTotientFunction.test.js)
|
||||
* [Factorial](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/Factorial.test.js)
|
||||
* [Factors](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/Factors.test.js)
|
||||
* [FareyApproximation](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/FareyApproximation.test.js)
|
||||
* [Fibonacci](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/Fibonacci.test.js)
|
||||
* [FindHcf](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/FindHcf.test.js)
|
||||
* [FindLcm](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/FindLcm.test.js)
|
||||
* [GridGet](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/GridGet.test.js)
|
||||
* [IsDivisible](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/IsDivisible.test.js)
|
||||
* [IsEven](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/IsEven.test.js)
|
||||
* [MeanSquareError](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/MeanSquareError.test.js)
|
||||
* [ModularBinaryExponentiationRecursive](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/ModularBinaryExponentiationRecursive.test.js)
|
||||
* [NumberOfDigits](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/NumberOfDigits.test.js)
|
||||
* [Palindrome](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/Palindrome.test.js)
|
||||
* [PascalTriangle](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/PascalTriangle.test.js)
|
||||
* [PerfectCube](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/PerfectCube.test.js)
|
||||
* [PerfectNumber](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/PerfectNumber.test.js)
|
||||
* [PerfectSquare](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/PerfectSquare.test.js)
|
||||
* [PiApproximationMonteCarlo](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/PiApproximationMonteCarlo.test.js)
|
||||
* [Polynomial](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/Polynomial.test.js)
|
||||
* [Pow](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/Pow.test.js)
|
||||
* [PrimeCheck](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/PrimeCheck.test.js)
|
||||
* [RadianToDegree](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/RadianToDegree.test.js)
|
||||
* [ReversePolishNotation](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/ReversePolishNotation.test.js)
|
||||
* [SieveOfEratosthenes](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/SieveOfEratosthenes.test.js)
|
||||
* [Softmax](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/Softmax.test.js)
|
||||
* [SumOfDigits](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/SumOfDigits.test.js)
|
||||
* [Volume](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/test/Volume.test.js)
|
||||
* [Volume](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/Volume.js)
|
||||
* [WhileLoopFactorial](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/WhileLoopFactorial.js)
|
||||
|
||||
## Navigation
|
||||
* [Haversine](https://github.com/TheAlgorithms/Javascript/blob/master/Navigation/Haversine.js)
|
||||
* test
|
||||
* [Haversine](https://github.com/TheAlgorithms/Javascript/blob/master/Navigation/test/Haversine.test.js)
|
||||
|
||||
## Project-Euler
|
||||
* [Problem013](https://github.com/TheAlgorithms/Javascript/blob/master/Project-Euler/Problem013.js)
|
||||
@ -266,9 +203,6 @@
|
||||
* [Problem7](https://github.com/TheAlgorithms/Javascript/blob/master/Project-Euler/Problem7.js)
|
||||
* [Problem8](https://github.com/TheAlgorithms/Javascript/blob/master/Project-Euler/Problem8.js)
|
||||
* [Problem9](https://github.com/TheAlgorithms/Javascript/blob/master/Project-Euler/Problem9.js)
|
||||
* test
|
||||
* [Problem10](https://github.com/TheAlgorithms/Javascript/blob/master/Project-Euler/test/Problem10.test.js)
|
||||
* [Problem8](https://github.com/TheAlgorithms/Javascript/blob/master/Project-Euler/test/Problem8.test.js)
|
||||
|
||||
## Recursive
|
||||
* [BinaryEquivalent](https://github.com/TheAlgorithms/Javascript/blob/master/Recursive/BinaryEquivalent.js)
|
||||
@ -293,9 +227,6 @@
|
||||
* [SlidingWindow](https://github.com/TheAlgorithms/Javascript/blob/master/Search/SlidingWindow.js)
|
||||
* [StringSearch](https://github.com/TheAlgorithms/Javascript/blob/master/Search/StringSearch.js)
|
||||
* [TernarySearch](https://github.com/TheAlgorithms/Javascript/blob/master/Search/TernarySearch.js)
|
||||
* test
|
||||
* [SlidingWindow](https://github.com/TheAlgorithms/Javascript/blob/master/Search/test/SlidingWindow.test.js)
|
||||
* [TernarySearch](https://github.com/TheAlgorithms/Javascript/blob/master/Search/test/TernarySearch.test.js)
|
||||
|
||||
## Sorts
|
||||
* [BeadSort](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/BeadSort.js)
|
||||
@ -322,10 +253,6 @@
|
||||
* [RadixSort](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/RadixSort.js)
|
||||
* [SelectionSort](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/SelectionSort.js)
|
||||
* [ShellSort](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/ShellSort.js)
|
||||
* test
|
||||
* [FisherYatesShuffle](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/test/FisherYatesShuffle.test.js)
|
||||
* [QuickSortRecursive](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/test/QuickSortRecursive.test.js)
|
||||
* [SelectionSort](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/test/SelectionSort.test.js)
|
||||
* [TimSort](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/TimSort.js)
|
||||
* [TopologicalSort](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/TopologicalSort.js)
|
||||
* [WiggleSort](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/WiggleSort.js)
|
||||
@ -357,36 +284,11 @@
|
||||
* [ReverseString](https://github.com/TheAlgorithms/Javascript/blob/master/String/ReverseString.js)
|
||||
* [ReverseWords](https://github.com/TheAlgorithms/Javascript/blob/master/String/ReverseWords.js)
|
||||
* [ScrambleStrings](https://github.com/TheAlgorithms/Javascript/blob/master/String/ScrambleStrings.js)
|
||||
* test
|
||||
* [CheckAnagram](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/CheckAnagram.test.js)
|
||||
* [CheckCamelCase](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/CheckCamelCase.test.js)
|
||||
* [CheckFlatCase](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/CheckFlatCase.test.js)
|
||||
* [CheckPalindrome](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/CheckPalindrome.test.js)
|
||||
* [CheckPangram](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/CheckPangram.test.js)
|
||||
* [CheckSnakeCase](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/CheckSnakeCase.test.js)
|
||||
* [CheckVowels](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/CheckVowels.test.js)
|
||||
* [CheckWordOcurrence](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/CheckWordOcurrence.test.js)
|
||||
* [CreatePermutations](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/CreatePermutations.test.js)
|
||||
* [DiceCoefficient](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/DiceCoefficient.test.js)
|
||||
* [FormatPhoneNumber](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/FormatPhoneNumber.test.js)
|
||||
* [HammingDistance](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/HammingDistance.test.js)
|
||||
* [KMPPatternSearching](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/KMPPatternSearching.test.js)
|
||||
* [LevenshteinDistance](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/LevenshteinDistance.test.js)
|
||||
* [MaxCharacter](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/MaxCharacter.test.js)
|
||||
* [MaxWord](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/MaxWord.test.js)
|
||||
* [PatternMatching](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/PatternMatching.test.js)
|
||||
* [PermutateString](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/PermutateString.test.js)
|
||||
* [ReverseString](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/ReverseString.test.js)
|
||||
* [ReverseWords](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/ReverseWords.test.js)
|
||||
* [ScrambleStrings](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/ScrambleStrings.test.js)
|
||||
* [ValidateEmail](https://github.com/TheAlgorithms/Javascript/blob/master/String/test/ValidateEmail.test.js)
|
||||
* [ValidateEmail](https://github.com/TheAlgorithms/Javascript/blob/master/String/ValidateEmail.js)
|
||||
|
||||
## Timing-Functions
|
||||
* [GetMonthDays](https://github.com/TheAlgorithms/Javascript/blob/master/Timing-Functions/GetMonthDays.js)
|
||||
* [IntervalTimer](https://github.com/TheAlgorithms/Javascript/blob/master/Timing-Functions/IntervalTimer.js)
|
||||
* test
|
||||
* [GetMonthDays](https://github.com/TheAlgorithms/Javascript/blob/master/Timing-Functions/test/GetMonthDays.test.js)
|
||||
|
||||
## Trees
|
||||
* [BreadthFirstTreeTraversal](https://github.com/TheAlgorithms/Javascript/blob/master/Trees/BreadthFirstTreeTraversal.js)
|
||||
|
129
package-lock.json
generated
129
package-lock.json
generated
@ -2173,6 +2173,32 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"@nodelib/fs.scandir": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||
"integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@nodelib/fs.stat": "2.0.5",
|
||||
"run-parallel": "^1.1.9"
|
||||
}
|
||||
},
|
||||
"@nodelib/fs.stat": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
|
||||
"integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
|
||||
"dev": true
|
||||
},
|
||||
"@nodelib/fs.walk": {
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
|
||||
"integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@nodelib/fs.scandir": "2.1.5",
|
||||
"fastq": "^1.6.0"
|
||||
}
|
||||
},
|
||||
"@sinonjs/commons": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.1.tgz",
|
||||
@ -2430,6 +2456,12 @@
|
||||
"is-string": "^1.0.5"
|
||||
}
|
||||
},
|
||||
"array-union": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/array-union/-/array-union-3.0.1.tgz",
|
||||
"integrity": "sha512-1OvF9IbWwaeiM9VhzYXVQacMibxpXOMYVNIvMtKRyX9SImBXpKcFr8XvFDeEslCyuH/t6KRt7HEO94AlP8Iatw==",
|
||||
"dev": true
|
||||
},
|
||||
"array-unique": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz",
|
||||
@ -3199,6 +3231,23 @@
|
||||
"integrity": "sha512-ZXx86srb/iYy6jG71k++wBN9P9J05UNQ5hQHQd9MtMPvcqXPx/vKU69jfHV637D00Q2gSgPk2D+jSx3l1lDW/Q==",
|
||||
"dev": true
|
||||
},
|
||||
"dir-glob": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
|
||||
"integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-type": "^4.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"path-type": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
|
||||
"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"doctest": {
|
||||
"version": "0.17.1",
|
||||
"resolved": "https://registry.npmjs.org/doctest/-/doctest-0.17.1.tgz",
|
||||
@ -3909,6 +3958,37 @@
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
|
||||
},
|
||||
"fast-glob": {
|
||||
"version": "3.2.7",
|
||||
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz",
|
||||
"integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@nodelib/fs.stat": "^2.0.2",
|
||||
"@nodelib/fs.walk": "^1.2.3",
|
||||
"glob-parent": "^5.1.2",
|
||||
"merge2": "^1.3.0",
|
||||
"micromatch": "^4.0.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"micromatch": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz",
|
||||
"integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"braces": "^3.0.1",
|
||||
"picomatch": "^2.2.3"
|
||||
}
|
||||
},
|
||||
"picomatch": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz",
|
||||
"integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"fast-json-stable-stringify": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
|
||||
@ -3919,6 +3999,15 @@
|
||||
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
|
||||
"integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc="
|
||||
},
|
||||
"fastq": {
|
||||
"version": "1.13.0",
|
||||
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz",
|
||||
"integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"reusify": "^1.0.4"
|
||||
}
|
||||
},
|
||||
"fb-watchman": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.1.tgz",
|
||||
@ -4119,6 +4208,34 @@
|
||||
"type-fest": "^0.8.1"
|
||||
}
|
||||
},
|
||||
"globby": {
|
||||
"version": "12.0.2",
|
||||
"resolved": "https://registry.npmjs.org/globby/-/globby-12.0.2.tgz",
|
||||
"integrity": "sha512-lAsmb/5Lww4r7MM9nCCliDZVIKbZTavrsunAsHLr9oHthrZP1qi7/gAnHOsUs9bLvEt2vKVJhHmxuL7QbDuPdQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"array-union": "^3.0.1",
|
||||
"dir-glob": "^3.0.1",
|
||||
"fast-glob": "^3.2.7",
|
||||
"ignore": "^5.1.8",
|
||||
"merge2": "^1.4.1",
|
||||
"slash": "^4.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ignore": {
|
||||
"version": "5.1.8",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz",
|
||||
"integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==",
|
||||
"dev": true
|
||||
},
|
||||
"slash": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz",
|
||||
"integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"graceful-fs": {
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
|
||||
@ -7245,6 +7362,12 @@
|
||||
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
|
||||
"dev": true
|
||||
},
|
||||
"merge2": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
|
||||
"integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
|
||||
"dev": true
|
||||
},
|
||||
"micromatch": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
|
||||
@ -8278,6 +8401,12 @@
|
||||
"integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
|
||||
"dev": true
|
||||
},
|
||||
"reusify": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
|
||||
"integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==",
|
||||
"dev": true
|
||||
},
|
||||
"rimraf": {
|
||||
"version": "2.6.3",
|
||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
|
||||
|
@ -4,7 +4,9 @@
|
||||
"description": "A repository for All algorithms implemented in Javascript (for educational purposes only)",
|
||||
"main": "",
|
||||
"scripts": {
|
||||
"test": "jest --no-cache"
|
||||
"doctest": "doctest **/*.js",
|
||||
"test": "jest --no-cache",
|
||||
"style": "standard"
|
||||
},
|
||||
"author": "TheAlgorithms",
|
||||
"license": "GPL-3.0",
|
||||
@ -25,6 +27,7 @@
|
||||
"devDependencies": {
|
||||
"babel-jest": "^26.3.0",
|
||||
"doctest": "^0.17.1",
|
||||
"globby": "^12.0.2",
|
||||
"jest": "^26.4.2",
|
||||
"standard": "^14.3.4"
|
||||
}
|
||||
|
Reference in New Issue
Block a user