darq 1.0.0-dev.3
darq: ^1.0.0-dev.3 copied to clipboard
The power of lazy-evaluated enumerables in your hands! (A port of functional LINQ from the .NET library.)
1.0.0-dev.3 #
- Quality of life changes to the
Tuplefamily classes:- Added
fromListfactory constructors to allTupleclasses. - Made all tuple constructors
const. - Added
mapActionsto allTupleclasses.
- Added
- Added a section in the README for tuples.
1.0.0-dev.2 #
- Accidentally uploaded the previous version without updating the documentation first. Oops.
1.0.0-dev.1 #
- Null safety!
- The
defaultnamed parameter of methods which take a default value are now marked as required (but can still be explicitly set to null if the generic type argument of the iterable is a nullable type). This affects the following methods:elementAtOrDefault,firstOrDefault,firstWhereOrDefault,lagSelect,lag,lastOrDefault,lastWhereOrDefault,leadSelect,lead,padEnd,padStart - The
fillBackward,fillForward, andfillMissingextensions have been reconfigured to only target iterables of nullable types EqualityComparer.forTypehas been refactored to return a defaultEqualityComparerwhen a patching comparer for the requested type was not found. The previous behavior has been converted into the newEqualityComaprer.tryForTypemethod which instead returns null when a match is not found.- As a reminder, the default
EqualityComparerhas a comparer of(a, b) => a == b, a hasher of(a) => a.hashCode, and a sorter of(a, b) => 0
- As a reminder, the default
- Removed all calls to
checkNullErrorand argument null checks as they are now redundant - Fixed a misordering of the parameters in
aggregateRightandtryAggregateRightthat led to incorrect results in cases where the aggregation depended on concatenation (e.g. strings)
0.5.1+1 #
- Fixed a typo in
averagethat wasn't assigning the default selector properly
0.5.1 #
- Added identifiers to parameters for all function types to aid with IntelliSense (Issue #4)
- Tweaked various types' documentation for clarity
- Overrode
toListonMemoizedIterableto return the cached list if the cache had already been filled sum,averageconverted to use generic type arguments instead of num. (@rodion-m)- Fixed typo in grouping generic type parameters that was resulting in groups defaulting to
Grouping<dynamic, dynamic>(Issue #3, @Miiite)
0.5.0 #
- Added a ton more extension methods, effectively quadrupling the number of methods added to
Iterable(from 40 up to 160). Many of these methods were ported from the MoreLINQ library and modified to be more idiomatic to Dart. - New methods:
aggregateRightaggregateRightSelectaggregateSelectappendAllassertAllassertAnyassertCountatLeastatMostawaitAllawaitAnybatchbatchSelectbetweencartesiancartesianSelectcompareCountconcatAllconsumecountBydefaultRangeIfEmptyendsWithexcludeexcludeAtexcludeRangefillBackwardfillForwardfillMissingflattenindexinsertinsertAllinsertOrAppendinterleaveinterleaveAlllaglagSelectleadleadSelectmemoizemovenonNullpadEndpadStartpairwisepartitionpermutationsprependAllpreScanrandomSubsetrepeatscanskipLastsplitstartsWithsubsetstakeEverytakeLasttoHashMaptoLinkedHashMaptoSplayTreeMaptoStream
- Added "try" variants of several methods which will return
nullor a default value upon a failed iteration rather than throwing an error.tryAggregatetryAggregateRighttryInserttryInsertAlltrySingleOrDefaulttrySingleWhereOrDefault
- Added "X" variants of several methods with more parameters to perform the same operation multiple times. (The "X" ranges from 2 to 9, representing the number of parameters in the method.)
appendXcartesianXcartesianSelectXconcatXinsertXinsertOrAppendXofTypeXprependXtryInsertX
- Breaking changes:
aggregate- Returns the same type as the source iterable. (Old functionality moved to
aggregateSelect.)
- Returns the same type as the source iterable. (Old functionality moved to
segment- Renamed to
batch
- Renamed to
- New utility types:
TupleX- Members are accessed by
itemX, where X is the zero-based index of the item to get in the tuple. - Members can also be accessed using an indexer with list-style notation.
- Tuples also extend
Iterableso the members can be iterated and the tuple also has access to all iterable methods.
- Members are accessed by
0.4.0+1 #
- Fixing a bug in the documentation
0.4.0 #
Enumerableand all related subclasses have been removed. The package has changed over to using static extension methods onIterable.- Related, the trailing "E" in method names as well as the utility factory
Ehave been removed.
- Related, the trailing "E" in method names as well as the utility factory
Enumerablefactory constructors have been converted into standalone factory classes (if not made redundant by existingIterableconstructors).Enumerable.empty->Iterable.emptyEnumerable.from-> redundantEnumerable.generate->Iterable.generateEnumerable.repeat->RepeatIterator
- A new factory class has been created:
RangeIterator- Generates an iterable whose elements represent a range of integral values.
- Some methods have been renamed so as to not conflict with existing
Iterablemethods of the same name.join->joinMap
- Some methods have had functionality tweaked so as to maintain a separate identity from existing
Iterablemethods.select: Selector argument now requires(T element, int index)as the parameters.selectMany: Selector argument now requires(T element, int index)as the parameters.
- Some methods have been removed as existing methods in
Iterablemake them fully redundant.castelementAtfirstlastsingletaketakeWhileskipskipWhiletoListtoSetwhere
- A new method has been added:
segment- Groups the iterable into segments of an indicated size. Can optionally include any partial chunks at the end of the iterable.
- Extension getters have also been added to
Stringto facilitate easy conversion toIterable<String>.iterable: Returns an iterable of the characters in the string.iterableRunes: Returns an iterable of the characters in the string while respecting rune boundaries.
0.3.1 #
- Typedefs have been converted from a shorthand form to the full form. This should help with some type inference issues.
0.3.0 #
- Unit tests have been added to ensure
Iterablebuilt-in functions behave as expected. - Default reducers for methods where a comparator is optional (such as
aggregatorE,sumE, andorderByE) have been extended to also supportDurationandBigInt. - Custom error types have been overhauled to utilize default Dart error types:
UnexpectedStateError,KeyExistsError, andIntegerOverflowErrornow extendStateErrorinstead ofError.ConversionErrornow extendsCastErrorinstead ofError.IncompatibleTypeErrornow extendsUnsupportedErrorinstead ofError.NullEnumerableError,EmptyEnumerableError, andElementNotFoundErrorhave been merged intoEnumerableErrorwhich extendsStateError.OperationErrorhas been removed. Code that threwOperationErrornow throwsStateErrorwith a descriptive message.
- Added subtype support for
ValueEnumerablefor specialized behavior when the sourceIterablesupports various actions. (Currently the only specialized subtype isListIteratorwhich enables short-circuiting forcountEandelementAtEmethods to call the list'slengthproperty and indexer, respectively.) - Changed
countEto call the underlying iterable'slengthproperty whenconditionis not specified. This should enable O(1) length calculations for default Dart collections that internally implementEfficientLengthIterable. - Changed
EqualityComparerto enable global setting of default comparers of new types. For example, for a custom typeFoo, the static methodEqualityComparer.addDefaultEqualityComparer<Foo>(comparer)will set the global default comparer forFooto the passedcomparervalues. Following this call, all calls to LINQ methods that take an optionalEqualityComparer<Foo>will default to using the previously registered comparer when acompareris not specified.
Known Issues:
joinEandgroupJoinEhave a problem with the type inference of the parameters, causing the types to default todynamic. When calling these methods while specifying anEqualityComparer, it may be necessary to explicitly state the type parameters as well as the types of parameters in any closure functions to get type inference to work properly.
0.2.0 #
- The naming convention of the enumerable methods has been changed so that they are suffixed by the letter "e" (such as
selectE,joinE,whereE). This is an attempt at a compromise between keeping the names of the methods consistent with their .NET origins while avoiding conflicts with existingIterablemethods. - Added two new factory methods to
Enumerable:fromStringandgenerator.fromStringconverts aStringinto anEnumerablethat iterates over each individual character, whilegeneratorallows an iterable to be created of the specified length using a given generator function. countIfEhas been merged withcountEso thatcountEnow has aConditionas an optional parameter. If theConditionis provided, the behavior is identical tocountIfE, and if not, the behavior is identical to the originalcountE.- Fixed an issue where several of the enumerable methods were not asserting on required parameters.
0.1.2 #
- Addressing pub description warnings.
0.1.1 #
- Addressing pub formatting warnings and issues.
0.1.0 #
- Initial release.