navigation-stack 0.5.1 → 0.5.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/README.md CHANGED
@@ -775,7 +775,7 @@ yarn format
775
775
  yarn test
776
776
  ```
777
777
 
778
- It runs tests in two web browsers (for no particular reason) — Chrome and Firefox (configurable in `karma.conf.cjs`). When running `yarn test`, it opens Chome and Firefox browser windows. Don't unfocus those windows, otherwise the tests won't finish.
778
+ It runs tests in two web browsers (for no particular reason) — Chrome and Firefox (configurable in `karma.conf.cjs`). When running `yarn test`, it opens Chome and Firefox browser windows. Don't unfocus those windows, otherwise the tests will finish with errors.
779
779
 
780
780
  ## GitHub
781
781
 
@@ -6,6 +6,13 @@ var _createSearchFromQuery = _interopRequireDefault(require("./createSearchFromQ
6
6
  var _parseLocationUrl = _interopRequireDefault(require("./parseLocationUrl"));
7
7
  var _parseQueryFromSearch = _interopRequireDefault(require("./parseQueryFromSearch"));
8
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ function stringifyQueryParameterValue(value) {
10
+ if (value === null || value === undefined) {
11
+ return value;
12
+ }
13
+ return String(value);
14
+ }
15
+
9
16
  // * If `location` is a string, it parses it into a `LocationBase`.
10
17
  // * If `location` is an object, it ensures that `search` and `hash` properties aren't `undefined`,
11
18
  // i.e. it "ensures" that the `location` object can be used as a `LocationBase`.
@@ -20,7 +27,7 @@ function parseInputLocation(location) {
20
27
  if (typeof location.query[key] !== 'string') {
21
28
  location = Object.assign({}, location, {
22
29
  query: Object.assign({}, location.query, {
23
- [key]: String(location.query[key])
30
+ [key]: stringifyQueryParameterValue(location.query[key])
24
31
  })
25
32
  });
26
33
  }
@@ -1,6 +1,12 @@
1
1
  import createSearchFromQuery from './createSearchFromQuery';
2
2
  import parseLocationUrl from './parseLocationUrl';
3
3
  import parseQueryFromSearch from './parseQueryFromSearch';
4
+ function stringifyQueryParameterValue(value) {
5
+ if (value === null || value === undefined) {
6
+ return value;
7
+ }
8
+ return String(value);
9
+ }
4
10
 
5
11
  // * If `location` is a string, it parses it into a `LocationBase`.
6
12
  // * If `location` is an object, it ensures that `search` and `hash` properties aren't `undefined`,
@@ -16,7 +22,7 @@ export default function parseInputLocation(location) {
16
22
  if (typeof location.query[key] !== 'string') {
17
23
  location = Object.assign({}, location, {
18
24
  query: Object.assign({}, location.query, {
19
- [key]: String(location.query[key])
25
+ [key]: stringifyQueryParameterValue(location.query[key])
20
26
  })
21
27
  });
22
28
  }
@@ -34,7 +34,7 @@ export class ScrollPositionRestoration<
34
34
  // Using this option, a developer could theoretically provide their own implementation
35
35
  // of setting a scroll position. For example, it could use "smooth" (animated) scrolling, etc.
36
36
  // This could be part of the public API if anyone provided a sensible real-world use case for it.
37
- _pageScrollPositionSetter: ScrollPositionSetter<
37
+ _pageScrollPositionSetter?: ScrollPositionSetter<
38
38
  ScrollableContainer,
39
39
  Anchor
40
40
  >;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "navigation-stack",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Handles navigation in a web browser",
5
5
  "keywords": [
6
6
  "history",
@@ -2,6 +2,13 @@ import createSearchFromQuery from './createSearchFromQuery';
2
2
  import parseLocationUrl from './parseLocationUrl';
3
3
  import parseQueryFromSearch from './parseQueryFromSearch';
4
4
 
5
+ function stringifyQueryParameterValue(value) {
6
+ if (value === null || value === undefined) {
7
+ return value;
8
+ }
9
+ return String(value);
10
+ }
11
+
5
12
  // * If `location` is a string, it parses it into a `LocationBase`.
6
13
  // * If `location` is an object, it ensures that `search` and `hash` properties aren't `undefined`,
7
14
  // i.e. it "ensures" that the `location` object can be used as a `LocationBase`.
@@ -18,7 +25,7 @@ export default function parseInputLocation(location) {
18
25
  ...location,
19
26
  query: {
20
27
  ...location.query,
21
- [key]: String(location.query[key]),
28
+ [key]: stringifyQueryParameterValue(location.query[key]),
22
29
  },
23
30
  };
24
31
  }
@@ -34,7 +34,7 @@ export class ScrollPositionRestoration<
34
34
  // Using this option, a developer could theoretically provide their own implementation
35
35
  // of setting a scroll position. For example, it could use "smooth" (animated) scrolling, etc.
36
36
  // This could be part of the public API if anyone provided a sensible real-world use case for it.
37
- _pageScrollPositionSetter: ScrollPositionSetter<
37
+ _pageScrollPositionSetter?: ScrollPositionSetter<
38
38
  ScrollableContainer,
39
39
  Anchor
40
40
  >;