@formatjs/intl-durationformat 0.2.3 → 0.3.0

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.
@@ -1,4 +1,4 @@
1
- import { invariant } from '@formatjs/ecma402-abstract';
1
+ import { createMemoizedListFormat, createMemoizedNumberFormat, invariant, } from '@formatjs/ecma402-abstract';
2
2
  import { TABLE_2 } from '../constants';
3
3
  import { DurationFormat } from '../core';
4
4
  import { getInternalSlots } from '../get_internal_slots';
@@ -69,7 +69,7 @@ export function PartitionDurationFormatPattern(df, duration) {
69
69
  nfOpts.unit = numberFormatUnit;
70
70
  nfOpts.unitDisplay = style;
71
71
  }
72
- var nf = new Intl.NumberFormat(internalSlots.locale, nfOpts);
72
+ var nf = createMemoizedNumberFormat(internalSlots.locale, nfOpts);
73
73
  var list_1;
74
74
  if (!separated) {
75
75
  list_1 = [];
@@ -111,7 +111,7 @@ export function PartitionDurationFormatPattern(df, duration) {
111
111
  listStyle = 'short';
112
112
  }
113
113
  lfOpts.style = listStyle;
114
- var lf = new Intl.ListFormat(internalSlots.locale, lfOpts);
114
+ var lf = createMemoizedListFormat(internalSlots.locale, lfOpts);
115
115
  var strings = [];
116
116
  for (var _i = 0, result_1 = result; _i < result_1.length; _i++) {
117
117
  var parts = result_1[_i];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/intl-durationformat",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "Intl.DurationFormat polyfill",
5
5
  "keywords": [
6
6
  "intl",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "tslib": "^2.4.0",
29
- "@formatjs/intl-localematcher": "0.5.4",
30
- "@formatjs/ecma402-abstract": "1.18.3"
29
+ "@formatjs/ecma402-abstract": "2.1.0",
30
+ "@formatjs/intl-localematcher": "0.5.4"
31
31
  }
32
32
  }
@@ -72,7 +72,7 @@ function PartitionDurationFormatPattern(df, duration) {
72
72
  nfOpts.unit = numberFormatUnit;
73
73
  nfOpts.unitDisplay = style;
74
74
  }
75
- var nf = new Intl.NumberFormat(internalSlots.locale, nfOpts);
75
+ var nf = (0, ecma402_abstract_1.createMemoizedNumberFormat)(internalSlots.locale, nfOpts);
76
76
  var list_1;
77
77
  if (!separated) {
78
78
  list_1 = [];
@@ -114,7 +114,7 @@ function PartitionDurationFormatPattern(df, duration) {
114
114
  listStyle = 'short';
115
115
  }
116
116
  lfOpts.style = listStyle;
117
- var lf = new Intl.ListFormat(internalSlots.locale, lfOpts);
117
+ var lf = (0, ecma402_abstract_1.createMemoizedListFormat)(internalSlots.locale, lfOpts);
118
118
  var strings = [];
119
119
  for (var _i = 0, result_1 = result; _i < result_1.length; _i++) {
120
120
  var parts = result_1[_i];