@inseefr/lunatic 0.3.0-experimental → 0.3.4-experimental

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.
Files changed (63) hide show
  1. package/lib/index.js +218 -260
  2. package/lib/index.js.map +1 -1
  3. package/package.json +2 -2
  4. package/src/components/component-wrapper/controls/validators/datepicker.js +25 -14
  5. package/src/components/component-wrapper/missing/component.js +37 -17
  6. package/src/components/datepicker/component.js +8 -12
  7. package/src/components/declarations/wrappers/input-declarations-wrapper.js +31 -9
  8. package/src/components/dropdown/commons/components/dropdown.js +21 -0
  9. package/src/components/dropdown/dropdown-edit/dropdown-edit.js +4 -1
  10. package/src/components/dropdown/dropdown-simple/dropdown.js +3 -1
  11. package/src/components/input/input-number.js +2 -1
  12. package/src/components/loop-constructor/block/index.js +1 -1
  13. package/src/components/loop-constructor/index.js +1 -1
  14. package/src/components/loop-constructor/roster/index.js +1 -1
  15. package/src/components/loop-constructor/wrapper/body-component.js +3 -0
  16. package/src/components/loop-constructor/wrapper/build-components.js +33 -33
  17. package/src/components/loop-constructor/wrapper/index.js +1 -1
  18. package/src/components/suggester/components/panel/option-container.js +1 -1
  19. package/src/components/suggester/components/suggester-content.js +42 -42
  20. package/src/components/suggester/components/suggester.js +43 -3
  21. package/src/components/suggester/idb-suggester.js +7 -1
  22. package/src/components/suggester/lunatic-suggester.js +1 -0
  23. package/src/components/suggester/suggester-wrapper.js +9 -3
  24. package/src/components/table/table.js +3 -1
  25. package/src/stories/loop-constructor/README.md +27 -27
  26. package/src/stories/loop-constructor/data-input-forced.json +64 -64
  27. package/src/stories/loop-constructor/data-input.json +100 -100
  28. package/src/stories/loop-constructor/data-loop-forced.json +66 -66
  29. package/src/stories/loop-constructor/data-loop-static-forced.json +66 -66
  30. package/src/stories/loop-constructor/data-loop-static.json +81 -81
  31. package/src/stories/loop-constructor/data-loop.json +81 -81
  32. package/src/stories/loop-constructor/data-roster-forced.json +68 -68
  33. package/src/stories/loop-constructor/data-roster.json +83 -83
  34. package/src/stories/loop-constructor/loop-constructor.stories.js +180 -180
  35. package/src/stories/questionnaire/arithmetic-management.json +47 -0
  36. package/src/stories/questionnaire/logement-queen.json +23389 -22705
  37. package/src/stories/questionnaire/logement-s2.json +46027 -44536
  38. package/src/stories/questionnaire/questionnaire.stories.js +46 -13
  39. package/src/stories/questionnaire/update-external/data.json +1 -0
  40. package/src/stories/questionnaire/update-external/questionnaire.json +75 -0
  41. package/src/stories/suggester/data.json +4 -1
  42. package/src/stories/suggester/suggester-workers.stories.js +4 -1
  43. package/src/stories/utils/orchestrator-split.js +119 -0
  44. package/src/stories/utils/orchestrator.js +12 -3
  45. package/src/tests/utils/to-expose/handler/results/res-input-edited.json +158 -158
  46. package/src/tests/utils/to-expose/state/state.spec.js +59 -59
  47. package/src/utils/lib/index.js +1 -0
  48. package/src/utils/lib/pagination/navigation/shared.js +5 -5
  49. package/src/utils/lib/splitting.js +142 -0
  50. package/src/utils/suggester-workers/commons-tokenizer/create-entity-tokenizer.js +4 -2
  51. package/src/utils/suggester-workers/commons-tokenizer/filters/{filter-accents-to-lower.js → filter-accents.js} +2 -2
  52. package/src/utils/suggester-workers/commons-tokenizer/filters/{filter-accents-to-lower.spec.js → filter-accents.spec.js} +1 -1
  53. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.js +27 -1
  54. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.js +10 -0
  55. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.spec.js +12 -0
  56. package/src/utils/suggester-workers/commons-tokenizer/index.js +1 -1
  57. package/src/utils/to-expose/handler.js +67 -28
  58. package/src/utils/to-expose/hooks/filter-components.js +106 -106
  59. package/src/utils/to-expose/hooks/index.js +2 -1
  60. package/src/utils/to-expose/hooks/lunatic-split.js +421 -0
  61. package/src/utils/to-expose/hooks/lunatic.js +39 -7
  62. package/src/utils/to-expose/index.js +11 -11
  63. package/src/utils/to-expose/state.js +23 -15
