Skip to content

Commit

Permalink
💡 add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
techouse committed Apr 2, 2024
1 parent db413ac commit 571fcf0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/src/methods.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import 'package:qs_dart/src/models/decode_options.dart';
import 'package:qs_dart/src/models/encode_options.dart';
import 'package:qs_dart/src/qs.dart';

/// Convenience method for [QS.decode]
Map decode(
dynamic input, [
DecodeOptions options = const DecodeOptions(),
]) =>
QS.decode(input, options);

/// Convenience method for [QS.encode]
String encode(
Object? object, [
EncodeOptions options = const EncodeOptions(),
Expand Down
7 changes: 6 additions & 1 deletion lib/src/qs.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'dart:convert' show latin1, utf8, Encoding;
import 'dart:typed_data';
import 'dart:typed_data' show ByteBuffer;

import 'package:qs_dart/src/enums/duplicates.dart';
import 'package:qs_dart/src/enums/format.dart';
Expand All @@ -15,7 +15,10 @@ part 'extensions/decode.dart';

part 'extensions/encode.dart';

/// A query string decoder (parser) and encoder (stringifier) class.
final class QS {
/// Decodes a [String] or [Map] into a [Map].
/// Providing custom [options] will override the default behavior.
static Map decode(
dynamic input, [
DecodeOptions options = const DecodeOptions(),
Expand Down Expand Up @@ -53,6 +56,8 @@ final class QS {
return Utils.compact(obj);
}

/// Encodes an [Object] into a query [String].
/// Providing custom [options] will override the default behavior.
static String encode(
Object? object, [
EncodeOptions options = const EncodeOptions(),
Expand Down
1 change: 1 addition & 0 deletions lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:qs_dart/src/models/undefined.dart';

part 'constants/hex_table.dart';

/// A collection of utility methods used by the library.
@internal
final class Utils {
static dynamic merge(
Expand Down

0 comments on commit 571fcf0

Please sign in to comment.