Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Side by Side Diff: packages/quiver/README.md

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « packages/quiver/PATENTS ('k') | packages/quiver/lib/async.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 Quiver
2 ======
3
4 Quiver is a set of utility libraries for Dart that makes using many Dart
5 libraries easier and more convenient, or adds additional functionality.
6
7 [![Build Status](https://travis-ci.org/google/quiver-dart.svg?branch=master)](ht tps://travis-ci.org/google/quiver-dart)
8 [![Coverage Status](https://img.shields.io/coveralls/google/quiver-dart.svg)](ht tps://coveralls.io/r/google/quiver-dart)
9
10 ## Documentation
11
12 [API Docs](http://www.dartdocs.org/documentation/quiver/latest) are available.
13
14 ## Installation
15
16 Add Quiver to your project's pubspec.yaml file and run `pub get`.
17 We recommend the following version constraint:
18
19 dependencies:
20 quiver: '>=0.21.0<0.22.0'
21
22 # Main Libraries
23
24 ## [quiver.async][]
25
26 Utilities for working with Futures, Streams and async computations.
27
28 `FutureGroup` is collection of Futures that signals when all its child futures
29 have completed. Allows adding new Futures as long as it hasn't completed yet.
30 Useful when async tasks can spwn new async tasks and you need to wait for all of
31 them to complete.
32
33 `FutureStream` turns a `Future<Stream>` into a `Stream` which emits the same
34 events as the stream returned from the future.
35
36 `StreamRouter` splits a Stream into mulltiple streams based on a set of
37 predicates.
38
39 `CountdownTimer` is a simple countdown timer that fires events in regular
40 increments.
41
42 `doWhileAsync`, `reduceAsync` and `forEachAsync` perform async computations on
43 the elements of on Iterables, waiting for the computation to complete before
44 processing the next element.
45
46 `CreateTimer` and `CreateTimerPeriodic` are typedefs that are useful for
47 passing Timer factories to classes and functions, increasing the testability of
48 code that depends on Timer.
49
50 `Metronome` is a self-correcting alternative to `Timer.periodic`. It provides
51 a simple, tracking periodic stream of `DateTime` events with optional anchor
52 time.
53
54 [quiver.async]: http://www.dartdocs.org/documentation/quiver/latest#quiver/quive r-async
55
56 ## [quiver.cache][]
57
58 `Cache` is a semi-persistent, asynchronously accessed, mapping of keys to
59 values. Caches are similar to Maps, except that the cache implementation might
60 store values in a remote system, so all operations are asynchronous, and caches
61 might have eviction policies.
62
63 `MapCache` is a Cache implementation backed by a Map.
64
65 [quiver.cache]: http://www.dartdocs.org/documentation/quiver/latest#quiver/quive r-cache
66
67 ## [quiver.check][]
68
69 `checkArgument` throws `ArgumentError` if the specifed argument check expression
70 is false.
71
72 `checkListIndex` throws `RangeError` if the specified index is out of bounds.
73
74 `checkNotNull` throws `ArgumentError` if the specified argument is null.
75
76 `checkState` throws `StateError` if the specifed state check expression is
77 false.
78
79 [quiver.check]: http://www.dartdocs.org/documentation/quiver/latest#quiver/quive r-check
80
81 ## [quiver.collection][]
82
83 `listsEqual`, `mapsEqual` and `setsEqual` check collections for equality.
84
85 `LruMap` is a map that removes the least recently used item when a threshold
86 length is exceeded.
87
88 `Multimap` is an associative collection that maps keys to collections of
89 values.
90
91 `BiMap` is a bidirectional map and provides an inverse view, allowing
92 lookup of key by value.
93
94 `TreeSet` is a balanced binary tree that offers a bidirectional iterator,
95 the ability to iterate from an arbitrary anchor, and 'nearest' search.
96
97 [quiver.collection]: http://www.dartdocs.org/documentation/quiver/latest#quiver/ quiver-collection
98
99 ## [quiver.core][]
100
101 `Optional` is a way to represent optional values without allowing `null`.
102
103 `firstNonNull` returns its first non-null argument.
104
105 `hashObjects`, `hash2`, `hash3`, and `hash4` generate high-quality hashCodes for
106 a list of objects, or 2, 3, or 4 arguments respectively.
107
108 [quiver.core]: http://www.dartdocs.org/documentation/quiver/latest#quiver/quiver -core
109
110 ## [quiver.io][]
111
112 `visitDirectory` is a recursive directory lister that conditionally recurses
113 into sub-directories based on the result of a handler function.
114
115 [quiver.io]: http://www.dartdocs.org/documentation/quiver/latest#quiver/quiver-i o
116
117 ## [quiver.iterables][]
118
119 `concat`, `count`, `cycle`, `enumerate`, `merge`, `partition`, `range`, and
120 `zip` create, transform, or combine Iterables in different ways, similar to
121 Python's itertools.
122
123 `min`, `max`, and `extent` retreive the minimum and maximum elements from an
124 iterable.
125
126 `GeneratingIterable` is an easy way to create lazy iterables that produce
127 elements by calling a function. A common use-case is to traverse properties in
128 an object graph, like the parent relationship in a tree.
129
130 `InfiniteIterable` is a base class for Iterables that throws on operations that
131 require a finite length.
132
133 [quiver.iterables]: http://www.dartdocs.org/documentation/quiver/latest#quiver/q uiver-iterables
134
135 ## [quiver.mirrors][]
136
137 `getTypeName` returns the name of a Type instance.
138
139 `implements` and `classImplements` determine if an instance or ClassMirror,
140 respectively, implement the interface represented by a Type instance. They
141 implement the behavior of `is` for mirrors, except for generics.
142
143 `getMemberMirror` searches though a ClassMirror and its class hierarchy for
144 a member. This makes up for the fact that `ClassMirror.members` doesn't
145 contain members from interfaces or superclasses.
146
147 `Method` wraps an InstanceMirror and Symbol to create a callable that invokes
148 a method on the instance. It in effect closurizes a method reflectively.
149
150 [quiver.mirrors]: http://www.dartdocs.org/documentation/quiver/latest#quiver/qui ver-mirrors
151
152 ## [quiver.pattern][]
153
154 pattern.dart container utilities for work with `Pattern`s and `RegExp`s.
155
156 `Glob` implements glob patterns that are commonly used with filesystem paths.
157
158 `matchesAny` combines multiple Patterns into one, and allows for exclusions.
159
160 `matchesFull` returns true if a Pattern matches an entire String.
161
162 `escapeRegex` escapes special regex characters in a String so that it can be
163 used as a literal match inside of a RegExp.
164
165 [quiver.pattern]: http://www.dartdocs.org/documentation/quiver/latest#quiver/qui ver-pattern
166
167 ## [quiver.streams][]
168
169 `collect` collects the completion events of an `Iterable` of `Future`s into a
170 `Stream`.
171
172 `enumerate` and `concat` represent `Stream` versions of the same-named
173 [quiver.iterables][] methods.
174
175 `StreamBuffer` allows for the orderly reading of elements from a stream, such
176 as a socket.
177
178 [quiver.streams]: http://www.dartdocs.org/documentation/quiver/latest#quiver/qui ver-streams
179
180 ## [quiver.strings][]
181
182 `isBlank` checks if a string is `null`, empty or made of whitespace characters.
183
184 `isEmpty` checks if a string is `null` or empty.
185
186 `equalsIgnoreCase` checks if two strings are equal, ignoring case.
187
188 `compareIgnoreCase` compares two strings, ignoring case.
189
190 `flip` flips the order of characters in a string.
191
192 `nullToEmpty` turns `null` to empty string, and returns non-empty strings
193 unchanged.
194
195 `emptyToNull` turns empty string to `null`, and returns non-empty strings
196 unchanged.
197
198 `repeat` concatenates a string to itself a given number of times.
199
200 `loop` allows you to loop through characters in a string starting and ending at
201 arbitrary indices. Out of bounds indices allow you to wrap around the string,
202 supporting a number of use-cases, including:
203
204 * Rotating: `loop('lohel', -3, 2) => 'hello'`
205 * Repeating, like `repeat`, but with better character-level control, e.g.:
206 `loop('la ', 0, 8) => 'la la la' // no tailing space`
207 * Tailing: `loop('/path/to/some/file.txt', -3) => 'txt'`
208 * Reversing: `loop('top', 3, 0) => 'pot'`
209
210 [quiver.strings]: http://www.dartdocs.org/documentation/quiver/latest#quiver/qui ver-strings
211
212 ## [quiver.time][]
213
214 `Clock` provides points in time relative to the current point in time, for
215 example: now, 2 days ago, 4 weeks from now, etc. For tesability, use Clock
216 rather than other ways of accessing time, like `new DateTime()`, so that you
217 can use a fake time function in your tests to control time.
218
219 `Now` is a typedef for functions that return the current time in microseconds,
220 since Clock deals in DateTime which only have millisecond accuracy.
221
222 `aMicrosecond`, `aMillisecond`, `aSecond`, `aMinute`, `anHour`, `aDay`, and
223 `aWeek` are unit duration constants to allow writing for example:
224
225 * `aDay` vs. `const Duration(days: 1)`
226 * `aSecond * 30` vs. `const Duration(seconds: 30)`
227
228 [quiver.time]: http://www.dartdocs.org/documentation/quiver/latest#quiver/quiver -time
229
230 # Testing Libraries
231
232 The Quiver testing libraries are intended to be used in testing code, not
233 production code. It currently consists of fake implementations of some Quiver
234 interfaces.
235
236 ## [quiver.testing.async][]
237
238 `FakeAsync` enables testing of units which depend upon timers and microtasks.
239 It supports fake advancements of time and the microtask queue, which cause fake
240 timers and microtasks to be processed. A `Clock` is provided from which to read
241 the current fake time. Faking synchronous or blocking time advancement is also
242 supported.
243
244 [quiver.testing.async]: http://www.dartdocs.org/documentation/quiver/latest#quiv er/quiver-testing-async
245
246 ## [quiver.testing.equality][]
247
248 `areEqualityGroups` is a matcher that supports testing `operator==` and
249 `hashCode` implementations.
250
251 [quiver.testing.equality]: http://www.dartdocs.org/documentation/quiver/latest#q uiver/quiver-testing-equality
252
253 ## [quiver.testing.runtime][]
254
255 `assertCheckedMode` asserts the current runtime has checked mode enabled.
256
257 [quiver.testing.runtime]: http://www.dartdocs.org/documentation/quiver/latest#qu iver/quiver-testing-runtime
258
259 ## [quiver.testing.time][]
260
261 `FakeStopwatch` is a Stopwatch that uses a provided `now()` function to get the
262 current time.
263
264 [quiver.testing.time]: http://www.dartdocs.org/documentation/quiver/latest#quive r/quiver-testing-time
OLDNEW
« no previous file with comments | « packages/quiver/PATENTS ('k') | packages/quiver/lib/async.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698