@posthog/core 1.54.4 → 1.54.5

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.
@@ -67,7 +67,7 @@ function matchPropertyFilters(propertyFilters, eventProperties) {
67
67
  if (null == eventPropertyValue) return false;
68
68
  const comparisonFunction = propertyComparisons[filter.operator];
69
69
  if (!comparisonFunction) return false;
70
- return comparisonFunction(filter.values, [
70
+ return comparisonFunction(filter.values.map(String), [
71
71
  String(eventPropertyValue)
72
72
  ]);
73
73
  });
@@ -38,7 +38,7 @@ function matchPropertyFilters(propertyFilters, eventProperties) {
38
38
  if (null == eventPropertyValue) return false;
39
39
  const comparisonFunction = propertyComparisons[filter.operator];
40
40
  if (!comparisonFunction) return false;
41
- return comparisonFunction(filter.values, [
41
+ return comparisonFunction(filter.values.map(String), [
42
42
  String(eventPropertyValue)
43
43
  ]);
44
44
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/core",
3
- "version": "1.54.4",
3
+ "version": "1.54.5",
4
4
  "bugs": {
5
5
  "url": "https://github.com/PostHog/posthog-js/issues"
6
6
  },
@@ -70,7 +70,7 @@
70
70
  }
71
71
  },
72
72
  "dependencies": {
73
- "@posthog/types": "^1.412.1"
73
+ "@posthog/types": "^1.412.2"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@rslib/core": "0.23.2",
@@ -126,6 +126,13 @@ describe('shared property matching contract', () => {
126
126
  expect(matchPropertyFilters(filter('exact', ['premium,vip']), { property: ['premium', 'vip'] })).toBe(true)
127
127
  })
128
128
 
129
+ it('coerces filter values to strings before matching', () => {
130
+ // Filter values come off the /surveys JSON response untyped at runtime, so a
131
+ // numeric filter value must not reach `.toLowerCase()` as a number.
132
+ const numericFilter = filter('icontains', [100 as unknown as string])
133
+ expect(matchPropertyFilters(numericFilter, { property: 100 })).toBe(true)
134
+ })
135
+
129
136
  it.each<{
130
137
  operator: PropertyOperator
131
138
  value: string
@@ -70,6 +70,6 @@ export function matchPropertyFilters(
70
70
  return false
71
71
  }
72
72
 
73
- return comparisonFunction(filter.values, [String(eventPropertyValue)])
73
+ return comparisonFunction(filter.values.map(String), [String(eventPropertyValue)])
74
74
  })
75
75
  }