Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

[flow] A minimal demonstration of flow in action

Lyubomir Marinovf6c914f6f08d
diff --git a/react/features/base/util/randomUtil.js b/react/features/base/util/randomUtil.js
index f99968404a..dc9106e249 100644
--- a/react/features/base/util/randomUtil.js
+++ b/react/features/base/util/randomUtil.js
@@ -1,3 +1,5 @@
+/* @flow */
+
/**
* Alphanumeric characters.
* @const
@@ -18,7 +20,7 @@ const HEX_DIGITS = '0123456789abcdef';
* @returns {string} A string of random alphanumeric characters with the
* specified length.
*/
-export function randomAlphanumString(length) {
+export function randomAlphanumString(length: number) {
return _randomString(length, ALPHANUM);
}
@@ -28,7 +30,7 @@ export function randomAlphanumString(length) {
* @param {Array|string} arr - Source.
* @returns {Array|string} Array element or string character.
*/
-export function randomElement(arr) {
+export function randomElement(arr: Array<any> | string) {
return arr[randomInt(0, arr.length - 1)];
}
@@ -48,7 +50,7 @@ export function randomHexDigit() {
* @returns {string} A string of random hexadecimal digits with the specified
* length.
*/
-export function randomHexString(length) {
+export function randomHexString(length: number) {
return _randomString(length, HEX_DIGITS);
}
@@ -59,7 +61,7 @@ export function randomHexString(length) {
* @param {number} max - The maximum value for the generated number.
* @returns {number} Random int number.
*/
-export function randomInt(min, max) {
+export function randomInt(min: number, max: number) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
diff --git a/react/features/base/util/roomnameGenerator.js b/react/features/base/util/roomnameGenerator.js
index 2f15534e4a..14a8b65aad 100644
--- a/react/features/base/util/roomnameGenerator.js
+++ b/react/features/base/util/roomnameGenerator.js
@@ -1,3 +1,5 @@
+/* @flow */
+
import { randomElement } from './randomUtil';
/*