expf-sigma-node.js 3.2.1 → 3.2.3
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/package.json +1 -1
- package/public/sigma.js +15 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expf-sigma-node.js",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.3",
|
|
4
4
|
"description": "expf-sigma-node.js lets you manage features flags and remote config across web, server side applications. Deliver true Continuous Integration. Get builds out faster. Control who has access to new features.",
|
|
5
5
|
"main": "public/sigma.js",
|
|
6
6
|
"keywords": [
|
package/public/sigma.js
CHANGED
|
@@ -903,7 +903,7 @@ function compareVersions(versionA, versionB, strict = true) {
|
|
|
903
903
|
}
|
|
904
904
|
|
|
905
905
|
// src/helpers/conditionOperation.js
|
|
906
|
-
function conditionOperation(userValue, conditionValues, operation) {
|
|
906
|
+
function conditionOperation(userValue, conditionValues, operation, date, time) {
|
|
907
907
|
!operation ? operation = "=" : operation;
|
|
908
908
|
if (userValue === null || typeof userValue === "undefined" || !conditionValues)
|
|
909
909
|
return false;
|
|
@@ -944,11 +944,11 @@ function conditionOperation(userValue, conditionValues, operation) {
|
|
|
944
944
|
case "on date":
|
|
945
945
|
return Math.floor(
|
|
946
946
|
new Date(conditionValues.trim()).getTime() / (1e3 * 60 * 60 * 24)
|
|
947
|
-
) ==
|
|
947
|
+
) == date;
|
|
948
948
|
case "after time":
|
|
949
|
-
return new Date(conditionValues.trim()).getTime() / (1e3 * 60 * 60) <
|
|
949
|
+
return new Date(conditionValues.trim()).getTime() / (1e3 * 60 * 60) < time;
|
|
950
950
|
case "before time":
|
|
951
|
-
return new Date(conditionValues.trim()).getTime() / (1e3 * 60 * 60) >
|
|
951
|
+
return new Date(conditionValues.trim()).getTime() / (1e3 * 60 * 60) > time;
|
|
952
952
|
case "starts with":
|
|
953
953
|
return userValue.startsWith(conditionValues);
|
|
954
954
|
case "not starts with":
|
|
@@ -1030,8 +1030,10 @@ function filterByPlatform(config, platformName) {
|
|
|
1030
1030
|
return config;
|
|
1031
1031
|
let filteredConfig = { ...config };
|
|
1032
1032
|
const { feature_flags, experiments } = filteredConfig;
|
|
1033
|
-
filteredConfig.feature_flags
|
|
1034
|
-
|
|
1033
|
+
if (filteredConfig.feature_flags)
|
|
1034
|
+
filteredConfig.feature_flags = generateFilteredList(feature_flags, platformName);
|
|
1035
|
+
if (filteredConfig.experiments)
|
|
1036
|
+
filteredConfig.experiments = generateFilteredList(experiments, platformName);
|
|
1035
1037
|
return filteredConfig;
|
|
1036
1038
|
}
|
|
1037
1039
|
function generateFilteredList(array, name) {
|
|
@@ -1047,7 +1049,7 @@ function generateFilteredList(array, name) {
|
|
|
1047
1049
|
return array;
|
|
1048
1050
|
array = array.filter((item) => {
|
|
1049
1051
|
for (let index in listName) {
|
|
1050
|
-
if (!item.platform)
|
|
1052
|
+
if (!item.platform || item.platform === "all")
|
|
1051
1053
|
return item;
|
|
1052
1054
|
if (item.platform === listName[index])
|
|
1053
1055
|
return item;
|
|
@@ -1402,7 +1404,9 @@ var Sigma = class {
|
|
|
1402
1404
|
conditionOperation(
|
|
1403
1405
|
userValue,
|
|
1404
1406
|
targets.conditions[index].value,
|
|
1405
|
-
targets.conditions[index].condition_sign
|
|
1407
|
+
targets.conditions[index].condition_sign,
|
|
1408
|
+
this.sigmaUserData.user.data,
|
|
1409
|
+
this.sigmaUserData.user.time
|
|
1406
1410
|
)
|
|
1407
1411
|
);
|
|
1408
1412
|
}
|
|
@@ -1614,7 +1618,9 @@ var Sigma = class {
|
|
|
1614
1618
|
conditionOperation(
|
|
1615
1619
|
userValue,
|
|
1616
1620
|
conditions[i].value,
|
|
1617
|
-
conditions[i].condition_sign
|
|
1621
|
+
conditions[i].condition_sign,
|
|
1622
|
+
this.sigmaUserData.user.data,
|
|
1623
|
+
this.sigmaUserData.user.time
|
|
1618
1624
|
)
|
|
1619
1625
|
);
|
|
1620
1626
|
}
|