You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
⚠️ THIS IS INTENDED TO USE ONLY IN FINAL APPLICATIONS.
if you use this in library, any other applications that use your library will have polyfull injected as well.
please DO NOT use this if you are building a library, use this only where you have control of your node interpreter.
also, if you are using some other polyfiller, be sure that there is no overlaps, or something will broke. Thanks!
PolyFull is a library intended to augment JavaScript capabilities. Somehow JavaScript
is still missing some of the basic functionalities that are usually provided through other functions.
Its aim is to solve this issue by injecting the missing functionalities into the core components.
🆕 Submit request for functionality that are missing
Some nice feature are missing in Javascript? Submit to me and i will take care of it!
📦 Installation
npm install polyfull
🚀 Usage
simply import polyfull (once in your index.ts/js) to have access to supercharged functionality.
Retrive intersecate elements (elements that are in each array)
unique
Return an array with unique values for each array
▶️ Array
Method
Description
first
get first element from array
last
get first element from array
insert
insert new element in specific position
remove
remove element from array
removeIndex
remove element from array at specified index
prepend
prepend an element into the array
includesEvery
check if the other Array includes every element in Array
includesAny
check if the other Array includes any element in Array
chunk
split array in cunks of desired size
random
Return a random element from the array
shuffle
shuffle the array sorting element in random order
▶️ DateConstructor
Method
Description
current
Return a Date object representing Date.now()
▶️ Date
Method
Description
addMilliseconds
add milliseconds to Date
addSeconds
add seconds to Date
addMinutes
add minutes to Date
addHours
add hours to Date
addDate
add days to Date
addMonth
add months to Date
addFullYear
add Years to Date
subMilliseconds
subtract milliseconds from Date
subSeconds
subtract seconds from date
subMinutes
subtract minutes from Date
subHours
subtract hours from Date
subDate
subtract days from Date
subMonth
subtract months from Date
subFullYear
subtract years from Date
isBefore
check if current date is before another
isAfter
check if current date is after another
isSame
check if two date are the same
diff
difference in ms between two dates
▶️ NumberConstructor
Method
Description
random
generate a number between min-max (default: from Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER)
randomInt
generate an integer between min-max (default: from Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER)
▶️ Number
Method
Description
abs
Returns the absolute value of a number (the value without regard to whether it is positive or negative). For example, the absolute value of -5 is the same as the absolute value of 5.
acos
Returns the arc cosine (or inverse cosine) of a number.
acosh
Returns the inverse hyperbolic cosine of a number.
asin
Returns the arcsine of a number.
asinh
Returns the inverse hyperbolic sine of a number.
atan
Returns the arctangent of a number.
atan2
Returns the angle (in radians) from the X axis to a point.
atanh
Returns the inverse hyperbolic tangent of a number.
cbrt
Returns an implementation-dependent approximation to the cube root of number.
ceil
Returns the smallest integer greater than or equal to its numeric argument.
clz32
Returns the number of leading zero bits in the 32-bit binary representation of a number.
cos
Returns the cosine of a number.
cosh
Returns the hyperbolic cosine of a number.
exp
Returns e (the base of natural logarithms) raised to a power.
expm1
Returns the result of (e^x - 1), which is an implementation-dependent approximation to subtracting 1 from the exponential function of x (e raised to the power of x, where e is the base of the natural logarithms).
floor
Returns the greatest integer less than or equal to its numeric argument.
fround
Returns the nearest single precision float representation of a number.
imul
Returns the result of 32-bit multiplication of two numbers.
log
Returns the natural logarithm (base e) of a number.
log10
Returns the base 10 logarithm of a number.
log1p
Returns the natural logarithm of 1 + x.
log2
Returns the base 2 logarithm of a number.
pow
Returns the value of a base expression taken to a specified power.
round
Returns a supplied numeric expression rounded to the nearest integer.
sign
Returns the sign of the x, indicating whether number is positive, negative or zero.
sin
Returns the sine of a number.
sinh
Returns the hyperbolic sine of a number.
sqrt
Returns the square root of a number.
tan
Returns the tangent of a number.
tanh
Returns the hyperbolic tangent of a number.
trunc
Returns the integral part of the a numeric expression, x, removing any fractional digits. If x is already an integer, the result is x.
isEven
Return true if number is even
isOdd
Return true if number is odd
isPrime
Return true if number is prime
isDivisibleBy
Return true if number divisible by other
goldenRatio
Return golden long and short side ration of number
percentage
Return percentage of number
factorial
Return factorial of number
▶️ PromiseConstructor
Method
Description
allProperties
Creates an Object where Promise that are resolved in the same key of the passed Object, or rejected when any Promise is rejected.
allPropertiesSettled
Creates an Object where Promise values that are resolved with an object of results when all of the provided Promises resolve or reject.
▶️ String
Method
Description
reverse
reverse a string
toBase64
convert to base64
fromBase64
convert from base64
toTitleCase
make first letter of each word uppercase
ucFirst
make first letter uppercase
toKebabCase
make string in kebab case representation
isNumeric
check if string is valid numeric
isPalindrome
check if string is palindrome
equalsIgnoreCase
check if string is equal to other ignoring case
unrepeat
replace multiple character/string repetition with single one