Skip to content

Commit

Permalink
🔥 remove unused Utils methods
Browse files Browse the repository at this point in the history
  • Loading branch information
techouse committed Apr 2, 2024
1 parent bbb5054 commit b79cb79
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/src/extensions/encode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ extension _$Encode on QS {
obj = '';
}

if (Utils.isNonNullishPrimitive(obj, skipNulls) || Utils.isBuffer(obj)) {
if (Utils.isNonNullishPrimitive(obj, skipNulls) || obj is ByteBuffer) {
if (encoder != null) {
final String keyValue = encodeValuesOnly ? prefix : encoder(prefix);
return ['${formatter(keyValue)}=${formatter(encoder(obj))}'];
Expand Down
1 change: 1 addition & 0 deletions lib/src/qs.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:convert' show latin1, utf8, Encoding;
import 'dart:typed_data';

import 'package:qs_dart/src/enums/duplicates.dart';
import 'package:qs_dart/src/enums/format.dart';
Expand Down
7 changes: 2 additions & 5 deletions lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ final class Utils {
});
}

static Map<K, V> assign<K, V>(Map<K, V> target, Map<K, V> source) =>
target..addAll(source);

/// A Dart representation the deprecated JavaScript escape function
/// https://developer.mozilla.org/en-US/docs/web/javascript/reference/global_objects/escape
@internal
Expand Down Expand Up @@ -371,6 +368,7 @@ final class Utils {
return value;
}

@visibleForTesting
static void removeUndefinedFromList(dynamic value) {
if (value is List) {
for (int i = 0; i < value.length; i++) {
Expand All @@ -389,6 +387,7 @@ final class Utils {
}
}

@visibleForTesting
static void removeUndefinedFromMap(Map obj) {
final Iterable keys = obj.keys;
for (int i = 0; i < keys.length; i++) {
Expand All @@ -404,8 +403,6 @@ final class Utils {
}
}

static bool isBuffer(dynamic obj) => obj is ByteBuffer;

static List<T> combine<T>(dynamic a, dynamic b) => <T>[
if (a is Iterable<T>) ...a else a,
if (b is Iterable<T>) ...b else b,
Expand Down
10 changes: 0 additions & 10 deletions test/unit/utils_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -384,16 +384,6 @@ void main() {
});
});

test('assign', () {
final Map<String, int> target = {'a': 1, 'b': 2};
final Map<String, int> source = {'b': 3, 'c': 4};
final Map<String, int> result = Utils.assign(target, source);

expect(result, equals(target));
expect(target, equals({'a': 1, 'b': 3, 'c': 4}));
expect(source, equals({'b': 3, 'c': 4}));
});

group('combine', () {
test('both arrays', () {
const List<int> a = [1];
Expand Down

0 comments on commit b79cb79

Please sign in to comment.