Skip to content

Commit 5142ab7

Browse files
committed
Final nits for new release
1 parent 40a0b62 commit 5142ab7

File tree

6 files changed

+23
-50
lines changed

6 files changed

+23
-50
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.2.2
2+
3+
- Fix code formatting and ensure README is up to date.
4+
15
## 0.2.1
26

37
- Fix code formatting and ensure README is up to date.

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ with the prefix `xn--`.
2727
email addresses, automatically handling the `xn--` prefix and processing
2828
only the necessary parts of the string.
2929
* **Idiomatic Dart:** This package implements the `Converter<S, T>` interface
30-
defined in `dart:convert` to make working with Punycode easy and familiar.
30+
defined in `dart:convert` to make working with Punycode feel easy and familiar.
3131
* **Efficient and Tested:** Based on a port of the well-regarded Punycode.js
3232
library, including tests based on official RFC examples.
3333

@@ -37,7 +37,7 @@ Add the package to your `pubspec.yaml`:
3737

3838
```yaml
3939
dependencies:
40-
punycoder: 0.2.0
40+
punycoder: ^0.2.0
4141
```
4242
4343
Then, import the library in your Dart code:
@@ -47,8 +47,6 @@ import 'package:punycoder/punycoder.dart';
4747
```
4848

4949
## Usage
50-
The easiest way to handle domain names or emails is using the singleton
51-
`punycodeEncoder` and `punycodeDecoder` instances and their helper methods.
5250

5351
```dart
5452
import 'package:punycoder/punycoder.dart';

lib/src/encoder.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'dart:convert';
88

99
import 'package:punycoder/src/punycode_helper.dart';
1010

11-
/// Converts a string of Unicode symbols to a Punycode
11+
/// Converts a string of Unicode symbols to a Punycode
1212
/// string of ASCII-only symbols
1313
final class PunycodeEncoder extends Converter<String, String> {
1414
final bool _simpleMode;
@@ -17,8 +17,8 @@ final class PunycodeEncoder extends Converter<String, String> {
1717
/// of how Punycode encodes domains and emails
1818
const PunycodeEncoder() : _simpleMode = false;
1919

20-
/// Creates a Punycode Encoder which just works with simple
21-
/// strings and doesn't attempt to account for nuances in
20+
/// Creates a Punycode Encoder which just works with simple
21+
/// strings and doesn't attempt to account for nuances in
2222
/// how Punycode encodes domains and emails
2323
const PunycodeEncoder.simple() : _simpleMode = true;
2424

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: punycoder
22
description: Punycoder is a well tested Dart implementation of the RFC 3492 Punycode specification
3-
version: 0.2.1
3+
version: 0.2.2
44
repository: https://github.com/dropbear-software/punycoder/
55
issue_tracker: https://github.com/dropbear-software/punycoder/issues
66
topics:

test/decoder_test.dart

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ void main() {
5050
});
5151

5252
test('Chinese (traditional)', () {
53-
expect(
54-
simpleCodec.decode('ihqwctvzc91f659drss3x8bo0yb'),
55-
'他們爲什麽不說中文',
56-
);
53+
expect(simpleCodec.decode('ihqwctvzc91f659drss3x8bo0yb'), '他們爲什麽不說中文');
5754
});
5855

5956
test('Czech', () {
@@ -72,7 +69,7 @@ void main() {
7269

7370
test('Hindi (Devanagari)', () {
7471
expect(
75-
simpleCodec.decode('i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd'),
72+
simpleCodec.decode('i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd'),
7673
'यहलोगहिन्दीक्योंनहींबोलसकतेहैं',
7774
);
7875
});
@@ -102,9 +99,7 @@ void main() {
10299

103100
test('Spanish', () {
104101
expect(
105-
simpleCodec.decode(
106-
'PorqunopuedensimplementehablarenEspaol-fmd56a',
107-
),
102+
simpleCodec.decode('PorqunopuedensimplementehablarenEspaol-fmd56a'),
108103
'PorquénopuedensimplementehablarenEspañol',
109104
);
110105
});
@@ -185,10 +180,7 @@ void main() {
185180
});
186181

187182
test('with non-printable ASCII', () {
188-
expect(
189-
codec.decode('0\x01\x02foo.bar'),
190-
'0\x01\x02foo.bar',
191-
);
183+
expect(codec.decode('0\x01\x02foo.bar'), '0\x01\x02foo.bar');
192184
});
193185

194186
test('with email address', () {
@@ -201,4 +193,4 @@ void main() {
201193
});
202194
});
203195
});
204-
}
196+
}

test/encoder_test.dart

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ void main() {
5050
});
5151

5252
test('Chinese (traditional)', () {
53-
expect(
54-
simpleCodec.encode('他們爲什麽不說中文'),
55-
'ihqwctvzc91f659drss3x8bo0yb',
56-
);
53+
expect(simpleCodec.encode('他們爲什麽不說中文'), 'ihqwctvzc91f659drss3x8bo0yb');
5754
});
5855

5956
test('Czech', () {
@@ -176,14 +173,8 @@ void main() {
176173
expect(codec.encode('ma\xF1ana.com'), 'xn--maana-pta.com');
177174
expect(codec.encode('b\xFCcher.com'), 'xn--bcher-kva.com');
178175
expect(codec.encode('caf\xE9.com'), 'xn--caf-dma.com');
179-
expect(
180-
codec.encode('\u2603-\u2318.com'),
181-
'xn----dqo34k.com',
182-
);
183-
expect(
184-
codec.encode('\uD400\u2603-\u2318.com'),
185-
'xn----dqo34kn65z.com',
186-
);
176+
expect(codec.encode('\u2603-\u2318.com'), 'xn----dqo34k.com');
177+
expect(codec.encode('\uD400\u2603-\u2318.com'), 'xn----dqo34kn65z.com');
187178
expect(codec.encode('foo\x7F.example'), 'foo\x7F.example');
188179
});
189180

@@ -211,32 +202,20 @@ void main() {
211202

212203
group('separators', () {
213204
test('Using U+002E as separator', () {
214-
expect(
215-
codec.encode('ma\xF1ana\x2Ecom'),
216-
'xn--maana-pta.com',
217-
);
205+
expect(codec.encode('ma\xF1ana\x2Ecom'), 'xn--maana-pta.com');
218206
});
219207

220208
test('Using U+3002 as separator', () {
221-
expect(
222-
codec.encode('ma\xF1ana\u3002com'),
223-
'xn--maana-pta.com',
224-
);
209+
expect(codec.encode('ma\xF1ana\u3002com'), 'xn--maana-pta.com');
225210
});
226211

227212
test('Using U+FF0E as separator', () {
228-
expect(
229-
codec.encode('ma\xF1ana\uFF0Ecom'),
230-
'xn--maana-pta.com',
231-
);
213+
expect(codec.encode('ma\xF1ana\uFF0Ecom'), 'xn--maana-pta.com');
232214
});
233215

234216
test('Using U+FF61 as separator', () {
235-
expect(
236-
codec.encode('ma\xF1ana\uFF61com'),
237-
'xn--maana-pta.com',
238-
);
217+
expect(codec.encode('ma\xF1ana\uFF61com'), 'xn--maana-pta.com');
239218
});
240219
});
241220
});
242-
}
221+
}

0 commit comments

Comments
 (0)