@tixyel/streamelements 6.1.0 → 6.2.1
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 +85 -32
- package/dist/index.es.js +967 -868
- 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,43 +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;
|
|
2061
|
-
}
|
|
2062
|
-
namespace utils {
|
|
2063
|
-
/**
|
|
2064
|
-
* Delays execution for a specified number of milliseconds.
|
|
2065
|
-
* @param ms - The number of milliseconds to delay.
|
|
2066
|
-
* @returns A Promise that resolves after the specified delay.
|
|
2067
|
-
*/
|
|
2068
|
-
function delay<R extends any, M extends number>(ms: M, callback?: () => R): Promise<R | null>;
|
|
2069
|
-
/**
|
|
2070
|
-
* Returns typed entries of an object.
|
|
2071
|
-
* @param obj - The object to get entries from.
|
|
2072
|
-
* @returns An array of key-value pairs from the object.
|
|
2073
|
-
*/
|
|
2074
|
-
function typedEntries<K extends string, V>(obj: Record<K, V> | Array<V>): [K, V][];
|
|
2075
|
-
/**
|
|
2076
|
-
* Returns typed values of an object.
|
|
2077
|
-
* @param obj - The object to get values from.
|
|
2078
|
-
* @returns An array of values from the object.
|
|
2079
|
-
*/
|
|
2080
|
-
function typedValues<K extends string, V>(obj: Record<K, V> | Array<V>): V[];
|
|
2081
|
-
/**
|
|
2082
|
-
* Returns typed keys of an object.
|
|
2083
|
-
* @param obj - The object to get keys from.
|
|
2084
|
-
* @returns An array of keys from the object.
|
|
2085
|
-
*/
|
|
2086
|
-
function typedKeys<K extends string, V>(obj: Record<K, V> | Array<V>): K[];
|
|
2087
2062
|
/**
|
|
2088
|
-
*
|
|
2089
|
-
* @param
|
|
2090
|
-
* @
|
|
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
|
+
* ```
|
|
2091
2076
|
*/
|
|
2092
|
-
function
|
|
2077
|
+
function number(min: number, max: number, float?: number): number;
|
|
2093
2078
|
}
|
|
2094
2079
|
namespace element {
|
|
2095
2080
|
interface ScaleOptions<T extends HTMLElement> {
|
|
@@ -2219,6 +2204,24 @@ declare namespace Helper {
|
|
|
2219
2204
|
* ```
|
|
2220
2205
|
*/
|
|
2221
2206
|
function flatten(obj: Record<string, any>, stringify?: boolean, prefix?: string): Record<string, typeof stringify extends true ? string : string | number | boolean>;
|
|
2207
|
+
/**
|
|
2208
|
+
* Returns the entries of an object as an array of key-value pairs, with proper typing.
|
|
2209
|
+
* @param obj - The object to retrieve entries from.
|
|
2210
|
+
* @returns An array of key-value pairs from the object, typed as an array of tuples with key and value types.
|
|
2211
|
+
*/
|
|
2212
|
+
function entries<K extends string, V>(obj: Record<K, V>): [K, V][];
|
|
2213
|
+
/**
|
|
2214
|
+
* Returns the values of an object as an array, with proper typing.
|
|
2215
|
+
* @param obj - The object to retrieve values from.
|
|
2216
|
+
* @returns An array of values from the object, typed as an array of the value type.
|
|
2217
|
+
*/
|
|
2218
|
+
function values<K extends string, V>(obj: Record<K, V>): V[];
|
|
2219
|
+
/**
|
|
2220
|
+
* Returns the keys of an object as an array of strings, with proper typing.
|
|
2221
|
+
* @param obj - The object to retrieve keys from.
|
|
2222
|
+
* @returns An array of keys from the object, typed as an array of strings.
|
|
2223
|
+
*/
|
|
2224
|
+
function keys<K extends string, V>(obj: Record<K, V>): K[];
|
|
2222
2225
|
}
|
|
2223
2226
|
namespace message {
|
|
2224
2227
|
type BadgeOptions = Twitch.roles[] | Twitch.roles | `${Twitch.roles}, ${Twitch.roles}` | `${Twitch.roles}, ${Twitch.roles}, ${Twitch.roles}`;
|
|
@@ -2560,6 +2563,56 @@ declare namespace Helper {
|
|
|
2560
2563
|
*/
|
|
2561
2564
|
function uuid(): string;
|
|
2562
2565
|
}
|
|
2566
|
+
namespace fn {
|
|
2567
|
+
/**
|
|
2568
|
+
* Apply function with given thisArg and arguments
|
|
2569
|
+
* @param fn - Function to apply
|
|
2570
|
+
* @param thisArg - Value to use as this when calling fn
|
|
2571
|
+
* @param args - Arguments to pass to fn
|
|
2572
|
+
* @returns Result of calling fn with thisArg and args
|
|
2573
|
+
*/
|
|
2574
|
+
function apply<TThis, TArgs extends unknown[], TReturn>(fn: (this: TThis, ...args: TArgs) => TReturn, thisArg: TThis, args: TArgs): TReturn;
|
|
2575
|
+
/**
|
|
2576
|
+
* Call function with given thisArg and arguments
|
|
2577
|
+
* @param fn - Function to call
|
|
2578
|
+
* @param thisArg - Value to use as this when calling fn
|
|
2579
|
+
* @param args - Arguments to pass to fn
|
|
2580
|
+
* @returns Result of calling fn with thisArg and args
|
|
2581
|
+
*/
|
|
2582
|
+
function call<TThis, TArgs extends unknown[], TReturn>(fn: (this: TThis, ...args: TArgs) => TReturn, thisArg: TThis, ...args: TArgs): TReturn;
|
|
2583
|
+
}
|
|
2584
|
+
namespace utils {
|
|
2585
|
+
/**
|
|
2586
|
+
* Delays execution for a specified number of milliseconds.
|
|
2587
|
+
* @param ms - The number of milliseconds to delay.
|
|
2588
|
+
* @returns A Promise that resolves after the specified delay.
|
|
2589
|
+
*/
|
|
2590
|
+
function delay<R extends any, M extends number>(ms: M, callback?: () => R): Promise<R | null>;
|
|
2591
|
+
/**
|
|
2592
|
+
* Returns typed entries of an object.
|
|
2593
|
+
* @param obj - The object to get entries from.
|
|
2594
|
+
* @returns An array of key-value pairs from the object.
|
|
2595
|
+
*/
|
|
2596
|
+
function typedEntries<K extends string, V>(obj: Record<K, V>): [K, V][];
|
|
2597
|
+
/**
|
|
2598
|
+
* Returns typed values of an object.
|
|
2599
|
+
* @param obj - The object to get values from.
|
|
2600
|
+
* @returns An array of values from the object.
|
|
2601
|
+
*/
|
|
2602
|
+
function typedValues<K extends string, V>(obj: Record<K, V>): V[];
|
|
2603
|
+
/**
|
|
2604
|
+
* Returns typed keys of an object.
|
|
2605
|
+
* @param obj - The object to get keys from.
|
|
2606
|
+
* @returns An array of keys from the object.
|
|
2607
|
+
*/
|
|
2608
|
+
function typedKeys<K extends string, V>(obj: Record<K, V>): K[];
|
|
2609
|
+
/**
|
|
2610
|
+
* Selects an item based on weighted probabilities.
|
|
2611
|
+
* @param items - An object where keys are items and values are their weights.
|
|
2612
|
+
* @returns A randomly selected item based on the given probabilities.
|
|
2613
|
+
*/
|
|
2614
|
+
function probability<K extends string, V extends number>(items: Record<K, V>): K | undefined;
|
|
2615
|
+
}
|
|
2563
2616
|
}
|
|
2564
2617
|
|
|
2565
2618
|
declare namespace Local {
|