@dreamcommerce/aurora 3.0.0-45 → 3.0.0-46
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/build/cjs/packages/aurora/src/hooks/search/use_search.js +28 -0
- package/build/cjs/packages/aurora/src/hooks/search/use_search.js.map +1 -0
- package/build/cjs/packages/aurora/src/index.js +2 -0
- package/build/cjs/packages/aurora/src/index.js.map +1 -1
- package/build/cjs/packages/aurora/src/utilities/fuzzy_search.js +65 -0
- package/build/cjs/packages/aurora/src/utilities/fuzzy_search.js.map +1 -0
- package/build/esm/packages/aurora/src/hooks/search/use_search.js +22 -12
- package/build/esm/packages/aurora/src/hooks/search/use_search.js.map +1 -1
- package/build/esm/packages/aurora/src/index.d.ts +1 -0
- package/build/esm/packages/aurora/src/index.js +1 -0
- package/build/esm/packages/aurora/src/index.js.map +1 -1
- package/build/esm/packages/aurora/src/utilities/fuzzy_search.js +55 -61
- package/build/esm/packages/aurora/src/utilities/fuzzy_search.js.map +1 -1
- package/build/index.css +1 -1
- package/package.json +1 -1
- package/build/esm/packages/aurora/src/assets/icons/lock_icon.d.ts +0 -1
- package/build/esm/packages/aurora/src/assets/icons/lock_icon.js +0 -3
- package/build/esm/packages/aurora/src/assets/icons/lock_icon.js.map +0 -1
- package/build/esm/packages/aurora/src/assets/icons/lock_unlock_ikon.d.ts +0 -1
- package/build/esm/packages/aurora/src/assets/icons/lock_unlock_ikon.js +0 -3
- package/build/esm/packages/aurora/src/assets/icons/lock_unlock_ikon.js.map +0 -1
- package/build/esm/packages/aurora/src/components/values_syncer/values_syncer.d.ts +0 -16
- package/build/esm/packages/aurora/src/components/values_syncer/values_syncer.js +0 -41
- package/build/esm/packages/aurora/src/components/values_syncer/values_syncer.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var _rollupPluginBabelHelpers = require('../../../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
7
|
+
var fuzzy_search = require('../../utilities/fuzzy_search.js');
|
|
8
|
+
|
|
9
|
+
var useSearch = function useSearch(_ref) {
|
|
10
|
+
var items = _ref.items,
|
|
11
|
+
searchKey = _ref.searchKey,
|
|
12
|
+
_ref$searchStrategy = _ref.searchStrategy,
|
|
13
|
+
searchStrategy = _ref$searchStrategy === void 0 ? fuzzy_search.fuzzySearch : _ref$searchStrategy;
|
|
14
|
+
var _useState = React.useState(items),
|
|
15
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
|
16
|
+
_items = _useState2[0],
|
|
17
|
+
setItems = _useState2[1];
|
|
18
|
+
var search = function search(query) {
|
|
19
|
+
setItems(searchStrategy(query, items, searchKey));
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
search: search,
|
|
23
|
+
items: _items
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.useSearch = useSearch;
|
|
28
|
+
//# sourceMappingURL=use_search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -82,6 +82,7 @@ var drawer_trigger = require('./components/drawer/components/drawer_trigger.js')
|
|
|
82
82
|
var drawer_content = require('./components/drawer/components/drawer_content.js');
|
|
83
83
|
var drawer_close = require('./components/drawer/components/drawer_close.js');
|
|
84
84
|
var drawer_title = require('./components/drawer/components/drawer_title.js');
|
|
85
|
+
var use_search = require('./hooks/search/use_search.js');
|
|
85
86
|
var tag_constants = require('./components/tag/tag_constants.js');
|
|
86
87
|
var tag = require('./components/tag/tag.js');
|
|
87
88
|
var _switch = require('./components/switch/switch.js');
|
|
@@ -188,6 +189,7 @@ exports.DrawerTrigger = drawer_trigger.DrawerTrigger;
|
|
|
188
189
|
exports.DrawerContent = drawer_content.DrawerContent;
|
|
189
190
|
exports.DrawerClose = drawer_close.DrawerClose;
|
|
190
191
|
exports.DrawerTitle = drawer_title.DrawerTitle;
|
|
192
|
+
exports.useSearch = use_search.useSearch;
|
|
191
193
|
exports.TAG_VARIANTS = tag_constants.TAG_VARIANTS;
|
|
192
194
|
exports.Tag = tag.Tag;
|
|
193
195
|
exports.Switch = _switch.Switch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
|
+
var union = require('lodash/union');
|
|
7
|
+
|
|
8
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
+
|
|
10
|
+
var union__default = /*#__PURE__*/_interopDefaultLegacy(union);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* searches within array of objects by given key, returns filtered array of objects using fuzzy algorithm
|
|
14
|
+
* @param {string} query - the phrase by which it searches
|
|
15
|
+
* @param {Array<Object>} arrayToFilter - array which will be searched
|
|
16
|
+
* @param {string} key - key of object within arrayToFilter where search should be used
|
|
17
|
+
* @example
|
|
18
|
+
* // returns [{id: 1, text: 'polish'}, {id: 2, text: 'portugal'}]
|
|
19
|
+
* fuzzySearch('pol', [
|
|
20
|
+
* {id: 1, text: 'polish'},
|
|
21
|
+
* {id: 2, text: 'portugal'},
|
|
22
|
+
* {id: 3, text: 'english'}
|
|
23
|
+
* ], 'text')
|
|
24
|
+
* @returns {Array} - filtered array
|
|
25
|
+
*/
|
|
26
|
+
function fuzzySearch(query, arrayToFilter, key) {
|
|
27
|
+
if (query !== '' && query.search(/[-[\]/{}()*+?.\\^$|]/g) === -1) {
|
|
28
|
+
var exactSearch = new RegExp('^' + query + '$', 'i');
|
|
29
|
+
var firstSearch = new RegExp('^' + query, 'i');
|
|
30
|
+
var looseSearch = new RegExp('.*' + query + '.*', 'i');
|
|
31
|
+
var _fuzzySearch = new RegExp('(^' + query + ')|(' + query + ')|(' + query.replace(/\s+/g, '').split('').join('.*') + ')', 'i');
|
|
32
|
+
var exact = [];
|
|
33
|
+
var first = [];
|
|
34
|
+
var loose = [];
|
|
35
|
+
var fuzzy = [];
|
|
36
|
+
console.log('arrayToFilter', arrayToFilter);
|
|
37
|
+
console.log('key', key);
|
|
38
|
+
arrayToFilter.forEach(function (option) {
|
|
39
|
+
var searchBy = !key ? option.toString() : option[key].toString();
|
|
40
|
+
var textWithoutPolishSigns = searchBy.replace(/ę/gi, 'e').replace(/ó/gi, 'o').replace(/ą/gi, 'a').replace(/ś/gi, 's').replace(/ł/gi, 'l').replace(/ż/gi, 'z').replace(/ź/gi, 'z').replace(/ć/gi, 'c').replace(/ń/gi, 'n');
|
|
41
|
+
if (searchBy.match(exactSearch) || textWithoutPolishSigns.match(exactSearch)) {
|
|
42
|
+
exact.push(option);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (searchBy.match(firstSearch) || textWithoutPolishSigns.match(firstSearch)) {
|
|
46
|
+
first.push(option);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (searchBy.match(looseSearch) || textWithoutPolishSigns.match(looseSearch)) {
|
|
50
|
+
loose.push(option);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (searchBy.match(_fuzzySearch) || textWithoutPolishSigns.match(_fuzzySearch)) {
|
|
54
|
+
fuzzy.push(option);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return union__default['default'](exact, first, loose, fuzzy);
|
|
59
|
+
} else {
|
|
60
|
+
return _rollupPluginBabelHelpers.toConsumableArray(arrayToFilter);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
exports.fuzzySearch = fuzzySearch;
|
|
65
|
+
//# sourceMappingURL=fuzzy_search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,14 +1,24 @@
|
|
|
1
|
-
import '@auroraHooks/search/use_search_types';
|
|
2
1
|
import { useState } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
import { slicedToArray as _slicedToArray } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
3
|
+
import { fuzzySearch } from '../../utilities/fuzzy_search.js';
|
|
4
|
+
|
|
5
|
+
var useSearch = function useSearch(_ref) {
|
|
6
|
+
var items = _ref.items,
|
|
7
|
+
searchKey = _ref.searchKey,
|
|
8
|
+
_ref$searchStrategy = _ref.searchStrategy,
|
|
9
|
+
searchStrategy = _ref$searchStrategy === void 0 ? fuzzySearch : _ref$searchStrategy;
|
|
10
|
+
var _useState = useState(items),
|
|
11
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
12
|
+
_items = _useState2[0],
|
|
13
|
+
setItems = _useState2[1];
|
|
14
|
+
var search = function search(query) {
|
|
15
|
+
setItems(searchStrategy(query, items, searchKey));
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
search: search,
|
|
19
|
+
items: _items
|
|
20
|
+
};
|
|
13
21
|
};
|
|
14
|
-
|
|
22
|
+
|
|
23
|
+
export { useSearch };
|
|
24
|
+
//# sourceMappingURL=use_search.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -81,6 +81,7 @@ export { DrawerContent } from "./components/drawer/components/drawer_content";
|
|
|
81
81
|
export { DrawerTitle } from "./components/drawer/components/drawer_title";
|
|
82
82
|
export { DrawerClose } from "./components/drawer/components/drawer_close";
|
|
83
83
|
export { DRAWER_DIRECTIONS } from "./components/drawer/drawer_constants";
|
|
84
|
+
export { useSearch } from "./hooks/search/use_search";
|
|
84
85
|
export { Tag } from "./components/tag/tag";
|
|
85
86
|
export { TAG_VARIANTS } from "./components/tag/tag_constants";
|
|
86
87
|
export { Switch } from "./components/switch/switch";
|
|
@@ -78,6 +78,7 @@ export { DrawerTrigger } from './components/drawer/components/drawer_trigger.js'
|
|
|
78
78
|
export { DrawerContent } from './components/drawer/components/drawer_content.js';
|
|
79
79
|
export { DrawerClose } from './components/drawer/components/drawer_close.js';
|
|
80
80
|
export { DrawerTitle } from './components/drawer/components/drawer_title.js';
|
|
81
|
+
export { useSearch } from './hooks/search/use_search.js';
|
|
81
82
|
export { TAG_VARIANTS } from './components/tag/tag_constants.js';
|
|
82
83
|
export { Tag } from './components/tag/tag.js';
|
|
83
84
|
export { Switch } from './components/switch/switch.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,63 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* @param {string}
|
|
7
|
-
* @
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* {id:
|
|
13
|
-
*
|
|
14
|
-
*
|
|
1
|
+
import { toConsumableArray as _toConsumableArray } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import union from 'lodash/union';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* searches within array of objects by given key, returns filtered array of objects using fuzzy algorithm
|
|
6
|
+
* @param {string} query - the phrase by which it searches
|
|
7
|
+
* @param {Array<Object>} arrayToFilter - array which will be searched
|
|
8
|
+
* @param {string} key - key of object within arrayToFilter where search should be used
|
|
9
|
+
* @example
|
|
10
|
+
* // returns [{id: 1, text: 'polish'}, {id: 2, text: 'portugal'}]
|
|
11
|
+
* fuzzySearch('pol', [
|
|
12
|
+
* {id: 1, text: 'polish'},
|
|
13
|
+
* {id: 2, text: 'portugal'},
|
|
14
|
+
* {id: 3, text: 'english'}
|
|
15
|
+
* ], 'text')
|
|
16
|
+
* @returns {Array} - filtered array
|
|
15
17
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (searchBy.match(fuzzySearch) || textWithoutPolishSigns.match(fuzzySearch)) {
|
|
53
|
-
fuzzy.push(option);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
return union(exact, first, loose, fuzzy);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
return [...arrayToFilter];
|
|
61
|
-
}
|
|
18
|
+
function fuzzySearch(query, arrayToFilter, key) {
|
|
19
|
+
if (query !== '' && query.search(/[-[\]/{}()*+?.\\^$|]/g) === -1) {
|
|
20
|
+
var exactSearch = new RegExp('^' + query + '$', 'i');
|
|
21
|
+
var firstSearch = new RegExp('^' + query, 'i');
|
|
22
|
+
var looseSearch = new RegExp('.*' + query + '.*', 'i');
|
|
23
|
+
var _fuzzySearch = new RegExp('(^' + query + ')|(' + query + ')|(' + query.replace(/\s+/g, '').split('').join('.*') + ')', 'i');
|
|
24
|
+
var exact = [];
|
|
25
|
+
var first = [];
|
|
26
|
+
var loose = [];
|
|
27
|
+
var fuzzy = [];
|
|
28
|
+
console.log('arrayToFilter', arrayToFilter);
|
|
29
|
+
console.log('key', key);
|
|
30
|
+
arrayToFilter.forEach(function (option) {
|
|
31
|
+
var searchBy = !key ? option.toString() : option[key].toString();
|
|
32
|
+
var textWithoutPolishSigns = searchBy.replace(/ę/gi, 'e').replace(/ó/gi, 'o').replace(/ą/gi, 'a').replace(/ś/gi, 's').replace(/ł/gi, 'l').replace(/ż/gi, 'z').replace(/ź/gi, 'z').replace(/ć/gi, 'c').replace(/ń/gi, 'n');
|
|
33
|
+
if (searchBy.match(exactSearch) || textWithoutPolishSigns.match(exactSearch)) {
|
|
34
|
+
exact.push(option);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (searchBy.match(firstSearch) || textWithoutPolishSigns.match(firstSearch)) {
|
|
38
|
+
first.push(option);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (searchBy.match(looseSearch) || textWithoutPolishSigns.match(looseSearch)) {
|
|
42
|
+
loose.push(option);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (searchBy.match(_fuzzySearch) || textWithoutPolishSigns.match(_fuzzySearch)) {
|
|
46
|
+
fuzzy.push(option);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return union(exact, first, loose, fuzzy);
|
|
51
|
+
} else {
|
|
52
|
+
return _toConsumableArray(arrayToFilter);
|
|
53
|
+
}
|
|
62
54
|
}
|
|
63
|
-
|
|
55
|
+
|
|
56
|
+
export { fuzzySearch };
|
|
57
|
+
//# sourceMappingURL=fuzzy_search.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|