@@ -1,158 +1,158 @@
1
- {
2
- "components": [
3
- { "id": "1", "componentType": "Sequence", "depth": 1 },
4
- {
5
- "id": "2",
6
- "componentType": "Input",
7
- "response": {
8
- "name": "inputOk",
9
- "values": {
10
- "PREVIOUS": null,
11
- "COLLECTED": "My input",
12
- "FORCED": null,
13
- "EDITED": "My new input",
14
- "INPUTED": null
15
- }
16
- },
17
- "depth": 1
18
- },
19
- {
20
- "id": "3",
21
- "componentType": "CheckboxGroup",
22
- "responses": [
23
- {
24
- "response": {
25
- "name": "check1",
26
- "values": {
27
- "PREVIOUS": null,
28
- "COLLECTED": true,
29
- "FORCED": null,
30
- "EDITED": null,
31
- "INPUTED": null
32
- }
33
- }
34
- },
35
- {
36
- "response": {
37
- "name": "check2",
38
- "values": {
39
- "PREVIOUS": null,
40
- "COLLECTED": false,
41
- "FORCED": true,
42
- "EDITED": null,
43
- "INPUTED": null
44
- }
45
- }
46
- }
47
- ],
48
- "depth": 1
49
- },
50
- {
51
- "id": "4",
52
- "componentType": "Table",
53
- "cells": [
54
- [
55
- { "label": "label", "depth": 1 },
56
- {
57
- "componentType": "Radio",
58
- "response": {
59
- "name": "table11",
60
- "values": {
61
- "PREVIOUS": null,
62
- "COLLECTED": "1",
63
- "FORCED": null,
64
- "EDITED": null,
65
- "INPUTED": null
66
- }
67
- },
68
- "depth": 1
69
- }
70
- ]
71
- ],
72
- "depth": 1
73
- },
74
- {
75
- "id": "5",
76
- "componentType": "RosterForLoop",
77
- "components": [
78
- {
79
- "componentType": "Input",
80
- "response": {
81
- "name": "Roster",
82
- "values": {
83
- "PREVIOUS": [null],
84
- "COLLECTED": ["ok"],
85
- "FORCED": [null],
86
- "EDITED": [null],
87
- "INPUTED": [null]
88
- }
89
- },
90
- "depth": 2
91
- }
92
- ],
93
- "depth": 1
94
- }
95
- ],
96
- "variables": {
97
- "EXTERNAL": { "VAR_EXTERNAL": "Value VAR_EXTERNAL" },
98
- "CALCULATED": {
99
- "Test": {
100
- "expression": "inputOk || \" ok\"",
101
- "value": "My input ok",
102
- "bindingDependencies": ["inputOk"]
103
- }
104
- },
105
- "COLLECTED": {
106
- "inputOk": {
107
- "componentRef": "2",
108
- "values": {
109
- "PREVIOUS": null,
110
- "COLLECTED": "My input",
111
- "FORCED": null,
112
- "EDITED": "My new input",
113
- "INPUTED": null
114
- }
115
- },
116
- "check1": {
117
- "componentRef": "3",
118
- "values": {
119
- "PREVIOUS": null,
120
- "COLLECTED": true,
121
- "FORCED": null,
122
- "EDITED": null,
123
- "INPUTED": null
124
- }
125
- },
126
- "check2": {
127
- "componentRef": "3",
128
- "values": {
129
- "PREVIOUS": null,
130
- "COLLECTED": false,
131
- "FORCED": true,
132
- "EDITED": null,
133
- "INPUTED": null
134
- }
135
- },
136
- "table11": {
137
- "componentRef": "4",
138
- "values": {
139
- "PREVIOUS": null,
140
- "COLLECTED": "1",
141
- "FORCED": null,
142
- "EDITED": null,
143
- "INPUTED": null
144
- }
145
- },
146
- "Roster": {
147
- "componentRef": "5",
148
- "values": {
149
- "PREVIOUS": [null],
150
- "COLLECTED": ["ok"],
151
- "FORCED": [null],
152
- "EDITED": [null],
153
- "INPUTED": [null]
154
- }
155
- }
156
- }
157
- }
158
- }
1
+ {
2
+ "components": [
3
+ { "id": "1", "componentType": "Sequence", "depth": 1 },
4
+ {
5
+ "id": "2",
6
+ "componentType": "Input",
7
+ "response": {
8
+ "name": "inputOk",
9
+ "values": {
10
+ "PREVIOUS": null,
11
+ "COLLECTED": "My input",
12
+ "FORCED": null,
13
+ "EDITED": "My new input",
14
+ "INPUTED": null
15
+ }
16
+ },
17
+ "depth": 1
18
+ },
19
+ {
20
+ "id": "3",
21
+ "componentType": "CheckboxGroup",
22
+ "responses": [
23
+ {
24
+ "response": {
25
+ "name": "check1",
26
+ "values": {
27
+ "PREVIOUS": null,
28
+ "COLLECTED": true,
29
+ "FORCED": null,
30
+ "EDITED": null,
31
+ "INPUTED": null
32
+ }
33
+ }
34
+ },
35
+ {
36
+ "response": {
37
+ "name": "check2",
38
+ "values": {
39
+ "PREVIOUS": null,
40
+ "COLLECTED": false,
41
+ "FORCED": true,
42
+ "EDITED": null,
43
+ "INPUTED": null
44
+ }
45
+ }
46
+ }
47
+ ],
48
+ "depth": 1
49
+ },
50
+ {
51
+ "id": "4",
52
+ "componentType": "Table",
53
+ "cells": [
54
+ [
55
+ { "label": "label", "depth": 1 },
56
+ {
57
+ "componentType": "Radio",
58
+ "response": {
59
+ "name": "table11",
60
+ "values": {
61
+ "PREVIOUS": null,
62
+ "COLLECTED": "1",
63
+ "FORCED": null,
64
+ "EDITED": null,
65
+ "INPUTED": null
66
+ }
67
+ },
68
+ "depth": 1
69
+ }
70
+ ]
71
+ ],
72
+ "depth": 1
73
+ },
74
+ {
75
+ "id": "5",
76
+ "componentType": "RosterForLoop",
77
+ "components": [
78
+ {
79
+ "componentType": "Input",
80
+ "response": {
81
+ "name": "Roster",
82
+ "values": {
83
+ "PREVIOUS": [null],
84
+ "COLLECTED": ["ok"],
85
+ "FORCED": [null],
86
+ "EDITED": [null],
87
+ "INPUTED": [null]
88
+ }
89
+ },
90
+ "depth": 2
91
+ }
92
+ ],
93
+ "depth": 1
94
+ }
95
+ ],
96
+ "variables": {
97
+ "EXTERNAL": { "VAR_EXTERNAL": "Value VAR_EXTERNAL" },
98
+ "CALCULATED": {
99
+ "Test": {
100
+ "expression": "inputOk || \" ok\"",
101
+ "value": "My new input ok",
102
+ "bindingDependencies": ["inputOk"]
103
+ }
104
+ },
105
+ "COLLECTED": {
106
+ "inputOk": {
107
+ "componentRef": "2",
108
+ "values": {
109
+ "PREVIOUS": null,
110
+ "COLLECTED": "My input",
111
+ "FORCED": null,
112
+ "EDITED": "My new input",
113
+ "INPUTED": null
114
+ }
115
+ },
116
+ "check1": {
117
+ "componentRef": "3",
118
+ "values": {
119
+ "PREVIOUS": null,
120
+ "COLLECTED": true,
121
+ "FORCED": null,
122
+ "EDITED": null,
123
+ "INPUTED": null
124
+ }
125
+ },
126
+ "check2": {
127
+ "componentRef": "3",
128
+ "values": {
129
+ "PREVIOUS": null,
130
+ "COLLECTED": false,
131
+ "FORCED": true,
132
+ "EDITED": null,
133
+ "INPUTED": null
134
+ }
135
+ },
136
+ "table11": {
137
+ "componentRef": "4",
138
+ "values": {
139
+ "PREVIOUS": null,
140
+ "COLLECTED": "1",
141
+ "FORCED": null,
142
+ "EDITED": null,
143
+ "INPUTED": null
144
+ }
145
+ },
146
+ "Roster": {
147
+ "componentRef": "5",
148
+ "values": {
149
+ "PREVIOUS": [null],
150
+ "COLLECTED": ["ok"],
151
+ "FORCED": [null],
152
+ "EDITED": [null],
153
+ "INPUTED": [null]
154
+ }
155
+ }
156
+ }
157
+ }
158
+ }
@@ -1,59 +1,59 @@
1
- import {
2
- getState,
3
- getCollectedState,
4
- getCollectedStateByValueType,
5
- getBindings,
6
- } from 'utils/to-expose/state';
7
- import questionnaire from './questionnaire';
8
- import * as R from './results';
9
-
10
- describe('state', () => {
11
- describe('getState', () => {
12
- it('should return empty object', () => {
13
- expect(getState([])).toEqual({
14
- COLLECTED: {},
15
- CALCULATED: {},
16
- EXTERNAL: {},
17
- });
18
- });
19
- it('should return object', () => {
20
- expect(getState(questionnaire)).toEqual(R.state);
21
- });
22
- });
23
- describe('getCollectedState', () => {
24
- it('should return empty object', () => {
25
- expect(getCollectedState([])).toEqual({});
26
- });
27
- it('should return object', () => {
28
- expect(getCollectedState(questionnaire)).toEqual(R.collectedState);
29
- });
30
- });
31
- describe('getCollectedStateByValueType', () => {
32
- it('should return empty object', () => {
33
- expect(getCollectedStateByValueType([])('')).toEqual({});
34
- expect(getCollectedStateByValueType(questionnaire)('')).toEqual({});
35
- });
36
- it('should return object', () => {
37
- expect(getCollectedStateByValueType(questionnaire)('COLLECTED')).toEqual(
38
- R.collectedStateCollected
39
- );
40
- expect(getCollectedStateByValueType(questionnaire)('FORCED')).toEqual(
41
- R.collectedStateForced
42
- );
43
- expect(
44
- getCollectedStateByValueType(questionnaire)('COLLECTED', true)
45
- ).toEqual(R.collectedStateCollectedWithNull);
46
- expect(
47
- getCollectedStateByValueType(questionnaire)('FORCED', true)
48
- ).toEqual(R.collectedStateForcedWithNull);
49
- });
50
- });
51
- describe('getBindings', () => {
52
- it('should return empty object', () => {
53
- expect(getBindings([])).toEqual({});
54
- });
55
- it('should return object', () => {
56
- expect(getBindings(questionnaire)).toEqual(R.bindingsResults);
57
- });
58
- });
59
- });
1
+ import {
2
+ getState,
3
+ getCollectedState,
4
+ getCollectedStateByValueType,
5
+ getBindings,
6
+ } from 'utils/to-expose/state';
7
+ import questionnaire from './questionnaire';
8
+ import * as R from './results';
9
+
10
+ describe('state', () => {
11
+ describe('getState', () => {
12
+ it('should return empty object', () => {
13
+ expect(getState([])).toEqual({
14
+ COLLECTED: {},
15
+ CALCULATED: {},
16
+ EXTERNAL: {},
17
+ });
18
+ });
19
+ it('should return object', () => {
20
+ expect(getState(questionnaire)).toEqual(R.state);
21
+ });
22
+ });
23
+ describe('getCollectedState', () => {
24
+ it('should return empty object', () => {
25
+ expect(getCollectedState([])).toEqual({});
26
+ });
27
+ it('should return object', () => {
28
+ expect(getCollectedState(questionnaire)).toEqual(R.collectedState);
29
+ });
30
+ });
31
+ describe('getCollectedStateByValueType', () => {
32
+ it('should return empty object', () => {
33
+ expect(getCollectedStateByValueType([])('')).toEqual({});
34
+ expect(getCollectedStateByValueType(questionnaire)('')).toEqual({});
35
+ });
36
+ it('should return object', () => {
37
+ expect(getCollectedStateByValueType(questionnaire)('COLLECTED')).toEqual(
38
+ R.collectedStateCollected
39
+ );
40
+ expect(getCollectedStateByValueType(questionnaire)('FORCED')).toEqual(
41
+ R.collectedStateForced
42
+ );
43
+ expect(
44
+ getCollectedStateByValueType(questionnaire)('COLLECTED', true)
45
+ ).toEqual(R.collectedStateCollectedWithNull);
46
+ expect(
47
+ getCollectedStateByValueType(questionnaire)('FORCED', true)
48
+ ).toEqual(R.collectedStateForcedWithNull);
49
+ });
50
+ });
51
+ describe('getBindings', () => {
52
+ it('should return empty object', () => {
53
+ expect(getBindings([])).toEqual({});
54
+ });
55
+ it('should return object', () => {
56
+ expect(getBindings(questionnaire)).toEqual(R.bindingsResults);
57
+ });
58
+ });
59
+ });
@@ -18,3 +18,4 @@ export * from './table';
18
18
  export * from './tooltip';
