Skip to content

Commit

Permalink
Merge pull request #56 from Sv443-Network/ver/1.18.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Sv443 authored Oct 11, 2022
2 parents c838a05 + c1c008e commit a042edb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions SvCoreLib.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,15 @@ declare module "svcorelib" {
* @param array The array to split
* @param partsAmt Into how many parts the array should be split
* @param balanced Default (false): returned parts all have the same length except the last one. (true): returned parts are equally balanced and have similar lengths.
* @since 1.18.0
*/
function splitIntoParts<T>(array: T[], partsAmt: number, balanced?: boolean): T[][];

/**
* 🔹 Splits an array into any number of parts with a max length. 🔹
* @param array The array to split
* @param maxLength The maximum length of each part. Has to be at least 1 or higher.
* @since 1.18.0
*/
function splitIntoPartsOfLength<T>(array: T[], maxLength: number): T[][];

Expand Down Expand Up @@ -305,23 +307,23 @@ declare module "svcorelib" {
* @returns Returns a random item of the provided array. Returns undefined if the array is empty.
* @since 1.9.4
*/
function randomItem<T>(array: T[]): T | undefined;
function randomItem<T>(array: T[]): T;

/**
* 🔹 Chooses a random item in an array and returns it, along with its index in the array. 🔹
* @param array An array of any size, with any values contained inside
* @returns Returns a tuple array with two entries. First entry is the randomly chosen item, second entry is the index of the random item. Returns undefined if the array is empty.
* @since 1.17.0
*/
function randomItemIndex<T>(array: T[]): [item?: T, index?: number];
function randomItemIndex<T>(array: T[]): [item: T, index: number];

/**
* 🔹 Chooses a random item in an array and returns it. Mutates the original array so the chosen item is no longer contained! 🔹
* @param array An array of any size, with any values contained inside
* @returns Returns the randomly chosen item. Returns undefined if the array is empty.
* @since 1.17.0
*/
function takeRandomItem<T>(array: T[]): T | undefined;
function takeRandomItem<T>(array: T[]): T;

/**
* 🔹 Removes duplicate items in an array 🔹
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svcorelib",
"version": "1.18.0",
"version": "1.18.1",
"description": "Core Library used in the projects of Sv443 and the Sv443 Network. Contains tons of miscellaneous QoL features.",
"main": "SvCoreLib.js",
"scripts": {
Expand Down Expand Up @@ -63,4 +63,4 @@
"eslint": "^8.25.0",
"snyk": "^1.1026.0"
}
}
}

0 comments on commit a042edb

Please sign in to comment.