This folder contains useful independent fragments of JS and TS code.
You can use this fragments in your applications to implement some pieces of functionality.
Common fragments placed in _* folders.
Contents
Common fragments
Folder name
Description
_types
common types used in other fragments
Main fragments
Folder name
Description
_types
common types used in other fragments
fetch-url
fetch data from url, display data or unsuccessful response status or error
fetch-url-method-data
fetch data to/from url using method, return data or unsuccessful warning message
get-string-length-recursive
returns length from string using recurcion approach
replace-words-in-sentence
returns function
when the returned function takes 2 parameters, it does not return anything,
but stores the obtained values as an array with two values;
when the returned function takes 1 parameter, it returns the resulting string,
replacing all the words in it, according to the previously saved pairs
integer-division
returns the result of integer division of one number by another
binary-search
returns the number from given array using binary search algorithm
fibonacci
returns finding the n-th fibonacci number from given n using recurcive algorithm
fibonacciMemo
fibonacci memoized version
allPairsFromArrays
returns all number pairs from given arrays using O(n^2) complexity algorithm
arraysIntersections
returns common elements in the arr1 and arr2 using binary search
minMax
returns { min, max } object from given numbers array
sum
returns sum from given a and b arguments
numberSum
returns sum from given arguments
square
returns square from given number
identity
returns same arg from given arg
stack (unfinished)
Stack class realization
flatten
creates a new array with all sub-array elements concatenated into it