Skip to content

Commit

Permalink
💡 add more comments / documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
techouse committed Apr 3, 2024
1 parent 2c3c432 commit f1da5e9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
5 changes: 5 additions & 0 deletions lib/src/enums/duplicates.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
/// An enum of all available duplicate key handling strategies.
enum Duplicates {
/// Combine duplicate keys into a single key with an array of values.
combine,

/// Use the first value for duplicate keys.
first,

/// Use the last value for duplicate keys.
last;

@override
Expand Down
4 changes: 3 additions & 1 deletion lib/src/enums/format.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ typedef Formatter = String Function(String value);

/// An enum of all supported URI component encoding formats.
enum Format {
/// https://datatracker.ietf.org/doc/html/rfc1738
rfc1738(_rfc1738Formatter),

/// default
/// https://datatracker.ietf.org/doc/html/rfc3986
/// (default)
rfc3986(_rfc3986Formatter);

const Format(this.formatter);
Expand Down
11 changes: 11 additions & 0 deletions lib/src/enums/list_format.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,20 @@ typedef ListFormatGenerator = String Function(String prefix, [String? key]);

/// An enum of all available list format options.
enum ListFormat {
/// Use brackets to represent list items, for example
/// `foo[]=123&foo[]=456&foo[]=789`
brackets(_brackets),

/// Use commas to represent list items, for example
/// `foo=123,456,789`
comma(_comma),

/// Repeat the same key to represent list items, for example
/// `foo=123&foo=456&foo=789`
repeat(_repeat),

/// Use indices in brackets to represent list items, for example
/// `foo[0]=123&foo[1]=456&foo[2]=789`
indices(_indices);

const ListFormat(this.generator);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/models/decode_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ final class DecodeOptions with EquatableMixin {
/// option.
final num parameterLimit;

/// Change the duplicate ket handling strategy
/// Change the duplicate key handling strategy
final Duplicates duplicates;

/// Set to [true] to ignore the leading question mark query prefix in the encoded input.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/models/undefined.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// Internal model to distinguish between null and not set value
/// Internal model to distinguish between [null] and not set value
final class Undefined {
const Undefined();
}

0 comments on commit f1da5e9

Please sign in to comment.