54 Commits

Author SHA1 Message Date
a5945e37c2 fix: throw error instead of returning it (#1624) 2024-02-29 10:25:11 +05:30
86d333ee94 feat: Test running overhaul, switch to Prettier & reformat everything (#1407)
* chore: Switch to Node 20 + Vitest

* chore: migrate to vitest mock functions

* chore: code style (switch to prettier)

* test: re-enable long-running test

Seems the switch to Node 20 and Vitest has vastly improved the code's and / or the test's runtime!

see #1193

* chore: code style

* chore: fix failing tests

* Updated Documentation in README.md

* Update contribution guidelines to state usage of Prettier

* fix: set prettier printWidth back to 80

* chore: apply updated code style automatically

* fix: set prettier line endings to lf again

* chore: apply updated code style automatically

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2023-10-04 02:38:19 +05:30
0ca18c2b2c fix: added reverse string inplace (#1406)
Co-authored-by: madhuredra <madhuredra.tiwari@zemosolabs.com>
2023-10-02 23:06:45 +05:30
36dcff8c5d feat: New String Algorithm for LengthofLongestSubstringWithoutRepeati… (#1389)
* feat: New String Algorithm for LengthofLongestSubstringWithoutRepeatingCharacters

* Fixed Errors and Mistakes in New Algorithm LengthofLongestSubstringWithoutRepetition

* fix:#1389 Errors Fixed

* fix:#1389 Syntax and Code Errors Fixed

* fix:#1389 Errors FIxed

* Fixed All new errors

* fix:1389 Implemented suggestions and corrections

* Use @see annotation

---------

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2023-10-02 22:18:20 +05:30
b7836122ff fix: ValidateURL failing tests (#1394)
* test: remove ValidateUrl.test.js

The code was removed with ecac786d but the test was left here (and has been failing since then, obviously 🤣)

* test: remove conflicting test case

There is another test case that explicitly expects the `null` result when the input array only contains one element.

* Updated Documentation in README.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-02 12:43:37 +05:30
00a97d5e1b algorithm: percentage of letter (#1261) 2022-11-01 09:15:02 +05:30
7fb121508d algorithm: ZFunction (#1239)
* algorithm: ZFunction

* made requested changes

* corrected spelling mistakes

* made requested changes
2022-10-31 22:12:06 +05:30
55f502e1f1 algorithm: count letters (#1164) 2022-10-19 16:52:27 +05:30
c365e82d08 Adding testcases for Boyer Moore Algorithm (#1135) 2022-10-07 10:44:11 +05:30
d05bbf77c6 algorithm: first unique char in a string (#1103)
* feat: Added Algo first unique char in a string.

* Optimised algo to linear time complexity

* removed double quotes

* Review changes: if-else logic
2022-09-22 17:20:04 +05:30
6c718c01d4 add: countSubstrings function implementation (#1091) 2022-09-07 15:03:24 +05:30
6b06b3a37f merge: Add new IsPalindrome implementation (#1046) 2022-06-16 22:28:59 +05:30
d59213d0b8 merge: Add test case to CheckPascalCase Algorithm (#1029) 2022-05-31 14:25:31 +05:30
162e90f3d2 merge: Add test case to palindromeRearranging Algorithm (#1030)
* Add test case to CheckPascalCase Algorithm

* Add test case to palindromeRearranging Algorithm

* no need
2022-05-31 14:24:57 +05:30
07e77fac1c merge: Add testcase to AlternativeStringArrange Algorithm (#1026)
* Add test case to HexToRGB algorithm

* Add testcase to AlternativeStringArrange Algorithm

* deleting coppy file
2022-05-30 19:50:04 +05:30
9befd923b1 Add testcase to checkKebabCase (#1027) 2022-05-30 16:18:42 +02:00
c865654f27 Clean up phone number formatting (#1015) 2022-05-16 18:48:16 +02:00
cbc669aa9d merge: Upgraded Algorithm of alpha numeric palindrome (#1006)
* feat: improved memoize function

used Map instead of object & used the JSON.stringfy method for generate a valid string as a key

* docs: modified documentation

* style: format with standard

* docs: modified stringify doc

* refactor: remove two repetition implementation

* feat: added validation, test codes

* chore: remove useless words

* feat: added types for jest

* chore: added link box

* feat: added new validation test casses & methods

* style: formated with standard

* feat: added parse method & test cases

* docs: added js docs

* chore: added default import export

* feat: imporved algorithm via replace method

* test: added two test cases

* feat: added jest type for suggestions

* feat: added `reduceRight` & `trim` method

* chore: added helper variable

* feat: added new rotation option

* Revert "chore: added helper variable"

This reverts commit 489544da0a3d479910fbea020d3be3d0d10681bf.

* remove: yarn lock

* chore: fix grammer

* feat: used replace method & added test case

* feat: remove revert

* chore: added new line

* feat: optimized algo n to n / 2 & replaced test cases

* chore: update node version

* chore: set node version to lts

* chore: updated the node version & added engines prop

* resolve: removed while loop

* chore: added right shift ops comment

* chore: update comment

* chore: removed abs

Co-authored-by: Rak Laptudirm <raklaptudirm@gmail.com>
2022-05-07 17:42:50 +05:30
28062533b6 merge: Upgrade max char (#983)
* feat: improved memoize function

used Map instead of object & used the JSON.stringfy method for generate a valid string as a key

* docs: modified documentation

* style: format with standard

* docs: modified stringify doc

* refactor: remove two repetition implementation

* feat: added validation, test codes

* chore: remove useless words

* feat: added types for jest

* chore: added link box

* feat: added new validation test casses & methods

* style: formated with standard

* feat: added parse method & test cases

* docs: added js docs

* chore: added default import export

* feat: imporved algorithm via replace method

* test: added two test cases

* feat: added jest type for suggestions

* feat: added `reduceRight` & `trim` method

* chore: added helper variable

* feat: added new rotation option

* Revert "chore: added helper variable"

This reverts commit 489544da0a3d479910fbea020d3be3d0d10681bf.

* remove: yarn lock

* chore: fix grammer

* feat: used replace method & added test case

* feat: remove revert

* chore: added new line

* feat: added filter for alphabets only

* resolve: added empty validation improved ignore pattern

* chore: reverted to for of loop
2022-05-02 14:51:16 +05:30
27ae62e5c9 merge: reduce upper & lower & add export default (#960) 2022-03-28 14:59:21 +05:30
3b9af469f6 merge: added reduceRight & trim method (#961) 2022-03-28 14:27:32 +05:30
9681688797 merge: Add CheckExceeding function (#907)
* feat: add checkExceeding function

* test: add test cases of checkExceeding func

* test: add more not increasing words
2022-03-22 14:37:42 +05:30
eb748ae78d merge: Fixed wordOccurrence algorithm (#909)
* resolved: upgrade the algoritm

* docs: add js doc
2022-03-02 10:43:01 +05:30
e8de031539 merge: Improved pangram algorithm using regular expressions (#906)
* feat: used regex instead of Set

* docs: add js doc

* docs: add comments of workable code

* style: format via standardJs

* docs: add details explanation of pangram regex

* docs: add example

* feat: add two implemetaion of

The first implementation with regex and second via HashSet & add the test code for both

* chore: add QNA format of **Pangram**

* style: format with standardJs

* resolve: removed 'Ans'
2022-02-28 10:59:09 +05:30
d466be977e merge: Upgrade checkAnagram function & Fixes (#902)
* pref: optimize the algo via reduce & replace method

* feat: add TypeError for invalid types

* test: upgrade test case for invalid types

* docs: add js doc

* test: modify the case-sensitive test case

* pref: Optimize algo & add case-insensitive mode

* style: format with standard style

* docs: fix the js doc

* docs: rename function name & add comments

* feat: add chackAnagramViaMap function

* test: add test case for checkAnagramViaMap func

* fix: remove **Via** from functions name

* style: fix alignment of js doc

* chore: grammar fix

Co-authored-by: Rak Laptudirm <raklaptudirm@gmail.com>
2022-02-25 21:56:30 +05:30
041918d7b7 merge: Upgrade Lower function (#894)
* docs: update the js doc

* pref: Optimize algo via regex

ignore the useless traverse in best case via regex and String.prototype.replace

* test: add some new test cases

* fix: styled with standard

* refactor: remove useless variable
2022-02-19 17:08:55 +05:30
c30b897324 merge: count Vowels (#864) 2021-12-11 13:30:26 +05:30
43515a646b merge: Add Upper (#862) 2021-12-06 21:26:14 +05:30
4c27e1534e merge: Add lower (#863) 2021-12-04 11:01:58 +05:30
6fb649e53d merge: Add ValidateUrl in String (#856)
* Add ValidateUrl in String

* change regex

* Bug fix
2021-12-02 16:23:54 +05:30
85b0571d81 chore: Strings: Credit Card Validation (#830)
* Add credit card number validator

- Validates the credit card number based on Luhn algorithm

* Test Cases: ValidateCreditCard

* Auto-update DIRECTORY.md

* Fix: Spell check

* Add references and move const inside function

* Add comments

* Fix trailing spaces

* Add short description

* Remove trailing spaces

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-11-04 13:34:52 +05:30
072523d594 merge: Fix spellings (#821)
* chore: remove codespell from ci

* feat: add codespell workflow

* fix: codespell workflow

* fix: ignore spellings in directory

* chore: fix spellings

./Dynamic-Programming/KadaneAlgo.js:2: contiguos ==> contiguous
./Dynamic-Programming/KadaneAlgo.js:14: posible ==> possible

* chore: fix spelling

./Dynamic-Programming/SieveOfEratosthenes.js:4: upto ==> up to

* chore: fix spellings

./Dynamic-Programming/MaxNonAdjacentSum.js:22: Exmaple ==> Example

* chore: fix spelling

./Project-Euler/test/Problem010.test.js:4: upto ==> up to
./Project-Euler/test/Problem010.test.js:8: upto ==> up to
./Project-Euler/test/Problem010.test.js:12: upto ==> up to

* chore: fix spelling

./String/AlphaNumericPalindrome.js:10: recieves ==> receives
./String/AlphaNumericPalindrome.js:10: sting ==> string
./String/AlphaNumericPalindrome.js:46: varaible ==> variable

* chore: fix spelling

./String/DiceCoefficient.js:3: stings ==> strings

* chore: fix spelling

./String/test/DiceCoefficient.test.js:9: atleast ==> at least

* chore: fix spelling

./String/test/MaxWord.test.js:8: ba ==> be

* chore: ignore `PermutateString.test.js`

* chore: fix spelling

./String/test/CheckVowels.test.js:62: occurances ==> occurrences

* chore: ignore `SubsequenceRecursive.js`

* chore: fix spelling

./Conversions/TemperatureConversion.js:2: arguement ==> argument

* chore: fix spelling

./Conversions/RailwayTimeConversion.js:7: Formate ==> Format
./Conversions/RailwayTimeConversion.js:8: Formate ==> Format

* chore: remove Linear Algebra

The deleted directory hosted a package which are not accepted by this repository.

* Auto-update DIRECTORY.md

* chore: fix spelling

* chore: fix spellings

* merge: Created composite Simpson's integration method. Tests included. (#819)

* Created composite Simpson's integration method.Tests included

* Minor corrections

* Auto-update DIRECTORY.md

* Styled with standard.js

* chore: remove blank line

* chore: remove blank line

Co-authored-by: ggkogkou <ggkogkou@ggkogkou.gr>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Rak Laptudirm <raklaptudirm@gmail.com>

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: remove codespell from ci

* feat: add codespell workflow

* fix: codespell workflow

* fix: ignore spellings in directory

* chore: fix spellings

./Dynamic-Programming/KadaneAlgo.js:2: contiguos ==> contiguous
./Dynamic-Programming/KadaneAlgo.js:14: posible ==> possible

* chore: fix spelling

./Dynamic-Programming/SieveOfEratosthenes.js:4: upto ==> up to

* chore: fix spellings

./Dynamic-Programming/MaxNonAdjacentSum.js:22: Exmaple ==> Example

* chore: fix spelling

./Project-Euler/test/Problem010.test.js:4: upto ==> up to
./Project-Euler/test/Problem010.test.js:8: upto ==> up to
./Project-Euler/test/Problem010.test.js:12: upto ==> up to

* chore: fix spelling

./String/AlphaNumericPalindrome.js:10: recieves ==> receives
./String/AlphaNumericPalindrome.js:10: sting ==> string
./String/AlphaNumericPalindrome.js:46: varaible ==> variable

* chore: fix spelling

./String/DiceCoefficient.js:3: stings ==> strings

* chore: fix spelling

./String/test/DiceCoefficient.test.js:9: atleast ==> at least

* chore: fix spelling

./String/test/MaxWord.test.js:8: ba ==> be

* chore: ignore `PermutateString.test.js`

* chore: fix spelling

./String/test/CheckVowels.test.js:62: occurances ==> occurrences

* chore: ignore `SubsequenceRecursive.js`

* chore: fix spelling

./Conversions/TemperatureConversion.js:2: arguement ==> argument

* chore: fix spelling

./Conversions/RailwayTimeConversion.js:7: Formate ==> Format
./Conversions/RailwayTimeConversion.js:8: Formate ==> Format

* chore: remove Linear Algebra

The deleted directory hosted a package which are not accepted by this repository.

* Auto-update DIRECTORY.md

* chore: fix spelling

* chore: fix spellings

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: no need to check filenames

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: ggkogkou <76820848+ggkogkou@users.noreply.github.com>
Co-authored-by: ggkogkou <ggkogkou@ggkogkou.gr>
2021-10-28 15:37:43 +05:30
db5b4af730 formatting with standardjs 2021-10-20 18:43:26 +05:30
04fbf92480 fixed the miss spelled the file name 2021-10-16 15:45:12 +05:30
1d1729822a running the test and style commands 2021-10-10 12:41:22 +05:30
a13ea05ecf adding test file for AlphaNumericPalindrome algorithm 2021-10-10 12:34:10 +05:30
b13b12e88c chore: merge Fix/742 migrate doctest to jest (#749)
* Remove QuickSelect doctest

There are more Jest test cases already.

* Remove AverageMedian doctest

Already migrated to jest

* Migrate doctest for BinaryExponentiationRecursive.js

(also remove inline "main" test method)

* Migrate doctest for EulersTotient.js

(also remove inline "main" test method)

* Migrate doctest for PrimeFactors.js

(also remove inline "main" test method)

* Migrate doctest for BogoSort.js

Re-write prototype-polluting helper methods, too.

(also remove inline test driver code)

* Migrate doctest for BeadSort.js

(also remove inline test driver code)

* Migrate doctest for BucketSort.js

(also remove inline test driver code)

* Migrate doctest for CocktailShakerSort.js

(also remove inline test driver code)

* Migrate doctest for MergeSort.js

(also remove inline test driver code)

* Migrate doctest for QuickSort.js

(also remove inline test driver code)

* Migrate doctest for ReverseString.js

(also remove inline test driver code)

* Migrate doctest for ReverseString.js

* Migrate doctest for ValidateEmail.js

* Migrate doctest for ConwaysGameOfLife.js

(remove the animate code, too)

* Remove TernarySearch doctest

Already migrated to jest

* Migrate doctest for BubbleSort.js

(also remove inline test driver code)

* Remove doctest from CI and from dependencies

relates to #742
fixes #586

* Migrate doctest for RgbHsvConversion.js

* Add --fix option to "standard" npm script

* Migrate doctest for BreadthFirstSearch.js

(also remove inline test driver code)

* Migrate doctest for BreadthFirstShortestPath.js

(also remove inline test driver code)

* Migrate doctest for EulerMethod.js

(also remove inline test driver code)

Move manual test-code for plotting stuff in the browser in a distinct file, too. Those "*.manual-test.js" files are excluded from the UpdateDirectory.mjs script, as well.

* Migrate doctest for Mandelbrot.js

(also remove inline test driver code & moved manual drawing test into a *.manual-test.js)

* Migrate doctest for FloodFill.js

* Migrate doctest for KochSnowflake.js

(also move manual drawing test into a *.manual-test.js)

* Update npm lockfile

* Update README and COMMITTING with a few bits & bobs regarding testing & code quality
2021-10-07 12:33:38 +05:30
1589263947 fixed some spellings 2021-10-05 12:49:23 +05:30
30d437bff9 Add max word algorithm 2021-10-03 22:08:47 +07:00
3f6b4c1d72 added new line 2021-10-03 17:31:45 +05:30
c198a9f53d Added test for ScrambleStrings and formatted folder structure for other folders 2021-10-03 17:28:17 +05:30
2ecee85012 chore: merge "Add test for camel case algorithm" (#710)
* fix: change function name and use ES6 export

* feat: add tests for camel case

Co-authored-by: Alexandre VU <alexandre.vu@montreal.ca>
2021-10-03 14:03:07 +05:30
b03a1b8bbe chore: merge "Add tests for snake case algorithm" (#708)
* feat: adjust function name and use ES6 export

* feat: add test for SnakeCase

Co-authored-by: Alexandre VU <alexandre.vu@montreal.ca>
2021-10-02 13:35:43 +05:30
8c2f2ca15a chore: merge "Dice" (#703)
* feat: add dice coefficient

* chore: link to wikipedia article

* chore: convert to esm

* refactor: add tests

* chore: formatting
2021-10-01 13:57:07 +05:30
19970c35b9 chore: merge "Tests check anagrams (#693)"
* add test cases for checkAnagram function to cover additional inputs and edge cases

* adjust spacing between tests to be more consistent with other files

* update CheckAnagram to return boolean value instead of string

* add a reference link and definition of Anagram to CheckAnagram documentation
2021-09-23 11:29:55 +05:30
e40c62ddd8 chore: merge Tests for check flat case (#689)
* update function documentation and name to match js convention

* add additional documentation explaining what the function does

* add tests for checkFlatCase function

* fix standard.js errors
2021-09-19 12:15:47 +05:30
7af96ae1cc Added HammingDistance.js and HammingDistance.test.js in String directory 2021-07-11 16:30:23 +05:30
9f24341b5b Added test script for CreatePermutations and file name change 2021-05-06 21:08:47 +05:30
291f7b1a23 Apply JS standard rules on KMPPatternSearching.js 2020-10-30 23:04:21 +05:30
2c5aaa3690 Add KMP string searching algorithm 2020-10-30 23:01:06 +05:30