mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 03:36:07 +03:00
fix lint
This commit is contained in:
parent
478c06c32e
commit
f9f7abb0d1
1 changed files with 15 additions and 10 deletions
|
@ -17,14 +17,18 @@ limitations under the License.
|
||||||
import SdkConfig from './SdkConfig';
|
import SdkConfig from './SdkConfig';
|
||||||
|
|
||||||
function hashCode(str) {
|
function hashCode(str) {
|
||||||
var hash = 0, i, chr;
|
let hash = 0;
|
||||||
if (str.length === 0) return hash;
|
let i;
|
||||||
for (i = 0; i < str.length; i++) {
|
let chr;
|
||||||
chr = str.charCodeAt(i);
|
if (str.length === 0) {
|
||||||
hash = ((hash << 5) - hash) + chr;
|
return hash;
|
||||||
hash |= 0;
|
}
|
||||||
}
|
for (i = 0; i < str.length; i++) {
|
||||||
return Math.abs(hash);
|
chr = str.charCodeAt(i);
|
||||||
|
hash = ((hash << 5) - hash) + chr;
|
||||||
|
hash |= 0;
|
||||||
|
}
|
||||||
|
return Math.abs(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function phasedRollOutExpiredForUser(username, feature, now, rollOutConfig = SdkConfig.get().phasedRollOut) {
|
export function phasedRollOutExpiredForUser(username, feature, now, rollOutConfig = SdkConfig.get().phasedRollOut) {
|
||||||
|
@ -38,7 +42,8 @@ export function phasedRollOutExpiredForUser(username, feature, now, rollOutConfi
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Number.isFinite(featureConfig.offset) || !Number.isFinite(featureConfig.period)) {
|
if (!Number.isFinite(featureConfig.offset) || !Number.isFinite(featureConfig.period)) {
|
||||||
console.error(`phased rollout of ${feature} is misconfigured, offset and/or period are not numbers, so disabling`, featureConfig);
|
console.error(`phased rollout of ${feature} is misconfigured, ` +
|
||||||
|
`offset and/or period are not numbers, so disabling`, featureConfig);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +57,7 @@ export function phasedRollOutExpiredForUser(username, feature, now, rollOutConfi
|
||||||
const result = now >= enableAt;
|
const result = now >= enableAt;
|
||||||
const bucketStr = `(bucket ${userBucket}/${bucketCount})`;
|
const bucketStr = `(bucket ${userBucket}/${bucketCount})`;
|
||||||
if (result) {
|
if (result) {
|
||||||
console.log(`${feature} enabled for ${username} ${bucketStr}`)
|
console.log(`${feature} enabled for ${username} ${bucketStr}`);
|
||||||
} else {
|
} else {
|
||||||
console.log(`${feature} will be enabled for ${username} in ${Math.ceil((enableAt - now)/1000)}s ${bucketStr}`);
|
console.log(`${feature} will be enabled for ${username} in ${Math.ceil((enableAt - now)/1000)}s ${bucketStr}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue