8000 GitHub - SomnathDevPro/Swoop.js at 26e85f8ad4040d1eafb6b9fd8d13a185ca39bd39
[go: up one dir, main page]

Skip to content

SomnathDevPro/Swoop.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SWOOP.JS : simplifying web development with only one library

Tired of juggling with multiple libraries and utilities for your projects? Don't worry,swoop.js is here to help! A lightweight versatile javascript utility library,containing a ton of useful functions,that simplifies the process of web development, Swoop js has a comprehensive set of features,from common utilities to to advanced and more specific utility classes,such as: • SWOOPHYSIX for making physics calculations and unit conversions. •SWOOP TEST for unit testing, helping you to write test cases for your code. •SWOOP CACHE to store values for use later,with TTL feature. INSTALLATION you can simply include swoop.js using our CDN link: https://cdn.jsdelivr.net/gh/SomnathDevPro/Swoop.js@main/swoop.min.js

USAGE Let's get started with swoop.js! include swoop.js to your source code to get started :

<script src="https://cdn.jsdelivr.net/gh/SomnathDevPro/Swoop.js@main/swoop.min.js"></script>

The swoop object The SWOOP object is the main object which you will be using to access the basic utilities! available utility functions: ARR (Array Functions)

  1. union(arr1, arr2): Returns the union of two arrays.
  2. intersection(arr1, arr2): Returns the intersection of two arrays.
  3. difference(arr1, arr2): Returns the difference of two arrays.
  4. sum(arr): Returns the sum of all elements in an array.
  5. mean(arr): Returns the mean of an array.
  6. standard_deviation(arr): Returns the standard deviation of an array.
  7. variance(arr): Returns the variance of an array.
  8. median(arr): Returns the median of an array.
  9. min(arr): Returns the minimum value of an array.
  10. max(arr): Returns the maximum value of an array.
  11. countUnique(arr): Returns the number of unique values in an array.
  12. countDuplicates(arr): Returns the number of duplicate values in an array.
  13. merge(arr1, arr2): Merges two arrays.
  14. freq(arr): Returns the frequency of elements in an array.

DOM (Document Object Model Functions)

  1. select(selector): Selects an element by its selector.
  2. selectid(id): Selects an element by its ID.
  3. selectall(element): Selects all elements with a matching selector.
  4. addListener(element, event, fn): Attaches an event listener to an element.
  5. removeListener(element, event, fn): Removes an event listener from an element.

FUNC (Functional Programming Utilities)

  1. throttle(func, wait): Throttles a function to prevent excessive calls.
  2. debounce(func, wait): Debounces a function to prevent excessive calls.
  3. memoize(func): Memoizes a function to cache its results.
  4. curry(func): Curries a function to enable partial application.
  5. once(func): Ensures a function is called only once.

MATHS (Mathematical Functions)

  1. sin(angle): Returns the sine of an angle.
  2. cos(angle): Returns the cosine of an angle.
  3. tan(angle): Returns the tangent of an angle.
  4. distance(x1, x2, y1, y2): Returns the distance between two points.
  5. midpoint(x1, x2, y1, y2): Returns the midpoint between two points.
  6. lerp(a, b, t): Returns the linear interpolation between two values.
  7. clamp(value, min, max): Clamps a value within a range.
  8. signum(value): Returns the sign of a number.
  9. sqrt(value): Returns the square root of a number.
  10. round(num): Returns the rounded value of a number.
  11. ceil(num): Returns the ceiling of a number.
  12. absolute(num): Returns the absolute value of a number.
  13. gcd(a, b): Returns the Greatest Common Divisor of two numbers.
  14. lcm(a, b): Returns the Least Common Multiple of two numbers.
  15. hypot(p, b): Returns the hypotenuse of a right triangle.
  16. randnum(min, max): Returns a random number within a range.

STR (String Functions)

  1. strip(str): Removes whitespace from a string.
  2. contains(str, search, position): Checks if a substring is present in a string.
  3. isBlank(str): Checks if a string is blank.
  4. isNotBlank(str): Checks if a string is not blank.
  5. isAlphabet(str): Checks if a string contains only alphabetic characters.
  6. isNumeric(str): Checks if a string contains only numeric characters.
  7. echo(str, n): Repeats a string n times.
  8. capitalise(str): Capitalizes the first letter of a string.

About

A lightweight,versatile javascript utility library for modern web development

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0