diff --git a/CHANGELOG.md b/CHANGELOG.md index d5c9d87..0c35093 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog This project follows [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html). +## [0.7.4] - 2024-09-23 +### Changed +- Minor cleanup + ## [0.7.3] - 2024-02-04 ### Changed - Bump depenencies @@ -130,6 +134,7 @@ This project follows [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0. - Parsing from markdown - Writing to markdown +[0.7.4]: https://github.com/f3ath/change/compare/0.7.3...0.7.4 [0.7.3]: https://github.com/f3ath/change/compare/0.7.2...0.7.3 [0.7.2]: https://github.com/f3ath/change/compare/0.7.1...0.7.2 [0.7.1]: https://github.com/f3ath/change/compare/0.7.0...0.7.1 diff --git a/lib/src/changelog.dart b/lib/src/changelog.dart index d806079..446428f 100644 --- a/lib/src/changelog.dart +++ b/lib/src/changelog.dart @@ -15,11 +15,7 @@ class Changelog { final unreleased = Section(); /// All releases in chronological order (oldest first) - Iterable history() { - final releases = _releases.values.toList(); - releases.sort(); - return releases; - } + Iterable history() => _releases.values.toList()..sort(); /// Returns the release by version or throws [StateError] Release get(String version) => @@ -38,9 +34,8 @@ class Changelog { /// Returns the release which immediately precedes the [version] Release? preceding(Version version) { - final older = history().where((r) => r.version < version).toList(); - if (older.isNotEmpty) return older.last; - return null; + final older = history().where((r) => r.version < version); + return older.isEmpty ? null : older.last; } String _normalize(String version) => version.trim().toLowerCase(); diff --git a/lib/src/parser.dart b/lib/src/parser.dart index fe77f80..ea3ff53 100644 --- a/lib/src/parser.dart +++ b/lib/src/parser.dart @@ -81,7 +81,7 @@ void _parseInto(Section section, Iterable nodes) { } else if (node.tag == 'ul') { node.children! .whereType() - .map((node) => Change(type, node.children!)) + .map((it) => Change(type, it.children!)) .forEach(section.add); } } diff --git a/lib/src/section.dart b/lib/src/section.dart index 6088df3..5d1c2a2 100644 --- a/lib/src/section.dart +++ b/lib/src/section.dart @@ -14,10 +14,8 @@ class Section { String link = ''; /// Changes in the change set, optionally filtered by [type] - Iterable changes({String? type}) { - if (type == null) return _changes; - return _changes.where((_) => _.type == type); - } + Iterable changes({String? type}) => + type == null ? _changes : _changes.where((it) => it.type == type); /// Adds a change to the change set void add(Change change) { diff --git a/pubspec.yaml b/pubspec.yaml index 1b4c0f7..453294e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: change -version: 0.7.3 +version: 0.7.4 description: A Changelog manipulation library. Read/modify/write your CHANGELOG.md. Inspired by keepachangelog.com. homepage: "https://github.com/f3ath/change" @@ -13,7 +13,7 @@ dependencies: intl: ^0.19.0 dev_dependencies: - lints: ^3.0.0 + lints: ^4.0.0 test: ^1.21.1 coverage: ^1.2.0 check_coverage: ^0.0.4