From 4d3102ffd8befe14ccc13b902f8f6d35598a1c6c Mon Sep 17 00:00:00 2001 From: Simon Leier Date: Mon, 29 Nov 2021 23:46:58 +0100 Subject: [PATCH] Bump to 1.0 --- CHANGELOG.md | 4 ++++ README.md | 22 ---------------------- lib/src/function.dart | 6 ------ lib/src/string.dart | 12 ------------ pubspec.yaml | 2 +- test/function_test.dart | 9 --------- test/string_test.dart | 9 --------- 7 files changed, 5 insertions(+), 59 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd113c6..f4227ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.0 +- Promote to stable version +- Remove deprecated extensions + ## 0.8.0 - [PR-136](https://github.com/leisim/dartx/pull/136) New: Multiple extensions for `Map`. `all()`, `any()`, `count()`, `filter()`, `filterKeys()`, `filterNot`, `filterValues`, `getOrElse()`, `mapEntries()`, `mapKeys()`, `mapValues()`, `maxBy()`, `maxWith()`, `minBy()`, `minWith`, `none()`, `toList()`, `toMap()`, `orEmpty()` diff --git a/README.md b/README.md index 85b5251..1722ed9 100644 --- a/README.md +++ b/README.md @@ -104,16 +104,6 @@ final word = 'abcd'.capitalize(); // Abcd final anotherWord = 'Abcd'.capitalize(); // Abcd ``` -### .chars - DEPRECATED - -Use `.characters` from the official characters package. - -Get a list of single character strings from a string. Supports emojis. - -```dart -final chars = 'family๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ'.chars; // ['f', 'a', 'm', 'i', 'l', 'y', '๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ'] -``` - ### .decapitalize Returns a copy of the string having its first letter lowercased, or the original string, if it's empty or already starts with a lower case letter. @@ -366,18 +356,6 @@ for (final i in 10.rangeTo(2).step(2)) { ## Function -### .invoke() - DEPRECATED - -Use `call()` instead. This is very useful for `null` checks. - -```dart -final func = (String value) { - print(value); -} - -func?.call('hello world'); -``` - ### .partial(), .partial2() ... Applies some of the required arguments to a function and returns a function which takes the remaining arguments. diff --git a/lib/src/function.dart b/lib/src/function.dart index c0bd209..9b00da3 100644 --- a/lib/src/function.dart +++ b/lib/src/function.dart @@ -6,12 +6,6 @@ typedef Function2 = R Function(A a, B b); typedef Function3 = R Function(A a, B b, C c); typedef Function4 = R Function(A a, B b, C c, D d); -extension Function0InvokeExtension on Function0 { - /// Invokes this function and returns it's return value. - @Deprecated('Use `call()`') - R invoke() => this(); -} - extension Function1InvokeExtensions on Function1 { /// Invokes this function and returns it's return value. R invoke(A first) => this(first); diff --git a/lib/src/string.dart b/lib/src/string.dart index 9ab6525..47fa254 100644 --- a/lib/src/string.dart +++ b/lib/src/string.dart @@ -3,18 +3,6 @@ part of dartx; const _ascii = 0x007f; const _latin1 = 0x00ff; -extension StringCharsExtension on String { - /// The characters of a string. - /// - /// A character is a Unicode Grapheme cluster represented by a substring of - /// the original string. - /// - /// Please use [StringCharacters].characters - /// https://github.com/dart-lang/characters/blob/10527437926f1b454edf9912fe700aa2506b1c3d/lib/src/extensions.dart#L9 - @Deprecated('Use .characters from the official characters package') - Iterable get chars => characters.Characters(this); -} - extension StringCapitalizeExtension on String { /// Returns a copy of this string having its first letter uppercased, or the /// original string, if it's empty or already starts with an upper case diff --git a/pubspec.yaml b/pubspec.yaml index 7f7f9f0..6da749b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: dartx description: Superpowers for Dart. Collection of useful static extension methods. -version: 0.8.0 +version: 1.0.0 homepage: https://github.com/leisim/dartx environment: diff --git a/test/function_test.dart b/test/function_test.dart index 3c9b5ab..649cc01 100644 --- a/test/function_test.dart +++ b/test/function_test.dart @@ -4,15 +4,6 @@ import 'package:test/test.dart'; void main() { group('Function', () { - group('Function0X', () { - final func = () => 5; - - test('.invoke', () { - // ignore: deprecated_member_use_from_same_package - expect(func.invoke(), 5); - }); - }); - group('Function1X', () { final func = (String s) => s; diff --git a/test/string_test.dart b/test/string_test.dart index 26d8147..6a5aed5 100644 --- a/test/string_test.dart +++ b/test/string_test.dart @@ -5,15 +5,6 @@ import 'package:test/test.dart'; void main() { group('StringX', () { - test('.chars', () { - // ignore: deprecated_member_use_from_same_package - expect('test12'.chars, ['t', 'e', 's', 't', '1', '2']); - expect('test12'.characters, ['t', 'e', 's', 't', '1', '2']); - // ignore: deprecated_member_use_from_same_package - expect('เดโŒ›๏ค™ะ‘๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ'.chars, ['เด', 'โŒ›', '๏ค™', 'ะ‘', '๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ']); - expect('เดโŒ›๏ค™ะ‘๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ'.characters, ['เด', 'โŒ›', '๏ค™', 'ะ‘', '๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ']); - }); - test('.capitalize()', () { expect(''.capitalize(), ''); expect('123'.capitalize(), '123');