From 745df34e7a6cff8d811cf5a3ce86de4ac1654b6b Mon Sep 17 00:00:00 2001 From: "[1000i100] Millicent Billette" <git@1000i100.fr> Date: Thu, 1 Apr 2021 17:26:54 +0200 Subject: [PATCH] Bump to v3.1.0 --- CHANGELOG.fr.md | 7 ++++++- npm/package.json | 2 +- src/dictionary.mjs | 23 +++++++++++++++++++++++ src/dictionary.test.mjs | 13 +++++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 src/dictionary.mjs create mode 100644 src/dictionary.test.mjs diff --git a/CHANGELOG.fr.md b/CHANGELOG.fr.md index a564cc0..3a3abe8 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 635a9ae..e9464db 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 0000000..7ec9ad8 --- /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 0000000..7565f29 --- /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); +}); -- GitLab