19
19
  export { isFunction } from './function';
20
20
  export { createObjectEvent } from './event';
21
+ export * from './splitting';
@@ -221,28 +221,28 @@ const getIterations = ({ component, bindings, featuresWithoutMD }) => {
221
221
  export const splitPage = (currentPage = '1', depth) => {
222
222
  const currentPageWithDepth = depth
223
223
  ? currentPage
224
- .split('.')
224
+ ?.split('.')
225
225
  .slice(0, depth + 1) // scoped
226
226
  .join('.')
227
227
  : currentPage;
228
228
 
229
229
  const currentPageWithoutIteration = currentPageWithDepth
230
- .split('#')
230
+ ?.split('#')
231
231
  .slice(0, -1)
232
232
  .join('#');
233
233
 
234
234
  const currentPageWithoutAnyIteration = currentPageWithDepth
235
- .split('.')
235
+ ?.split('.')
236
236
  .map((e) => e.split('#')[0])
237
237
  .join('.');
238
238
 
239
239
  const currentRootPage = currentPageWithoutIteration
240
- .split('.')
240
+ ?.split('.')
241
241
  .slice(0, -1)
242
242
  .join('.');
243
243
 
244
244
  const [currentComponentIndex, currentIteration] = currentPageWithDepth
245
- .split('.')
245
+ ?.split('.')
246
246
  .pop()
247
247
  .split('#')
248
248
  .map((c) => parseInt(c, 10));
@@ -0,0 +1,142 @@
1
+ const getBindingsDependenciesCalculated = (variables) => {
2
+ if (!variables) return {};
3
+ return variables.reduce((acc, { name, bindingDependencies, shapeFrom }) => {
4
+ if (shapeFrom && bindingDependencies)
5
+ return { ...acc, [name]: [...bindingDependencies, shapeFrom] };
6
+ if (bindingDependencies) return { ...acc, [name]: bindingDependencies };
7
+ if (shapeFrom) return { ...acc, [name]: [shapeFrom] };
8
+ return acc;
9
+ }, {});
10
+ };
11
+
12
+ const getAllDeps = (deps) => (variablesCalcDeps) => {
13
+ if (!deps || !variablesCalcDeps) return [];
14
+ return deps.reduce((acc, dep) => {
15
+ const depsOfDep = variablesCalcDeps[dep];
16
+ if (Array.isArray(depsOfDep)) {
17
+ return [...acc, dep, ...getAllDeps(depsOfDep)(variablesCalcDeps)];
18
+ }
19
+ return [...acc, dep];
20
+ }, []);
21
+ };
22
+
23
+ const getNestedVarsInFilterOrControl = (element) => {
24
+ if (element && Array.isArray(element?.bindingDependencies))
25
+ return element?.bindingDependencies;
26
+ return [];
27
+ };
28
+
29
+ const getNestedVarsInComponent = (component) => {
30
+ const {
31
+ componentType,
32
+ bindingDependencies = [],
33
+ conditionFilter,
34
+ controls = [],
35
+ } = component;
36
+ var bindings = [
37
+ ...bindingDependencies, // bindingDependencies of Component
38
+ ...getNestedVarsInFilterOrControl(conditionFilter), // bindingDependencies of its conditionFilter
39
+ ...controls.reduce(
40
+ (acc, c) => [...acc, ...getNestedVarsInFilterOrControl(c)],
41
+ []
42
+ ), // bindingDependencies of its controls
43
+ ];
44
+
45
+ if (componentType === 'Loop') {
46
+ const { components, loopDependencies } = component;
47
+ if (Array.isArray(loopDependencies))
48
+ bindings = [...bindings, ...loopDependencies];
49
+ if (Array.isArray(components)) {
50
+ bindings = components.reduce(
51
+ (acc, c) => [...acc, ...getNestedVarsInComponent(c)],
52
+ [...bindings]
53
+ );
54
+ }
55
+ }
56
+
57
+ return bindings;
58
+ };
59
+
60
+ const getNestedVars =
61
+ (components = []) =>
62
+ (variables) => {
63
+ const variableCalculatedDependencies =
64
+ getBindingsDependenciesCalculated(variables);
65
+ const depsVarsTemp = components
66
+ .reduce((acc, c) => {
67
+ return [...acc, ...getNestedVarsInComponent(c)];
68
+ }, [])
69
+ .filter((v, i, a) => a.indexOf(v) === i);
70
+ return getAllDeps(depsVarsTemp)(variableCalculatedDependencies).filter(
71
+ (v, i, a) => a.indexOf(v) === i
72
+ );
73
+ };
74
+
75
+ const getUsefullVariablesFromSource = (variables) => (nestedVars) => {
76
+ return variables.filter(({ variableType, name }) => {
77
+ if (variableType === 'CALCULATED' && !nestedVars.includes(name))
78
+ return false;
79
+ if (variableType === 'COLLECTED' && !nestedVars.includes(name))
80
+ return false;
81
+ return true;
82
+ });
83
+ };
84
+
85
+ export const getSplitQuestionnaireSource = (source) => {
86
+ const { components, variables, ...rest } = source;
87
+ var split = [];
88
+ var currentComponents = [];
89
+ var previousPage = null;
90
+ components.map((c) => {
91
+ const { componentType, page } = c;
92
+ // splitting by Sequence or Loop
93
+ if (
94
+ (componentType === 'Sequence' || componentType === 'Loop') &&
95
+ previousPage !== page
96
+ ) {
97
+ if (currentComponents.length > 0) split.push(currentComponents);
98
+ currentComponents = [c];
99
+ } else {
100
+ currentComponents.push(c);
101
+ }
102
+ previousPage = page;
103
+ return null;
104
+ });
105
+ if (currentComponents.length > 0) split.push(currentComponents);
106
+
107
+ return split.reduce((prev, currentSource) => {
108
+ const firstPage = currentSource[0].page;
109
+ const maxPage = currentSource[currentSource.length - 1].page;
110
+ const nestedVars = getNestedVars(currentSource)(variables);
111
+ const newVariables = getUsefullVariablesFromSource(variables)(nestedVars);
112
+
113
+ return [
114
+ ...prev,
115
+ {
116
+ ...rest,
117
+ variables: newVariables,
118
+ firstPage,
119
+ maxPage,
120
+ components: currentSource,
121
+ },
122
+ ];
123
+ }, []);
124
+ };
125
+
126
+ export const getRootPageInSources = (sources) => {
127
+ return sources.map((source) => {
128
+ const { components } = source;
129
+ return components.reduce((acc, { page }) => {
130
+ if (page) return [...acc, page];
131
+ return acc;
132
+ }, []);
133
+ });
134
+ };
135
+
136
+ export const mergeStateData = (oldData, newData) => {
137
+ return {
138
+ COLLECTED: { ...oldData.COLLECTED, ...newData.COLLECTED },
139
+ CALCULATED: { ...oldData.CALCULATED, ...newData.CALCULATED },
140
+ EXTERNAL: { ...oldData.EXTERNAL, ...newData.EXTERNAL },
141
+ };
142
+ };
@@ -3,7 +3,8 @@ import { composeFilters, createFilterStopWords } from './filters';
3
3
  import filterStemmer from './filters/filter-stemmer';
4
4
  import filterLength from './filters/filter-length';
5
5
  import filterSynonyms from './filters/filter-synonyms';
6
- import filterAccentsToLower from './filters/filter-accents-to-lower';
6
+ import filterAccents from './filters/filter-accents';
7
+ import filterToLower from './filters/filter-to-lower';
7
8
  import filterDouble from './filters/filter-double';
8
9
 
9
10
  function createMapFieldsTokenizer(fields, filters) {
@@ -20,9 +21,10 @@ function createFilterTokens(fields, stopWords) {
20
21
  const filterStopWords = createFilterStopWords(stopWords);
21
22
  const getFilters = composeFilters(
22
23
  filterDouble,
23
- filterAccentsToLower,
24
+ filterAccents,
24
25
  filterStemmer,
25
26
  filterSynonyms,
27
+ filterToLower,
26
28
  filterStopWords,
27
29
  filterLength
28
30
  );
@@ -1,6 +1,6 @@
1
1
  import removeAccents from 'remove-accents';
2
2
 
3
- function filterAccentsToLower(tokens = []) {
3
+ function filterAccents(tokens = []) {
4
4
  return tokens.map(function (token) {
5
5
  if (typeof token === 'string') {
6
6
  return removeAccents(token).toLowerCase();
@@ -9,4 +9,4 @@ function filterAccentsToLower(tokens = []) {
9
9
  });
10
10
  }
11
11
 
12
- export default filterAccentsToLower;
12
+ export default filterAccents;
@@ -1,4 +1,4 @@
1
- import filterATL from './filter-accents-to-lower';
1
+ import filterATL from './filter-accents';
2
2
 
3
3
  describe('filter-length', function () {
4
4
  it('maj accent', function () {