diff --git a/CHANGELOG.fr.md b/CHANGELOG.fr.md index a564cc0b27c085739d1df74137fc74b32cb0b78f..3a3abe867c9d16bd32ed373ea8d3e7302e501da3 100644 --- a/CHANGELOG.fr.md +++ b/CHANGELOG.fr.md @@ -8,11 +8,15 @@ et ce projet adhère au [versionnage sémantique](https://semver.org/spec/v2.0.0 ## Evolutions probable / Roadmap : - GraphQL stuff -- ::: comme séparateur entre identifiant secret et mdp pour la génération de combinaison à tester (usage principal Gsper) +- @@@@ comme séparateur entre identifiant secret et mdp pour la génération de combinaison à tester (usage principal Gsper) - supprimer automatiquement le code inutile dans les lib (Tree Shaking) ## [Non-publié/Non-Stabilisé] (par [1000i100]) +## [Version 3.1.0] - 2021-04-01 (par [1000i100] && [Hugo]) +### Ajouté +- génération du [format court d'affichage de pubKey](https://forum.duniter.org/t/format-de-checksum/7616) + ## [Version 3.0.2] - 2020-12-10 (par [1000i100]) ### Ajouté - minification des modules g1lib @@ -68,3 +72,4 @@ et ce projet adhère au [versionnage sémantique](https://semver.org/spec/v2.0.0 [Version 1.0.1 (Proof of Concept)]: https://framagit.org/1000i100/gsper/-/tree/v1.0.1 [1000i100]: https://framagit.org/1000i100 "@1000i100" +[Hugo]: https://trentesaux.fr/ diff --git a/npm/package.json b/npm/package.json index 635a9ae4097e474699bbcdcd8481fce3c780deb3..e9464dbeaedaa7bf739a1ef949fe53f4a1211423 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "g1lib", - "version": "3.0.2", + "version": "3.1.0", "description": "An ubiquitous static javascript toolbox lib for Ǧ1 / Duniter ecosystem with reliability in mind.", "main": "all.mjs", "author": { diff --git a/src/dictionary.mjs b/src/dictionary.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7ec9ad867ad9934328bbabba6d29983ae5c48d1c --- /dev/null +++ b/src/dictionary.mjs @@ -0,0 +1,23 @@ +export class Dictionary { + constructor(dictionaryString) { + this.properties = initProperties(dictionaryString); + incorporate(this, this.properties); + } +} + +export function initProperties(dictionaryString) { + if (!dictionaryString) return {}; + const properties = { + length: 81, + extraLength: 90 + }; + return properties; +} + +export default Dictionary; + +function incorporate(target, toAdd) { + for (const key in toAdd) { + target[key] = toAdd[key]; + } +} diff --git a/src/dictionary.test.mjs b/src/dictionary.test.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7565f2922bb32f98bf854cf806259896a17d079e --- /dev/null +++ b/src/dictionary.test.mjs @@ -0,0 +1,13 @@ +import test from 'ava'; +import * as app from './dictionary.mjs'; + +test('get dictionary length', t => { + const dictionaryString = '(a|b|c)d(e|f|g)'; + const dico = new app.Dictionary(dictionaryString); + t.is(dico.length, 81); +}); +test('get dictionary extraLength', t => { + const dictionaryString = '(a|b|c)d(e|f|g)'; + const dico = new app.Dictionary(dictionaryString); + t.true(dico.extraLength >= 81); +});