@tixyel/streamelements 6.1.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +58 -5
- package/dist/index.es.js +781 -700
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2038,6 +2038,7 @@ declare namespace Helper {
|
|
|
2038
2038
|
* @param amount - Number to balance
|
|
2039
2039
|
* @param min - Minimum value
|
|
2040
2040
|
* @param max - Maximum value
|
|
2041
|
+
* @param decimals - Number of decimal places to round to (default is 0)
|
|
2041
2042
|
* @returns - Balanced number
|
|
2042
2043
|
* @example
|
|
2043
2044
|
* ```javascript
|
|
@@ -2045,7 +2046,7 @@ declare namespace Helper {
|
|
|
2045
2046
|
* console.log(balancedValue); // 100
|
|
2046
2047
|
* ```
|
|
2047
2048
|
*/
|
|
2048
|
-
function balance(amount: number, min?: number, max?: number): number;
|
|
2049
|
+
function balance(amount: number, min?: number, max?: number, decimals?: number): number;
|
|
2049
2050
|
/**
|
|
2050
2051
|
* Rounds a number to a specified number of decimal places
|
|
2051
2052
|
* @param value - Number to round
|
|
@@ -2053,11 +2054,27 @@ declare namespace Helper {
|
|
|
2053
2054
|
* @returns Rounded number
|
|
2054
2055
|
* @example
|
|
2055
2056
|
* ```javascript
|
|
2056
|
-
* const roundedValue = Simulation.number.
|
|
2057
|
+
* const roundedValue = Simulation.number.round(3.14159, 3);
|
|
2057
2058
|
* console.log(roundedValue); // 3.142
|
|
2058
2059
|
* ```
|
|
2059
2060
|
*/
|
|
2060
2061
|
function round(value: number, decimals?: number): number;
|
|
2062
|
+
/**
|
|
2063
|
+
* Generate random number
|
|
2064
|
+
* @param min - Minimum value
|
|
2065
|
+
* @param max - Maximum value
|
|
2066
|
+
* @param float - Number of decimal places (0 for integer)
|
|
2067
|
+
* @returns - Random number
|
|
2068
|
+
* @example
|
|
2069
|
+
* ```javascript
|
|
2070
|
+
* const intNumber = number.random(1, 10);
|
|
2071
|
+
* console.log(intNumber); // e.g. 7
|
|
2072
|
+
*
|
|
2073
|
+
* const floatNumber = number.random(1, 10, 2);
|
|
2074
|
+
* console.log(floatNumber); // e.g. 3.14
|
|
2075
|
+
* ```
|
|
2076
|
+
*/
|
|
2077
|
+
const random: typeof Helper.random.number;
|
|
2061
2078
|
}
|
|
2062
2079
|
namespace utils {
|
|
2063
2080
|
/**
|
|
@@ -2071,19 +2088,19 @@ declare namespace Helper {
|
|
|
2071
2088
|
* @param obj - The object to get entries from.
|
|
2072
2089
|
* @returns An array of key-value pairs from the object.
|
|
2073
2090
|
*/
|
|
2074
|
-
|
|
2091
|
+
const typedEntries: typeof object.entries;
|
|
2075
2092
|
/**
|
|
2076
2093
|
* Returns typed values of an object.
|
|
2077
2094
|
* @param obj - The object to get values from.
|
|
2078
2095
|
* @returns An array of values from the object.
|
|
2079
2096
|
*/
|
|
2080
|
-
|
|
2097
|
+
const typedValues: typeof object.values;
|
|
2081
2098
|
/**
|
|
2082
2099
|
* Returns typed keys of an object.
|
|
2083
2100
|
* @param obj - The object to get keys from.
|
|
2084
2101
|
* @returns An array of keys from the object.
|
|
2085
2102
|
*/
|
|
2086
|
-
|
|
2103
|
+
const typedKeys: typeof object.keys;
|
|
2087
2104
|
/**
|
|
2088
2105
|
* Selects an item based on weighted probabilities.
|
|
2089
2106
|
* @param items - An object where keys are items and values are their weights.
|
|
@@ -2219,6 +2236,24 @@ declare namespace Helper {
|
|
|
2219
2236
|
* ```
|
|
2220
2237
|
*/
|
|
2221
2238
|
function flatten(obj: Record<string, any>, stringify?: boolean, prefix?: string): Record<string, typeof stringify extends true ? string : string | number | boolean>;
|
|
2239
|
+
/**
|
|
2240
|
+
* Returns the entries of an object as an array of key-value pairs, with proper typing.
|
|
2241
|
+
* @param obj - The object to retrieve entries from.
|
|
2242
|
+
* @returns An array of key-value pairs from the object, typed as an array of tuples with key and value types.
|
|
2243
|
+
*/
|
|
2244
|
+
function entries<K extends string, V>(obj: Record<K, V>): [K, V][];
|
|
2245
|
+
/**
|
|
2246
|
+
* Returns the values of an object as an array, with proper typing.
|
|
2247
|
+
* @param obj - The object to retrieve values from.
|
|
2248
|
+
* @returns An array of values from the object, typed as an array of the value type.
|
|
2249
|
+
*/
|
|
2250
|
+
function values<K extends string, V>(obj: Record<K, V>): V[];
|
|
2251
|
+
/**
|
|
2252
|
+
* Returns the keys of an object as an array of strings, with proper typing.
|
|
2253
|
+
* @param obj - The object to retrieve keys from.
|
|
2254
|
+
* @returns An array of keys from the object, typed as an array of strings.
|
|
2255
|
+
*/
|
|
2256
|
+
function keys<K extends string, V>(obj: Record<K, V>): K[];
|
|
2222
2257
|
}
|
|
2223
2258
|
namespace message {
|
|
2224
2259
|
type BadgeOptions = Twitch.roles[] | Twitch.roles | `${Twitch.roles}, ${Twitch.roles}` | `${Twitch.roles}, ${Twitch.roles}, ${Twitch.roles}`;
|
|
@@ -2560,6 +2595,24 @@ declare namespace Helper {
|
|
|
2560
2595
|
*/
|
|
2561
2596
|
function uuid(): string;
|
|
2562
2597
|
}
|
|
2598
|
+
namespace fn {
|
|
2599
|
+
/**
|
|
2600
|
+
* Apply function with given thisArg and arguments
|
|
2601
|
+
* @param fn - Function to apply
|
|
2602
|
+
* @param thisArg - Value to use as this when calling fn
|
|
2603
|
+
* @param args - Arguments to pass to fn
|
|
2604
|
+
* @returns Result of calling fn with thisArg and args
|
|
2605
|
+
*/
|
|
2606
|
+
function apply<TThis, TArgs extends unknown[], TReturn>(fn: (this: TThis, ...args: TArgs) => TReturn, thisArg: TThis, args: TArgs): TReturn;
|
|
2607
|
+
/**
|
|
2608
|
+
* Call function with given thisArg and arguments
|
|
2609
|
+
* @param fn - Function to call
|
|
2610
|
+
* @param thisArg - Value to use as this when calling fn
|
|
2611
|
+
* @param args - Arguments to pass to fn
|
|
2612
|
+
* @returns Result of calling fn with thisArg and args
|
|
2613
|
+
*/
|
|
2614
|
+
function call<TThis, TArgs extends unknown[], TReturn>(fn: (this: TThis, ...args: TArgs) => TReturn, thisArg: TThis, ...args: TArgs): TReturn;
|
|
2615
|
+
}
|
|
2563
2616
|
}
|
|
2564
2617
|
|
|
2565
2618
|
declare namespace Local {
|