Skip to content

Commit

Permalink
refactor!: implement AdjacencyGraphs as mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
SPodjasek committed Sep 5, 2023
1 parent f41edb9 commit 73ac4b0
Show file tree
Hide file tree
Showing 7 changed files with 3,371 additions and 3,384 deletions.
9 changes: 2 additions & 7 deletions packages/dart_zxcvbn/lib/src/adjacency_graphs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ class AdjacencyGraph {
const AdjacencyGraph(this.graph);
}

abstract interface class AdjacencyGraphs {
abstract final AdjacencyGraph azerty;
abstract final AdjacencyGraph qwerty;
abstract final AdjacencyGraph qwertz;
abstract final AdjacencyGraph dvorak;
abstract final AdjacencyGraph keypad;
abstract final AdjacencyGraph keypadMac;
mixin AdjacencyGraphsMixin {
Map<String, AdjacencyGraph> get entries;
}
2 changes: 1 addition & 1 deletion packages/dart_zxcvbn/lib/src/language_pack.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ part of 'zxcvbn.dart';

abstract interface class LanguagePack {
abstract final Dictionary dictionary;
abstract final AdjacencyGraphs? adjacencyGraphs;
abstract final AdjacencyGraphsMixin? adjacencyGraphs;
abstract final Translations? translations;
}
4 changes: 2 additions & 2 deletions packages/dart_zxcvbn/lib/src/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Options {

/// Defines keyboard layouts as an object which are used to find sequences.
/// Already implemented layouts can be found in [dart_zxcvbn_language_common]
AdjacencyGraphs? graphs;
AdjacencyGraphsMixin? graphs;

/// Defines if the levenshtein algorithm should be used. This will be only
/// used on the complete password and not on parts of it. This will decrease
Expand Down Expand Up @@ -98,7 +98,7 @@ class DefaultOptions extends Options {
// TODO
// this.matchers = newOptions.matchers;
// this.l33tTable = newOptions.l33tTable;
// this.graphs = newOptions.graphs;
this.graphs = newOptions.graphs;
}

Dictionary get dictionary => _dictionary;
Expand Down

0 comments on commit 73ac4b0

Please sign in to comment.