@react-aria/i18n 3.3.4 → 3.3.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.
package/dist/main.js CHANGED
@@ -1,39 +1,35 @@
1
- var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
2
-
3
- var {
4
- NumberFormatter
5
- } = require("@internationalized/number");
6
-
7
- var {
8
- DateFormatter
9
- } = require("@internationalized/date");
10
-
11
- var {
12
- MessageDictionary,
13
- MessageFormatter
14
- } = require("@internationalized/message");
15
-
16
- var {
17
- useIsSSR
18
- } = require("@react-aria/ssr");
19
-
20
- var _react2 = require("react");
21
-
22
- var _react = $parcel$interopDefault(_react2);
1
+ var $9NKR2$react = require("react");
2
+ var $9NKR2$reactariassr = require("@react-aria/ssr");
3
+ var $9NKR2$internationalizedmessage = require("@internationalized/message");
4
+ var $9NKR2$internationalizeddate = require("@internationalized/date");
5
+ var $9NKR2$internationalizednumber = require("@internationalized/number");
6
+
7
+ function $parcel$exportWildcard(dest, source) {
8
+ Object.keys(source).forEach(function(key) {
9
+ if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
10
+ return;
11
+ }
23
12
 
24
- var {
25
- useEffect,
26
- useState,
27
- useContext,
28
- useCallback,
29
- useMemo,
30
- useRef
31
- } = _react2;
13
+ Object.defineProperty(dest, key, {
14
+ enumerable: true,
15
+ get: function get() {
16
+ return source[key];
17
+ }
18
+ });
19
+ });
32
20
 
21
+ return dest;
22
+ }
33
23
  function $parcel$interopDefault(a) {
34
24
  return a && a.__esModule ? a.default : a;
35
25
  }
26
+ function $parcel$export(e, n, v, s) {
27
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
28
+ }
29
+ var $63861ef734973087$exports = {};
36
30
 
31
+ $parcel$export($63861ef734973087$exports, "I18nProvider", () => $63861ef734973087$export$a54013f0d02a8f82);
32
+ $parcel$export($63861ef734973087$exports, "useLocale", () => $63861ef734973087$export$43bb16f9c6d9e3f7);
37
33
  /*
38
34
  * Copyright 2020 Adobe. All rights reserved.
39
35
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -44,284 +40,256 @@ function $parcel$interopDefault(a) {
44
40
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
45
41
  * OF ANY KIND, either express or implied. See the License for the specific language
46
42
  * governing permissions and limitations under the License.
47
- */
48
- // https://en.wikipedia.org/wiki/Right-to-left
49
- const $dbb62b32f79d03a795a46f9fbec514c$var$RTL_SCRIPTS = new Set(['Arab', 'Syrc', 'Samr', 'Mand', 'Thaa', 'Mend', 'Nkoo', 'Adlm', 'Rohg', 'Hebr']);
50
- const $dbb62b32f79d03a795a46f9fbec514c$var$RTL_LANGS = new Set(['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi']);
51
- /**
52
- * Determines if a locale is read right to left using [Intl.Locale]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale}.
53
- */
54
-
55
- function $dbb62b32f79d03a795a46f9fbec514c$export$isRTL(locale) {
56
- // If the Intl.Locale API is available, use it to get the script for the locale.
57
- // This is more accurate than guessing by language, since languages can be written in multiple scripts.
58
- // @ts-ignore
59
- if (Intl.Locale) {
43
+ */ // https://en.wikipedia.org/wiki/Right-to-left
44
+ const $bd2b2eaf06c82b5b$var$RTL_SCRIPTS = new Set([
45
+ 'Arab',
46
+ 'Syrc',
47
+ 'Samr',
48
+ 'Mand',
49
+ 'Thaa',
50
+ 'Mend',
51
+ 'Nkoo',
52
+ 'Adlm',
53
+ 'Rohg',
54
+ 'Hebr'
55
+ ]);
56
+ const $bd2b2eaf06c82b5b$var$RTL_LANGS = new Set([
57
+ 'ae',
58
+ 'ar',
59
+ 'arc',
60
+ 'bcc',
61
+ 'bqi',
62
+ 'ckb',
63
+ 'dv',
64
+ 'fa',
65
+ 'glk',
66
+ 'he',
67
+ 'ku',
68
+ 'mzn',
69
+ 'nqo',
70
+ 'pnb',
71
+ 'ps',
72
+ 'sd',
73
+ 'ug',
74
+ 'ur',
75
+ 'yi'
76
+ ]);
77
+ function $bd2b2eaf06c82b5b$export$702d680b21cbd764(locale) {
78
+ // If the Intl.Locale API is available, use it to get the script for the locale.
79
+ // This is more accurate than guessing by language, since languages can be written in multiple scripts.
60
80
  // @ts-ignore
61
- let script = new Intl.Locale(locale).maximize().script;
62
- return $dbb62b32f79d03a795a46f9fbec514c$var$RTL_SCRIPTS.has(script);
63
- } // If not, just guess by the language (first part of the locale)
81
+ if (Intl.Locale) {
82
+ // @ts-ignore
83
+ let script = new Intl.Locale(locale).maximize().script;
84
+ return $bd2b2eaf06c82b5b$var$RTL_SCRIPTS.has(script);
85
+ }
86
+ // If not, just guess by the language (first part of the locale)
87
+ let lang = locale.split('-')[0];
88
+ return $bd2b2eaf06c82b5b$var$RTL_LANGS.has(lang);
89
+ }
64
90
 
65
91
 
66
- let lang = locale.split('-')[0];
67
- return $dbb62b32f79d03a795a46f9fbec514c$var$RTL_LANGS.has(lang);
68
- }
69
92
 
