Update DAB to include dynamic settings

- Settings will now get the active device(s) available on Linux (UNTESTED)
- Added CLI handler for interacting with the CLI
- Added wrapper for extracting values with regex
-
This commit is contained in:
Logan Cusano
2024-03-03 21:29:50 -05:00
parent 79574e188d
commit 36c0ec8b13
4 changed files with 73 additions and 2 deletions

View File

@@ -61,4 +61,17 @@ export const generateUniqueID = () => {
.digest('hex');
return uniqueID;
}
}
/**
* Extracts the value after a specific pattern from a string using regular expressions.
* @param {string} input - The input string.
* @param {string} pattern - The pattern to match.
* @returns {string|null} The value found after the pattern, or null if not found.
*/
export const extractValue = (input, pattern) => {
const regex = new RegExp(`${pattern}\\s+(\\S+)`);
const match = input.match(regex);
return match ? match[1] : null;
};