Skip to content

Commit 68bd1ff

Browse files
committed
Stop warning when undefined property values are instrumented
1 parent df53175 commit 68bd1ff

File tree

6 files changed

+15
-9
lines changed

6 files changed

+15
-9
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
### 5.2.2 (March 29, 2019)
2+
3+
* Stop warning when `undefined` property values are instrumented
4+
15
### 5.2.1 (March 28, 2019)
26

37
* Fix npm publish failure where built files were missing.
48

59
### 5.2.0 (March 28, 2019)
610

7-
* Stop warning when null property values are instrumented
11+
* Stop warning when `null` property values are instrumented
812
* Allow for objects nested within arrays
913

1014
### 5.0.0 (March 19, 2019)

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,19 @@ $(OUT): node_modules $(SRC) package.json rollup.config.js rollup.min.js
7474
#
7575
# Target for minified `amplitude-snippet.js` file.
7676
#
77-
$(SNIPPET_OUT): $(SRC) $(SNIPPET) version
77+
$(SNIPPET_OUT): $(SRC) $(SNIPPET)
7878
@$(JSHINT) --verbose $(SNIPPET)
7979
@$(MINIFY) $(SNIPPET) -m -b max-line-len=80,beautify=false | awk 'NF' > $(SNIPPET_OUT)
8080

81-
$(SEGMENT_SNIPPET_OUT): $(SRC) $(SNIPPET) version
81+
$(SEGMENT_SNIPPET_OUT): $(SRC) $(SNIPPET)
8282
@grep -Ev "\ba?s\b" $(SNIPPET) | $(MINIFY) -m -b max-line-len=80,beautify=false - \
8383
| awk 'NF' > $(SEGMENT_SNIPPET_OUT)
8484

8585
#
8686
# Target for `tests-build.js` file.
8787
#
8888

89-
build: $(TESTS) $(OUT) $(SNIPPET_OUT) $(SEGMENT_SNIPPET_OUT) README.md
89+
build: $(TESTS) $(OUT) $(SNIPPET_OUT) $(SEGMENT_SNIPPET_OUT)
9090
@$(ROLLUP) --config rollup.test.js
9191
@$(ROLLUP) --config rollup.snippet-tests.js
9292

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Please see our [installation guide](https://amplitude.zendesk.com/hc/en-us/artic
1111
[![npm version](https://badge.fury.io/js/amplitude-js.svg)](https://badge.fury.io/js/amplitude-js)
1212
[![Bower version](https://badge.fury.io/bo/amplitude-js.svg)](https://badge.fury.io/bo/amplitude-js)
1313

14-
[5.2.1 - Released on March 28, 2019](https://github.com/amplitude/Amplitude-JavaScript/releases/latest)
14+
[5.2.2 - Released on March 29, 2019](https://github.com/amplitude/Amplitude-JavaScript/releases/latest)
1515

1616

1717
# JavaScript SDK Reference #

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "amplitude-js",
33
"author": "Amplitude <[email protected]>",
4-
"version": "5.2.1",
4+
"version": "5.2.2",
55
"license": "MIT",
66
"description": "Javascript library for Amplitude Analytics",
77
"keywords": [

src/amplitude-snippet.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
var amplitude = window.amplitude || {'_q':[],'_iq':{}};
33
var as = document.createElement('script');
44
as.type = 'text/javascript';
5-
as.integrity = 'sha384-+ritBC3Uh0X9JjWcMcvcreVEixaFd4J31hRpBXl3d1WnAYLkpsNjj4ISxf5Oytx9';
5+
as.integrity = 'sha384-d/yhnowERvm+7eCU79T/bYjOiMmq4F11ElWYLmt0ktvYEVgqLDazh4+gW9CKMpYW';
66
as.crossOrigin = 'anonymous';
77
as.async = true;
8-
as.src = 'https://cdn.amplitude.com/libs/amplitude-5.2.1-min.gz.js';
8+
as.src = 'https://cdn.amplitude.com/libs/amplitude-5.2.2-min.gz.js';
99
as.onload = function() {if(!window.amplitude.runQueuedFunctions) {console.log('[Amplitude] Error: could not load SDK');}};
1010
var s = document.getElementsByTagName('script')[0];
1111
s.parentNode.insertBefore(as, s);

src/utils.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,16 @@ var validateProperties = function validateProperties(properties) {
133133
};
134134

135135
var invalidValueTypes = [
136-
'nan', 'undefined', 'function', 'arguments', 'regexp', 'element'
136+
'nan', 'function', 'arguments', 'regexp', 'element'
137137
];
138138

139139
var validatePropertyValue = function validatePropertyValue(key, value) {
140140
var valueType = type(value);
141141
if (invalidValueTypes.indexOf(valueType) !== -1) {
142142
log.warn('WARNING: Property key "' + key + '" with invalid value type ' + valueType + ', ignoring');
143143
value = null;
144+
} else if (valueType === 'undefined') {
145+
value = null;
144146
} else if (valueType === 'error') {
145147
value = String(value);
146148
log.warn('WARNING: Property key "' + key + '" with value type error, coercing to ' + value);

0 commit comments

Comments
 (0)