70
- /**
71
- * Gets the locale setting of the browser.
72
- */
73
- function $c53c7d716f930bd5da78e9efb99e3e$export$getDefaultLocale() {
74
- // @ts-ignore
75
- let locale = typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US';
76
- return {
77
- locale,
78
- direction: $dbb62b32f79d03a795a46f9fbec514c$export$isRTL(locale) ? 'rtl' : 'ltr'
79
- };
93
+
94
+
95
+ function $62cf993d670c3737$export$f09106e7c6677ec5() {
96
+ // @ts-ignore
97
+ let locale = typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US';
98
+ return {
99
+ locale: locale,
100
+ direction: $bd2b2eaf06c82b5b$export$702d680b21cbd764(locale) ? 'rtl' : 'ltr'
101
+ };
102
+ }
103
+ let $62cf993d670c3737$var$currentLocale = $62cf993d670c3737$export$f09106e7c6677ec5();
104
+ let $62cf993d670c3737$var$listeners = new Set();
105
+ function $62cf993d670c3737$var$updateLocale() {
106
+ $62cf993d670c3737$var$currentLocale = $62cf993d670c3737$export$f09106e7c6677ec5();
107
+ for (let listener of $62cf993d670c3737$var$listeners)listener($62cf993d670c3737$var$currentLocale);
108
+ }
109
+ function $62cf993d670c3737$export$188ec29ebc2bdc3a() {
110
+ let isSSR = $9NKR2$reactariassr.useIsSSR();
111
+ let [defaultLocale, setDefaultLocale] = $9NKR2$react.useState($62cf993d670c3737$var$currentLocale);
112
+ $9NKR2$react.useEffect(()=>{
113
+ if ($62cf993d670c3737$var$listeners.size === 0) window.addEventListener('languagechange', $62cf993d670c3737$var$updateLocale);
114
+ $62cf993d670c3737$var$listeners.add(setDefaultLocale);
115
+ return ()=>{
116
+ $62cf993d670c3737$var$listeners.delete(setDefaultLocale);
117
+ if ($62cf993d670c3737$var$listeners.size === 0) window.removeEventListener('languagechange', $62cf993d670c3737$var$updateLocale);
118
+ };
119
+ }, []);
120
+ // We cannot determine the browser's language on the server, so default to
121
+ // en-US. This will be updated after hydration on the client to the correct value.
122
+ if (isSSR) return {
123
+ locale: 'en-US',
124
+ direction: 'ltr'
125
+ };
126
+ return defaultLocale;
80
127
  }
81
128
 
82
- let $c53c7d716f930bd5da78e9efb99e3e$var$currentLocale = $c53c7d716f930bd5da78e9efb99e3e$export$getDefaultLocale();
83
- let $c53c7d716f930bd5da78e9efb99e3e$var$listeners = new Set();
84
129
 
85
- function $c53c7d716f930bd5da78e9efb99e3e$var$updateLocale() {
86
- $c53c7d716f930bd5da78e9efb99e3e$var$currentLocale = $c53c7d716f930bd5da78e9efb99e3e$export$getDefaultLocale();
87
130
 
88
- for (let listener of $c53c7d716f930bd5da78e9efb99e3e$var$listeners) {
89
- listener($c53c7d716f930bd5da78e9efb99e3e$var$currentLocale);
90
- }
131
+ const $63861ef734973087$var$I18nContext = /*#__PURE__*/ ($parcel$interopDefault($9NKR2$react)).createContext(null);
132
+ function $63861ef734973087$export$a54013f0d02a8f82(props) {
133
+ let { locale: locale , children: children } = props;
134
+ let defaultLocale = $62cf993d670c3737$export$188ec29ebc2bdc3a();
135
+ let value = locale ? {
136
+ locale: locale,
137
+ direction: $bd2b2eaf06c82b5b$export$702d680b21cbd764(locale) ? 'rtl' : 'ltr'
138
+ } : defaultLocale;
139
+ return(/*#__PURE__*/ ($parcel$interopDefault($9NKR2$react)).createElement($63861ef734973087$var$I18nContext.Provider, {
140
+ value: value
141
+ }, children));
142
+ }
143
+ function $63861ef734973087$export$43bb16f9c6d9e3f7() {
144
+ let defaultLocale = $62cf993d670c3737$export$188ec29ebc2bdc3a();
145
+ let context = $9NKR2$react.useContext($63861ef734973087$var$I18nContext);
146
+ return context || defaultLocale;
91
147
  }
92
- /**
93
- * Returns the current browser/system language, and updates when it changes.
94
- */
95
148
 
96
149
 
97
- function $c53c7d716f930bd5da78e9efb99e3e$export$useDefaultLocale() {
98
- let isSSR = useIsSSR();
99
- let [defaultLocale, setDefaultLocale] = useState($c53c7d716f930bd5da78e9efb99e3e$var$currentLocale);
100
- useEffect(() => {
101
- if ($c53c7d716f930bd5da78e9efb99e3e$var$listeners.size === 0) {
102
- window.addEventListener('languagechange', $c53c7d716f930bd5da78e9efb99e3e$var$updateLocale);
103
- }
150
+ var $227d419b46e795fb$exports = {};
104
151
 
105
- $c53c7d716f930bd5da78e9efb99e3e$var$listeners.add(setDefaultLocale);
106
- return () => {
107
- $c53c7d716f930bd5da78e9efb99e3e$var$listeners.delete(setDefaultLocale);
152
+ $parcel$export($227d419b46e795fb$exports, "useMessageFormatter", () => $227d419b46e795fb$export$ec23bf898b1eed85);
108
153
 
109
- if ($c53c7d716f930bd5da78e9efb99e3e$var$listeners.size === 0) {
110
- window.removeEventListener('languagechange', $c53c7d716f930bd5da78e9efb99e3e$var$updateLocale);
111
- }
112
- };
113
- }, []); // We cannot determine the browser's language on the server, so default to
114
- // en-US. This will be updated after hydration on the client to the correct value.
115
154
 
116
- if (isSSR) {
117
- return {
118
- locale: 'en-US',
119
- direction: 'ltr'
120
- };
121
- }
122
155
 
123
- return defaultLocale;
156
+ const $227d419b46e795fb$var$cache = new WeakMap();
157
+ function $227d419b46e795fb$var$getCachedDictionary(strings) {
158
+ let dictionary = $227d419b46e795fb$var$cache.get(strings);
159
+ if (!dictionary) {
160
+ dictionary = new $9NKR2$internationalizedmessage.MessageDictionary(strings);
161
+ $227d419b46e795fb$var$cache.set(strings, dictionary);
162
+ }
163
+ return dictionary;
124
164
  }
125
-
126
- const $aa95c2b730b505b265f124d9aec67193$var$I18nContext = /*#__PURE__*/_react.createContext(null);
127
-
128
- function I18nProvider(props) {
129
- let {
130
- locale,
131
- children
132
- } = props;
133
- let defaultLocale = $c53c7d716f930bd5da78e9efb99e3e$export$useDefaultLocale();
134
- let value = locale ? {
135
- locale,
136
- direction: $dbb62b32f79d03a795a46f9fbec514c$export$isRTL(locale) ? 'rtl' : 'ltr'
137
- } : defaultLocale;
138
- return /*#__PURE__*/_react.createElement($aa95c2b730b505b265f124d9aec67193$var$I18nContext.Provider, {
139
- value: value
140
- }, children);
165
+ function $227d419b46e795fb$export$ec23bf898b1eed85(strings) {
166
+ let { locale: locale } = $63861ef734973087$export$43bb16f9c6d9e3f7();
167
+ let dictionary = $9NKR2$react.useMemo(()=>$227d419b46e795fb$var$getCachedDictionary(strings)
168
+ , [
169
+ strings
170
+ ]);
171
+ let formatter = $9NKR2$react.useMemo(()=>new $9NKR2$internationalizedmessage.MessageFormatter(locale, dictionary)
172
+ , [
173
+ locale,
174
+ dictionary
175
+ ]);
176
+ return $9NKR2$react.useCallback((key, variables)=>formatter.format(key, variables)
177
+ , [
178
+ formatter
179
+ ]);
141
180
  }
142
- /**
143
- * Returns the current locale and layout direction.
144
- */
145
-
146
181
 
147
- exports.I18nProvider = I18nProvider;
148
182
 
149
- function useLocale() {
150
- let defaultLocale = $c53c7d716f930bd5da78e9efb99e3e$export$useDefaultLocale();
151
- let context = useContext($aa95c2b730b505b265f124d9aec67193$var$I18nContext);
152
- return context || defaultLocale;
153
- }
183
+ var $c91942a7d2652da3$exports = {};
154
184
 
155
- exports.useLocale = useLocale;
156
- const $a5aefbc9b72193c190dce301e0eb39$var$cache = new WeakMap();
185
+ $parcel$export($c91942a7d2652da3$exports, "useDateFormatter", () => $c91942a7d2652da3$export$85fd5fdf27bacc79);
157
186
 
158
- function $a5aefbc9b72193c190dce301e0eb39$var$getCachedDictionary(strings) {
159
- let dictionary = $a5aefbc9b72193c190dce301e0eb39$var$cache.get(strings);
160
187
 
161
- if (!dictionary) {
162
- dictionary = new MessageDictionary(strings);
163
- $a5aefbc9b72193c190dce301e0eb39$var$cache.set(strings, dictionary);
164
- }
165
188
 
166
- return dictionary;
189
+ function $c91942a7d2652da3$export$85fd5fdf27bacc79(options) {
190
+ // Reuse last options object if it is shallowly equal, which allows the useMemo result to also be reused.
191
+ let lastOptions = $9NKR2$react.useRef(null);
192
+ if (options && lastOptions.current && $c91942a7d2652da3$var$isEqual(options, lastOptions.current)) options = lastOptions.current;
193
+ lastOptions.current = options;
194
+ let { locale: locale } = $63861ef734973087$export$43bb16f9c6d9e3f7();
195
+ return $9NKR2$react.useMemo(()=>new $9NKR2$internationalizeddate.DateFormatter(locale, options)
196
+ , [
197
+ locale,
198
+ options
199
+ ]);
167
200
  }
168
- /**
169
- * Handles formatting ICU Message strings to create localized strings for the current locale.
170
- * Automatically updates when the locale changes, and handles caching of messages for performance.
171
- * @param strings - A mapping of languages to strings by key.
172
- */
173
-
174
-
175
- function useMessageFormatter(strings) {
176
- let {
177
- locale
178
- } = useLocale();
179
- let dictionary = useMemo(() => $a5aefbc9b72193c190dce301e0eb39$var$getCachedDictionary(strings), [strings]);
180
- let formatter = useMemo(() => new MessageFormatter(locale, dictionary), [locale, dictionary]);
181
- return useCallback((key, variables) => formatter.format(key, variables), [formatter]);
182
- }
183
-
184
- exports.useMessageFormatter = useMessageFormatter;
185
-
186
- /**
187
- * Provides localized date formatting for the current locale. Automatically updates when the locale changes,
188
- * and handles caching of the date formatter for performance.
189
- * @param options - Formatting options.
190
- */
191
- function useDateFormatter(options) {
192
- // Reuse last options object if it is shallowly equal, which allows the useMemo result to also be reused.
193
- let lastOptions = useRef(null);
194
-
195
- if (options && lastOptions.current && $bdeee39f835a1e28966186127db96579$var$isEqual(options, lastOptions.current)) {
196
- options = lastOptions.current;
197
- }
198
-
199
- lastOptions.current = options;
200
- let {
201
- locale
202
- } = useLocale();
203
- return useMemo(() => new DateFormatter(locale, options), [locale, options]);
201
+ function $c91942a7d2652da3$var$isEqual(a, b) {
202
+ if (a === b) return true;
203
+ let aKeys = Object.keys(a);
204
+ let bKeys = Object.keys(b);
205
+ if (aKeys.length !== bKeys.length) return false;
206
+ for (let key of aKeys){
207
+ if (b[key] !== a[key]) return false;
208
+ }
209
+ return true;
204
210
  }
205
211
 
206
- exports.useDateFormatter = useDateFormatter;
207
212
 
208
- function $bdeee39f835a1e28966186127db96579$var$isEqual(a, b) {
209
- if (a === b) {
210
- return true;
211
- }
213
+ var $a374038f15a08a03$exports = {};
212
214
 
213
- let aKeys = Object.keys(a);
214
- let bKeys = Object.keys(b);
215
+ $parcel$export($a374038f15a08a03$exports, "useNumberFormatter", () => $a374038f15a08a03$export$b7a616150fdb9f44);
215
216
 
216
- if (aKeys.length !== bKeys.length) {
217
- return false;
218
- }
219
217
 
220
- for (let key of aKeys) {
221
- if (b[key] !== a[key]) {
222
- return false;
223
- }
224
- }
225
218
 
226
- return true;
219
+ function $a374038f15a08a03$export$b7a616150fdb9f44(options = {
220
+ }) {
221
+ let { locale: locale } = $63861ef734973087$export$43bb16f9c6d9e3f7();
222
+ return $9NKR2$react.useMemo(()=>new $9NKR2$internationalizednumber.NumberFormatter(locale, options)
223
+ , [
224
+ locale,
225
+ options
226
+ ]);
227
227
  }
228
228
 
229
- /**
230
- * Provides localized number formatting for the current locale. Automatically updates when the locale changes,
231
- * and handles caching of the number formatter for performance.
232
- * @param options - Formatting options.
233
- */
234
- function useNumberFormatter(options) {
235
- if (options === void 0) {
236
- options = {};
237
- }
238
-
239
- let {
240
- locale
241
- } = useLocale();
242
- return useMemo(() => new NumberFormatter(locale, options), [locale, options]);
243
- }
244
229
 
245
- exports.useNumberFormatter = useNumberFormatter;
246
- let $f2d7166fa8b4811bca7b68ebd673b$var$cache = new Map();
247
- /**
248
- * Provides localized string collation for the current locale. Automatically updates when the locale changes,
249
- * and handles caching of the collator for performance.
250
- * @param options - Collator options.
251
- */
252
-
253
- function useCollator(options) {
254
- let {
255
- locale
256
- } = useLocale();
257
- let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');
258
-
259
- if ($f2d7166fa8b4811bca7b68ebd673b$var$cache.has(cacheKey)) {
260
- return $f2d7166fa8b4811bca7b68ebd673b$var$cache.get(cacheKey);
261
- }
262
-
263
- let formatter = new Intl.Collator(locale, options);
264
- $f2d7166fa8b4811bca7b68ebd673b$var$cache.set(cacheKey, formatter);
265
- return formatter;
266
- }
230
+ var $f6ea39a459b94924$exports = {};
267
231
 
268
- exports.useCollator = useCollator;
269
-
270
- /**
271
- * Provides localized string search functionality that is useful for filtering or matching items
272
- * in a list. Options can be provided to adjust the sensitivity to case, diacritics, and other parameters.
273
- */
274
- function useFilter(options) {
275
- let collator = useCollator(_babelRuntimeHelpersExtends({
276
- usage: 'search'
277
- }, options)); // TODO(later): these methods don't currently support the ignorePunctuation option.
278
-
279
- return {
280
- startsWith(string, substring) {
281
- if (substring.length === 0) {
282
- return true;
283
- } // Normalize both strings so we can slice safely
284
- // TODO: take into account the ignorePunctuation option as well...
285
-
286
-
287
- string = string.normalize('NFC');
288
- substring = substring.normalize('NFC');
289
- return collator.compare(string.slice(0, substring.length), substring) === 0;
290
- },
291
-
292
- endsWith(string, substring) {
293
- if (substring.length === 0) {
294
- return true;
295
- }
232
+ $parcel$export($f6ea39a459b94924$exports, "useCollator", () => $f6ea39a459b94924$export$a16aca283550c30d);
296
233
 
297
- string = string.normalize('NFC');
298
- substring = substring.normalize('NFC');
299
- return collator.compare(string.slice(-substring.length), substring) === 0;
300
- },
234
+ let $f6ea39a459b94924$var$cache = new Map();
235
+ function $f6ea39a459b94924$export$a16aca283550c30d(options) {
236
+ let { locale: locale } = $63861ef734973087$export$43bb16f9c6d9e3f7();
237
+ let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1
238
+ ).join() : '');
239
+ if ($f6ea39a459b94924$var$cache.has(cacheKey)) return $f6ea39a459b94924$var$cache.get(cacheKey);
240
+ let formatter = new Intl.Collator(locale, options);
241
+ $f6ea39a459b94924$var$cache.set(cacheKey, formatter);
242
+ return formatter;
243
+ }
301
244
 
302
- contains(string, substring) {
303
- if (substring.length === 0) {
304
- return true;
305
- }
306
245
 
307
- string = string.normalize('NFC');
308
- substring = substring.normalize('NFC');
309
- let scan = 0;
310
- let sliceLen = substring.length;
246
+ var $27a6ee7a587d6f55$exports = {};
311
247
 
312
- for (; scan + sliceLen <= string.length; scan++) {
313
- let slice = string.slice(scan, scan + sliceLen);
248
+ $parcel$export($27a6ee7a587d6f55$exports, "useFilter", () => $27a6ee7a587d6f55$export$3274cf84b703fff);
314
249
 
315
- if (collator.compare(substring, slice) === 0) {
316
- return true;
250
+ function $27a6ee7a587d6f55$export$3274cf84b703fff(options) {
251
+ let collator = $f6ea39a459b94924$export$a16aca283550c30d({
252
+ usage: 'search',
253
+ ...options
254
+ });
255
+ // TODO(later): these methods don't currently support the ignorePunctuation option.
256
+ return {
257
+ startsWith (string, substring) {
258
+ if (substring.length === 0) return true;
259
+ // Normalize both strings so we can slice safely
260
+ // TODO: take into account the ignorePunctuation option as well...
261
+ string = string.normalize('NFC');
262
+ substring = substring.normalize('NFC');
263
+ return collator.compare(string.slice(0, substring.length), substring) === 0;
264
+ },
265
+ endsWith (string, substring) {
266
+ if (substring.length === 0) return true;
267
+ string = string.normalize('NFC');
268
+ substring = substring.normalize('NFC');
269
+ return collator.compare(string.slice(-substring.length), substring) === 0;
270
+ },
271
+ contains (string, substring) {
272
+ if (substring.length === 0) return true;
273
+ string = string.normalize('NFC');
274
+ substring = substring.normalize('NFC');
275
+ let scan = 0;
276
+ let sliceLen = substring.length;
277
+ for(; scan + sliceLen <= string.length; scan++){
278
+ let slice = string.slice(scan, scan + sliceLen);
279
+ if (collator.compare(substring, slice) === 0) return true;
280
+ }
281
+ return false;
317
282
  }
318
- }
283
+ };
284
+ }
319
285
 
320
- return false;
321
- }
322
286
 
323
- };
324
- }
287
+ $parcel$exportWildcard(module.exports, $63861ef734973087$exports);
288
+ $parcel$exportWildcard(module.exports, $227d419b46e795fb$exports);
289
+ $parcel$exportWildcard(module.exports, $c91942a7d2652da3$exports);
290
+ $parcel$exportWildcard(module.exports, $a374038f15a08a03$exports);
291
+ $parcel$exportWildcard(module.exports, $f6ea39a459b94924$exports);
292
+ $parcel$exportWildcard(module.exports, $27a6ee7a587d6f55$exports);
293
+
325
294
 
326
- exports.useFilter = useFilter;
327
295
  //# sourceMappingURL=main.js.map