From f0863578fb250ad6b1d8a7cfad2933e05911d162 Mon Sep 17 00:00:00 2001 From: Felipe Delgado Date: Wed, 22 Aug 2018 17:27:20 -0400 Subject: [PATCH 1/3] Bump version number --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 4dd96ae..bfe52fc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: nanoid -version: 0.0.3 +version: 0.0.4 author: Rongjian Zhang description: A tiny, secure, URL-friendly, unique string ID generator homepage: https://github.com/pd4d10/nanoid From a9d6798c400f9e7e46f2b96c28ebfa2bc4b6b610 Mon Sep 17 00:00:00 2001 From: Felipe Delgado Date: Wed, 22 Aug 2018 17:14:32 -0400 Subject: [PATCH 2/3] Upgrade pubspec to allow Dart 2 stable --- pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index bfe52fc..57b5f0a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ description: A tiny, secure, URL-friendly, unique string ID generator homepage: https://github.com/pd4d10/nanoid environment: - sdk: ">=1.24.0 <2.0.0" + sdk: ">=1.24.0 <3.0.0" dev_dependencies: - test: ^0.12.33 + test: ^1.3.0 From 16838fc86f829386dd0efbca020aa3dfa1a862c3 Mon Sep 17 00:00:00 2001 From: Felipe Delgado Date: Wed, 22 Aug 2018 17:15:19 -0400 Subject: [PATCH 3/3] Rename const-looking variables to lowercaseCamel See: https://www.dartlang.org/guides/language/effective-dart/style#do-name-other-identifiers-using-lowercamelcase https://www.dartlang.org/guides/language/effective-dart/style#prefer-using-lowercamelcase-for-constant-names --- test/generate_test.dart | 12 ++++++------ test/nanoid_test.dart | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/generate_test.dart b/test/generate_test.dart index 42afb6f..32daff1 100644 --- a/test/generate_test.dart +++ b/test/generate_test.dart @@ -7,13 +7,13 @@ void main() { }); test('has flat distribution', () { - var COUNT = 100 * 1000; - var LENGTH = 5; - var ALPHABET = 'abcdefghijklmnopqrstuvwxyz'; + var count = 100 * 1000; + var length = 5; + var alphabet = 'abcdefghijklmnopqrstuvwxyz'; var chars = {}; - for (var i = 0; i < COUNT; i++) { - var id = generate(ALPHABET, LENGTH); + for (var i = 0; i < count; i++) { + var id = generate(alphabet, length); for (var j = 0; j < id.length; j++) { var char = id[j]; if (chars[char] == null) chars[char] = 0; @@ -22,7 +22,7 @@ void main() { } chars.forEach((k, _) { - var distribution = (chars[k] * ALPHABET.length) / (COUNT * LENGTH); + var distribution = (chars[k] * alphabet.length) / (count * length); expect(distribution, closeTo(1, 1)); }); }); diff --git a/test/nanoid_test.dart b/test/nanoid_test.dart index 481d67e..4d307d0 100644 --- a/test/nanoid_test.dart +++ b/test/nanoid_test.dart @@ -14,9 +14,9 @@ void main() { }); test('has no collisions', () { - var COUNT = 100 * 1000; + var count = 100 * 1000; var used = {}; - for (var i = 0; i < COUNT; i++) { + for (var i = 0; i < count; i++) { var id = nanoid(); expect(used[id], equals(null)); used[id] = true;