You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flagon.apache.org by po...@apache.org on 2022/03/25 06:29:25 UTC
[incubator-flagon-useralejs] 03/04: bring indentation into conformity with the rest of Userale
This is an automated email from the ASF dual-hosted git repository.
poorejc pushed a commit to branch setupStartStopRefactor
in repository https://gitbox.apache.org/repos/asf/incubator-flagon-useralejs.git
commit a5ca75050a86fd50ca7b9ab4e5b60abf6a491f14
Author: giterdone77 <kb...@gmail.com>
AuthorDate: Thu Mar 24 22:31:27 2022 -0400
bring indentation into conformity with the rest of Userale
---
src/configure.js | 43 +++++++++++++++++++++----------------------
1 file changed, 21 insertions(+), 22 deletions(-)
diff --git a/src/configure.js b/src/configure.js
index 6be8fec..8f10c8f 100644
--- a/src/configure.js
+++ b/src/configure.js
@@ -22,21 +22,20 @@
* @param {Object} newConfig Configuration object to merge into the current config.
*/
export function configure(config, newConfig) {
- const configAutostart = config['autostart'];
- const newConfigAutostart = newConfig['autostart'];
- Object.keys(newConfig).forEach(function (option) {
- if (option === 'userFromParams') {
- const userId = getUserIdFromParams(newConfig[option]);
- if (userId) {
- config.userId = userId;
- }
- }
- config[option] = newConfig[option];
+ const configAutostart = config['autostart'];
+ const newConfigAutostart = newConfig['autostart'];
+ Object.keys(newConfig).forEach(function (option) {
+ if (option === 'userFromParams') {
+ const userId = getUserIdFromParams(newConfig[option]);
+ if (userId) {
+ config.userId = userId;
}
- )
- if (configAutostart === false || newConfigAutostart === false) {
- config['autostart'] = false;
- }
+ }
+ config[option] = newConfig[option];
+ });
+ if (configAutostart === false || newConfigAutostart === false) {
+ config['autostart'] = false;
+ }
}
/**
@@ -45,13 +44,13 @@ export function configure(config, newConfig) {
* @return {string|null} The extracted/decoded userid, or null if none is found.
*/
export function getUserIdFromParams(param) {
- const userField = param;
- const regex = new RegExp('[?&]' + userField + '(=([^&#]*)|&|#|$)');
- const results = window.location.href.match(regex);
+ const userField = param;
+ const regex = new RegExp('[?&]' + userField + '(=([^&#]*)|&|#|$)');
+ const results = window.location.href.match(regex);
- if (results && results[2]) {
- return decodeURIComponent(results[2].replace(/\+/g, ' '));
- } else {
- return null;
- }
+ if (results && results[2]) {
+ return decodeURIComponent(results[2].replace(/\+/g, ' '));
+ } else {
+ return null;
+ }
}