Skip to content
Snippets Groups Projects
Commit 7631b7a4 authored by Millicent Billette's avatar Millicent Billette
Browse files

v3.5.7

FIX: dictionary-tree don't remove empty case to handle "(|a)" and similar cases.
parent b7380c8c
No related branches found
Tags v3.5.7
No related merge requests found
Pipeline #18352 failed
...@@ -14,6 +14,10 @@ et ce projet adhère au [versionnage sémantique](https://semver.org/spec/v2.0.0 ...@@ -14,6 +14,10 @@ et ce projet adhère au [versionnage sémantique](https://semver.org/spec/v2.0.0
## [Non-publié/Non-Stabilisé] (par [1000i100]) ## [Non-publié/Non-Stabilisé] (par [1000i100])
## [Version 3.5.7] - 2023-01-01 (par [1000i100])
### Corrections
- dictionary-tree ne supprime plus les alternatives vides ce qui permet d'avoir le comportement attendu avec des chaines comme "(|a)".
## [Version 3.5.6] - 2023-01-01 (par [1000i100]) ## [Version 3.5.6] - 2023-01-01 (par [1000i100])
### Corrections ### Corrections
- dictionary-parser génère désormais correctement les variantes désaccentuées et majuscule/minuscule, sans couplage entre identifiant secret et mot de passe. - dictionary-parser génère désormais correctement les variantes désaccentuées et majuscule/minuscule, sans couplage entre identifiant secret et mot de passe.
...@@ -152,8 +156,9 @@ et ce projet adhère au [versionnage sémantique](https://semver.org/spec/v2.0.0 ...@@ -152,8 +156,9 @@ et ce projet adhère au [versionnage sémantique](https://semver.org/spec/v2.0.0
- intégration des librairies de crypto nécessaires - intégration des librairies de crypto nécessaires
- calcul de la clef publique correspondant à chaque combinaison de secrets saisie, et comparaison à la clef publique de référence. - calcul de la clef publique correspondant à chaque combinaison de secrets saisie, et comparaison à la clef publique de référence.
[Non-publié/Non-Stabilisé]: https://git.duniter.org/libs/g1lib.js/-/compare/v3.5.6...main [Non-publié/Non-Stabilisé]: https://git.duniter.org/libs/g1lib.js/-/compare/v3.5.7...main
[Version 3.5.7]: https://git.duniter.org/libs/g1lib.js/-/compare/v3.5.6...v3.5.7
[Version 3.5.6]: https://git.duniter.org/libs/g1lib.js/-/compare/v3.5.5...v3.5.6 [Version 3.5.6]: https://git.duniter.org/libs/g1lib.js/-/compare/v3.5.5...v3.5.6
[Version 3.5.5]: https://git.duniter.org/libs/g1lib.js/-/compare/v3.5.4...v3.5.5 [Version 3.5.5]: https://git.duniter.org/libs/g1lib.js/-/compare/v3.5.4...v3.5.5
[Version 3.5.4]: https://git.duniter.org/libs/g1lib.js/-/compare/v3.5.3...v3.5.4 [Version 3.5.4]: https://git.duniter.org/libs/g1lib.js/-/compare/v3.5.3...v3.5.4
......
{ {
"name": "g1lib", "name": "g1lib",
"version": "3.5.6", "version": "3.5.7",
"description": "An ubiquitous static javascript toolbox lib for Ǧ1 / Duniter ecosystem with reliability in mind.", "description": "An ubiquitous static javascript toolbox lib for Ǧ1 / Duniter ecosystem with reliability in mind.",
"main": "nodejs/all.mjs", "main": "nodejs/all.mjs",
"browser": "browser/all.mjs", "browser": "browser/all.mjs",
......
...@@ -86,7 +86,7 @@ e@@(f|g) ...@@ -86,7 +86,7 @@ e@@(f|g)
(a|b) (a|b)
(c|d) (c|d)
h@@(i|j) h@@(i|j)
`), '((a|b|c|d)@@(a|b|c|d)|e@@(f|g)|h@@(i|j))'); `), '((|a|b|c|d)@@(|a|b|c|d)|e@@(f|g)|h@@(i|j))');
}); });
test('add @@ on part without it', t => { test('add @@ on part without it', t => {
t.is(app.parse(`(a@@b|c)`), '(a@@b|c@@c)'); t.is(app.parse(`(a@@b|c)`), '(a@@b|c@@c)');
......
...@@ -134,7 +134,7 @@ export function splitAround(pattern,treeStruct){ ...@@ -134,7 +134,7 @@ export function splitAround(pattern,treeStruct){
const subPart = recSplitter(subTree); const subPart = recSplitter(subTree);
if(subPart.matching) { if(subPart.matching) {
isMatch++; isMatch++;
if (subPart.notMatching) isAlt = true; if (typeof subPart.notMatching !== 'undefined') isAlt = true;
serialized+=subPart.matching; serialized+=subPart.matching;
altSerialized+=subPart.notMatching; altSerialized+=subPart.notMatching;
} else { } else {
...@@ -152,8 +152,8 @@ export function splitAround(pattern,treeStruct){ ...@@ -152,8 +152,8 @@ export function splitAround(pattern,treeStruct){
const notMatching = []; const notMatching = [];
treeStruct.alt.forEach(subTree=>{ treeStruct.alt.forEach(subTree=>{
const subPart = recSplitter(subTree); const subPart = recSplitter(subTree);
if(subPart.matching) matching.push(subPart.matching); if(typeof subPart.matching !== 'undefined') matching.push(subPart.matching);
if(subPart.notMatching) notMatching.push(subPart.notMatching); if(typeof subPart.notMatching !== 'undefined') notMatching.push(subPart.notMatching);
}) })
if(matching.length && notMatching.length) return {matching: `(${matching.join('|')})`,notMatching: `(${notMatching.join('|')})`} if(matching.length && notMatching.length) return {matching: `(${matching.join('|')})`,notMatching: `(${notMatching.join('|')})`}
if(matching.length) return {matching: `(${matching.join('|')})`} if(matching.length) return {matching: `(${matching.join('|')})`}
...@@ -162,8 +162,8 @@ export function splitAround(pattern,treeStruct){ ...@@ -162,8 +162,8 @@ export function splitAround(pattern,treeStruct){
throw new Error(`Error: how to splitAround ${pattern} with ${JSON.stringify(treeStruct)}`); throw new Error(`Error: how to splitAround ${pattern} with ${JSON.stringify(treeStruct)}`);
} }
const res = recSplitter(treeStruct); const res = recSplitter(treeStruct);
if(res.matching) res.matching = rawSerialize(buildTreeStruct(res.matching)); if(typeof res.matching !== 'undefined') res.matching = rawSerialize(buildTreeStruct(res.matching));
if(res.notMatching) res.notMatching = rawSerialize(buildTreeStruct(res.notMatching)); if(typeof res.notMatching !== 'undefined') res.notMatching = rawSerialize(buildTreeStruct(res.notMatching));
return res; return res;
} }
export function serialize(treeStruct) { export function serialize(treeStruct) {
......
...@@ -201,3 +201,7 @@ test(`"aa" with default settings & a speed should generate alt including "Aa@@AA ...@@ -201,3 +201,7 @@ test(`"aa" with default settings & a speed should generate alt including "Aa@@AA
for(let i=0;i<dico.length;i++) dico.splitGet(i); for(let i=0;i<dico.length;i++) dico.splitGet(i);
t.is(dico.cache['Aa@@AA'][0], 2); t.is(dico.cache['Aa@@AA'][0], 2);
}); });
test(`"(|a)" with idSecPwd:true should have 4 cases`, t => {
const dico = new app.Dictionary('(|a)',{idSecPwd:true});
t.is(dico.length, 4);
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment