diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f9d099..312b0bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 5.3.1 + +- Add `Map.where`, `Map.whereNot`, `Map.removeKeys`, and `Map.only` extensions. +- Add `double.roundToPrecision` extension. +- Allow `Iterable` for `Map.except` extension. +- Fix lint warnings. + ## 5.3.0 - [BREAKING] Remove deprecated global `run` function. diff --git a/EXTENSIONS.md b/EXTENSIONS.md index 64eb816..71e533e 100644 --- a/EXTENSIONS.md +++ b/EXTENSIONS.md @@ -1,6 +1,6 @@ # Extensions > *This file is auto generated. Do not edit this file manually.* -> *Last Updated: Sun, Oct 01, 2023 - 11:03 AM* +> *Last Updated: Sat, Mar 23, 2024 - 03:30 PM* ### on Comparable @@ -94,11 +94,15 @@ ### on Map | Extension | Type | Description | |---|---|---| -| [`records`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/collection/map.dart#L63) | `GETTER` | Similar to `Map.entries` but returns an iterable of records instead of `MapEntry`. One of the use-cases includes iterating over the collection with access to the key of each item in a for loop. e.g. for (final (key, value) in map.records) { print('$key: $value'); } | +| [`records`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/collection/map.dart#L84) | `GETTER` | Similar to `Map.entries` but returns an iterable of records instead of `MapEntry`. One of the use-cases includes iterating over the collection with access to the key of each item in a for loop. e.g. for (final (key, value) in map.records) { print('$key: $value'); } | | [`+`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/collection/map.dart#L40) | `METHOD` | Allows to add a record entry to `this`. | | [`<<`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/collection/map.dart#L43) | `METHOD` | Allows to add `MapEntry` to `this`. | | [`toJson`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/collection/map.dart#L46) | `METHOD` | Converts `this` map into a JSON string. | | [`except`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/collection/map.dart#L50) | `METHOD` | Returns a new `Map` with the same keys and values as `this` except keys present `keys`. | +| [`only`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/collection/map.dart#L55) | `METHOD` | Returns a new `Map` with the same keys and values but only contains the keys present in `keys`. | +| [`where`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/collection/map.dart#L62) | `METHOD` | Returns a new `Map` with the same keys and values as `this` where the key-value pair satisfies the `test` function. Similar to `Iterable.where`. | +| [`whereNot`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/collection/map.dart#L69) | `METHOD` | Returns a new `Map` with the same keys and values as `this` where the key-value pair doesn't satisfy the `test` function. | +| [`removeKeys`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/collection/map.dart#L93) | `METHOD` | Removes all the keys present in `keys` from `this` map. If `this` is an instance of `UnmodifiableMapBase`, it will return a new map with the same keys and values except the keys present in `keys`. | ### on DateTime @@ -195,9 +199,9 @@ ### on double | Extension | Type | Description | |---|---|---| -| [`isWhole`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/primitive/double.dart#L40) | `GETTER` | Returns to if `this` has .00000 fraction points | -| [`roundToPrecision`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/primitive/double.dart#L47) | `METHOD` | Rounds value `precision` number of fraction points. | -| [`isCloseTo`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/primitive/double.dart#L53) | `METHOD` | Returns true if `this` is close to `other` within `precision`. By default, `precision` is set to 1.0e-8 which is 0.00000001 which makes it suitable for most of the cases. | +| [`isWhole`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/primitive/double.dart#L42) | `GETTER` | Returns to if `this` has .00000 fraction points | +| [`roundToPrecision`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/primitive/double.dart#L54) | `METHOD` | Rounds value `precision` number of fraction points. Example: 2.1234567890.roundToPrecision(0)=> 2 2.1234567890.roundToPrecision(1)=> 2.1 2.1234567890.roundToPrecision(2)=> 2.12 2.1234567890.roundToPrecision(3)=> 2.123 | +| [`isCloseTo`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/primitive/double.dart#L63) | `METHOD` | Returns true if `this` is close to `other` within `precision`. By default, `precision` is set to 1.0e-8 which is 0.00000001 which makes it suitable for most of the cases. | ### on int @@ -339,7 +343,7 @@ | [`TODO`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/generic/generic.dart#L84) | Always throws `UnimplementedError` stating that operation is not implemented. | | [`runCaching`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/generic/generic.dart#L110) | Executes a provided action and handles potential errors. The function returns T? which represents the result of the executed action if the action is not asynchronous. If the action completes successfully, the result is returned as is. If an exception occurs during the execution, the `onError` function is called with the error and stack trace. If the `onError` function is not provided or returns null, the error is swallowed and the result is set to null. The function returns a `Future` of type T? which represents the result of the executed action if the action is asynchronous. If the action completes successfully, the result is returned as is. If an exception occurs during the execution, the `onError` function is called with the error and stack trace. If the `onError` function is not provided or returns null, the error is swallowed and the result is set to null. If the `onError` function is synchronous, the result is returned as is. If it throws an error, the error is swallowed and the result is set to null. If the `onError` function is asynchronous, a `Future` of type T? is returned. If the `onError` function completes successfully, the result is returned as is. If it throws an error, the error is swallowed and the result is set to null. | | [`randomBool`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/primitive/bool.dart#L47) | Generates a random boolean value. | -| [`randomDouble`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/primitive/double.dart#L60) | Generates a non-negative random floating point value uniformly distributed in the range from 0.0, inclusive, to 1.0, exclusive. | +| [`randomDouble`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/primitive/double.dart#L70) | Generates a non-negative random floating point value uniformly distributed in the range from 0.0, inclusive, to 1.0, exclusive. | | [`randomInt`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/primitive/int.dart#L146) | Generates a non-negative random integer uniformly distributed in the range rom 0, inclusive, to `max`, exclusive. default `max` is 1_000_000 | | [`checkNotNull`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/src/helpers/pre_conditions.dart#L39) | Throws `IllegalStateException` if `argument` is `null`. If `name` is supplied, it is used as the parameter name in the error message. Returns the `argument` if it is not null. | | [`check`](https://github.com/BirjuVachhani/screwdriver/blob/main/lib/src/helpers/pre_conditions.dart#L45) | Throws `IllegalStateException` if `value` is false. | diff --git a/README.md b/README.md index 56790f9..a025da5 100644 --- a/README.md +++ b/README.md @@ -19,14 +19,14 @@ A dart package aiming to provide useful extensions and helper functions to ease Check out [EXTENSIONS.md](EXTENSIONS.md) for a complete list of all the available extensions. ```yaml -Extensions: 232 +Extensions: 236 Helper Classes: 5 Helper Functions & Getters: 19 Typedefs: 8 Mixins: 2 ``` -> *Last Updated: Sun, Oct 01, 2023 - 11:03 AM* +> *Last Updated: Sat, Mar 23, 2024 - 03:32 PM* diff --git a/pubspec.yaml b/pubspec.yaml index 3526039..7279f14 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: screwdriver description: A dart package aiming to provide useful extensions and helper functions to ease and speed up development. -version: 5.3.0 +version: 5.3.1 homepage: https://github.com/birjuvachhani/screwdriver environment: