Skip to content

UtilityX makes JavaScript easier by taking the hassle out of working with arrays, numbers, objects, strings, etc..

License

Notifications You must be signed in to change notification settings

debugleader/UtilityX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

48 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โ—โ• What is this? โ•โ—

UtilityX makes JavaScript easier by taking the hassle out of working with arrays, numbers, objects, strings, etc. UtilityXโ€™s modular methods are great for:

  1. Iterating arrays, objects, & strings.. ๐Ÿ˜
  2. Manipulating & testing values.. ๐Ÿ˜
  3. Creating composite functions.. ๐Ÿ˜Ž
  4. And many more cool things! ๐Ÿ˜‰


Check out our WIKI for more info!!


forthebadge


A letter of Appreciation โฃ

A huuugeee Thanks to Dark-error-Honor for helping me create UtilityX!


forthebadge


How can I use this? ๐Ÿค”

Installation โš™
    > npm i utilityx
    > const x = require("utilityx");

Docs โœ”
Equality Checker ๐Ÿ”ฐ
    // parameters: (string, string, string, ......)
    x.checker("utilityx", "utilityx", "utilityx", "utilityx")
    // => true
Random Array Picker ๐Ÿ’ฏ
    // parameters: (string, string, string, ......)
    x.checker("utilityx", "utilityx", "utilityx", "utilityx")
    // => true
Longest String Length Sorter ๐Ÿ’ฅ
    // parameters: (array)
    x.sortByLongestLength(["aaaaaaaa", "a", "aa"])
    // => ["aaaaaaaa", "aa", "a"]
Shortest String Length Sorter ๐ŸŽง
    // parameters: (array)
    x.sortByLetter(["aaaaaaaa", "a", "aa"])
    // => ["aa", "a", "aaaaaaaa"]
Letter Sorter ๐ŸŽ‚
    // parameters: (array)
    x.sortByLetter(["hello", "bye", "apple"])
    // => ["apple", "bye", "hello"]
Descending Number Sorter ๐Ÿ˜‡
    // parameters: (array)
    x.sortNumsDescending([1,3,2,5,4])
    // => [5,4,3,2,1]
Ascending Number Sorter ๐Ÿ˜‰
    // parameters: (array)
    x.sortNumsAscending([1,3,2,5,4])
    // => [1,2,3,4,5]
Vowel Keeper ๐ŸŽต
    // parameters: (string)
    x.keepVowels("utilityx")
    // => "uii"
Vowel Remover ๐ŸŽถ
// parameters: (string)
x.removeVowels("utilityx");
// => "tltyx"
Space Counter ๐Ÿ”ง
// parameters: (string)
x.spaceCount("utilityx is a util lib.");
// => 4
Character Counter ๐Ÿ˜ฑ
    // parameters: (string, characters)
    x.charCount("utilityx", "x")
    // => 1
Check For Integers ๐Ÿ”ข
// parameters: (number)
x.isInt(1);
// => true
Check For Floats ๐Ÿ’ฅ
// parameters: (number)
x.isFloat(1.1);
// => true
Check For Strings ๐Ÿ” 
  // paramters: (string)
  x.isString('Hello World!');
  // => true
Check For Arrays โœ”
// parameters: (array)
x.isArray(["Hello", "World", "!"]);
// => true
Round Numbers โญ•
  // parameters: (number, amount of decimal places)
  x.round(10.55555555, 2)
  // => 10.56
Remove duplicates from array โŒ
// parameters: (array)
x.removeDuplicates([1, 2, 3, 4, 2, 3]);
// => [1, 2, 3, 4]
Remove falsy values from array โœ”
// parameters: (array)
x.compact([null, "", undefined, 0, 5, "hello"]);
// => [5, 'hello']
Get last index of array ๐Ÿ’ข
// parameters: (array)
x.lastIndex([1, 2, 3, 4, "Hi"]);
// => 'Hi'
Flatten an array โžกโฌ…
// parameters: (array, depth to flatten(Number))
x.flatten([1, [2, [3, [4, [5]]]]]);
// => [1, 2, 3, 4, 5]
positive and negative indexing โž–
// parameters: (array, index(negative or positive Number))
x.nth(["first", "second", "third"], -2);
// => 'second'
Pull items out of array โฌ†
// parameters: (array, values to pull out)
x.pull([1, 2, 3, "hello", 4], 1, "hello");
// => [1, 2, 3, 4]
Get all items except last item โŒ
// parameters: (array)
x.head([1, 2, 3, 4, 5]);
// => [1, 2, 3, 4]
Get all items except first item ๐Ÿšซ
// parameters: (array)
x.removeDuplicates([1, 2, 3, 4, 5]);
// => [2, 3, 4, 5]
Make union of arrays โ˜ฎ
// parameters: (array, array, array, ...)
x.union([1, 2, 3, 4, 5], [1, 2], [3, 6]);
// => [1, 2, 3, 4, 5, 6]
Make sorted union of arrays ๐Ÿคž
// parameters: (array, array, array, ...)
x.sortedUnion([5, 2, 4], [6, 4, 9]);
// => [2, 4, 5, 6, 9]
Deep copy an array ยฉ
// parameters: (array)
arr = [1, 2, 3];
x.deepCopy(arr);
// => [1, 2, 3]
Clamp function ๐Ÿค
// parameters: (lower bound, number, upper bound)
x.clamp([2, 5, 8]);
// => 5
x.clamp([8, 2, 10]);
// => 8
x.clamp([2, 10, 5]);
// => 5
Range function (yes, like in python) ๐Ÿ˜
// parameters: (Number)
x.range(5);
// => [0, 1, 2, 3, 4]
Convert to camelCase ๐Ÿซ
// parameters: (String)
x.camelCase("caMel caSe");
// => 'camelCase'
Convert to PascalCase ๐Ÿ” 
// parameters: (String)
x.pascalCase("paScAl caSe");
// => 'PascalCase'
Convert to snake_case ๐Ÿ
// parameters: (String)
x.snakeCase("snAke caSe");
// => 'sn_ake_cas_e'
x.snakeCase("snake case");
// => 'snake_case'
Convert to kebab-case ๐Ÿฅ™
// parameters: (String)
x.kebabCase("keBab caSe");
// => 'ke-bab-ca-se'
x.kebabCase("kebab case");
// => 'kebab-case'
Capitalize ๐Ÿค™
// parameters: (String)
x.camelCase("caPs");
// => 'CaPs'

forthebadge


Why use UtilityX? ๐Ÿš€

UtilityX helps programmers write more concise and easier to maintain JavaScript code. UtilityX contains tools to simplify programming with strings, numbers, arrays, functions and obfljects. By convention, UtilityX module is mapped to the x character.


forthebadge


Is it tested? ๐Ÿงช

Tested in Chrome 74-75, Firefox 66-67, IE 11, Edge 18, Safari 11-12, & Node.js 8-12.


forthebadge


How can I contribute? ๐ŸŽ‰

Please read this document before contributing to UtilityX! All bug fixes, improvements are appreciated โ™ฅ


forthebadge


Did you find an issue? โš ๏ธ

Please read this document.


forthebadge


What about the license? ๐Ÿ“ƒ

UtilityX is released under the MIT license & supports modern environments.



forthebadge


forthebadge


> Thank you for reading this to the end! ๐Ÿ˜Ž

About

UtilityX makes JavaScript easier by taking the hassle out of working with arrays, numbers, objects, strings, etc..

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published