├── .editorconfig
├── .gitignore
├── CODE_OF_CONDUCT.md
├── LICENSE.txt
├── README.md
├── angular.json
├── assets
├── new-way.png
└── old-way.png
├── browserslist
├── package-lock.json
├── package.json
├── projects
├── async-pipeline
│ ├── karma.conf.js
│ ├── ng-package.json
│ ├── package.json
│ ├── src
│ │ ├── lib
│ │ │ ├── debounce-time
│ │ │ │ ├── debounce-time.module.ts
│ │ │ │ └── debounce-time.pipe.ts
│ │ │ ├── debounce
│ │ │ │ ├── debounce.module.ts
│ │ │ │ └── debounce.pipe.ts
│ │ │ ├── delay
│ │ │ │ ├── delay.module.ts
│ │ │ │ └── delay.pipe.ts
│ │ │ ├── distinct-until-changed
│ │ │ │ ├── distinct-until-changed.module.ts
│ │ │ │ └── distinct-until-changed.pipe.ts
│ │ │ ├── first
│ │ │ │ ├── first.module.ts
│ │ │ │ └── first.pipe.ts
│ │ │ ├── get
│ │ │ │ ├── get.module.ts
│ │ │ │ └── get.pipe.ts
│ │ │ ├── index.ts
│ │ │ ├── last
│ │ │ │ ├── last.module.ts
│ │ │ │ └── last.pipe.ts
│ │ │ ├── length
│ │ │ │ ├── length.module.ts
│ │ │ │ └── length.pipe.ts
│ │ │ ├── log
│ │ │ │ ├── log.module.ts
│ │ │ │ └── log.pipe.ts
│ │ │ ├── map-to
│ │ │ │ ├── map-to.module.ts
│ │ │ │ └── map-to.pipe.ts
│ │ │ ├── not
│ │ │ │ ├── not.module.ts
│ │ │ │ └── not.pipe.ts
│ │ │ ├── pairwise
│ │ │ │ ├── pairwise.module.ts
│ │ │ │ └── pairwise.pipe.ts
│ │ │ ├── skip-last
│ │ │ │ ├── skip-last.module.ts
│ │ │ │ └── skip-last.pipe.ts
│ │ │ ├── skip-until
│ │ │ │ ├── skip-until.module.ts
│ │ │ │ └── skip-until.pipe.ts
│ │ │ ├── skip-while
│ │ │ │ ├── skip-while.module.ts
│ │ │ │ └── skip-while.pipe.ts
│ │ │ ├── skip
│ │ │ │ ├── skip.module.ts
│ │ │ │ └── skip.pipe.ts
│ │ │ ├── take-last
│ │ │ │ ├── take-last.module.ts
│ │ │ │ └── take-last.pipe.ts
│ │ │ ├── take-until
│ │ │ │ ├── take-until.module.ts
│ │ │ │ └── take-until.pipe.ts
│ │ │ ├── take-while
│ │ │ │ ├── take-while.module.ts
│ │ │ │ └── take-while.pipe.ts
│ │ │ ├── take
│ │ │ │ ├── take.module.ts
│ │ │ │ └── take.pipe.ts
│ │ │ ├── throttle-time
│ │ │ │ ├── throttle-time.module.ts
│ │ │ │ └── throttle-time.pipe.ts
│ │ │ └── throttle
│ │ │ │ ├── throttle.module.ts
│ │ │ │ └── throttle.pipe.ts
│ │ ├── public-api.ts
│ │ └── test.ts
│ ├── tsconfig.lib.json
│ ├── tsconfig.spec.json
│ └── tslint.json
└── demo
│ ├── browserslist
│ ├── e2e
│ ├── protractor.conf.js
│ ├── src
│ │ ├── app.e2e-spec.ts
│ │ └── app.po.ts
│ └── tsconfig.json
│ ├── karma.conf.js
│ ├── src
│ ├── app
│ │ ├── app.component.ts
│ │ └── app.module.ts
│ ├── assets
│ │ └── .gitkeep
│ ├── environments
│ │ ├── environment.prod.ts
│ │ └── environment.ts
│ ├── favicon.ico
│ ├── index.html
│ ├── main.ts
│ ├── polyfills.ts
│ ├── styles.css
│ └── test.ts
│ ├── tsconfig.app.json
│ ├── tsconfig.spec.json
│ └── tslint.json
├── tsconfig.json
└── tslint.json
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see https://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | max_line_length = off
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 | # Only exists if Bazel was run
8 | /bazel-out
9 |
10 | # dependencies
11 | /node_modules
12 |
13 | # profiling files
14 | chrome-profiler-events.json
15 | speed-measure-plugin.json
16 |
17 | # IDEs and editors
18 | /.idea
19 | .project
20 | .classpath
21 | .c9/
22 | *.launch
23 | .settings/
24 | *.sublime-workspace
25 |
26 | # IDE - VSCode
27 | .vscode/*
28 | !.vscode/settings.json
29 | !.vscode/tasks.json
30 | !.vscode/launch.json
31 | !.vscode/extensions.json
32 | .history/*
33 |
34 | # misc
35 | /.sass-cache
36 | /connect.lock
37 | /coverage
38 | /libpeerconnection.log
39 | npm-debug.log
40 | yarn-error.log
41 | testem.log
42 | /typings
43 |
44 | # System Files
45 | .DS_Store
46 | Thumbs.db
47 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Code of Conduct
2 |
3 | As contributors and maintainers of the Nebular project, and in the interest of fostering an open and welcoming community,
4 | we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
5 |
6 | We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender,
7 | gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality or anything else.
8 |
9 | Examples of unacceptable behavior by participants include:
10 |
11 | * The use of sexualized language or imagery
12 | * Personal attacks
13 | * Trolling or insulting/derogatory comments
14 | * Public or private harassment
15 | * Publishing other's private information, such as physical or electronic addresses, without explicit permission
16 | * Other unethical or unprofessional conduct.
17 |
18 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues,
19 | and other contributions that are not aligned to this Code of Conduct.
20 | By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project.
21 | Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
22 |
23 | This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
24 |
25 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
26 |
27 | This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
28 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2017 Akveo.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AsyncPipeline
2 |
3 | Do you still use streams in an old fashioned way? 🧐
4 |
5 | 
6 |
7 | Async pipeline bring **RxJS** operators in Angular templates! 🔥
8 | Useful custom operators included!
9 |
10 | 
11 |
12 | ## Getting started
13 |
14 | - `npm i ngx-async-pipeline`
15 | - Import required modules:
16 | ```typescript
17 | import { CommonModule } from '@angular/common';
18 | import { NotModule, LengthModule, SkipModule } from 'ngx-async-pipeline';
19 |
20 | @NgModule({
21 | imports: [
22 | CommonModule,
23 | NotModule,
24 | LengthModule,
25 | SkipModule,
26 | ],
27 | })
28 | export class AppModule {}
29 | ```
30 |
31 | - Use pipes
32 | ```html
33 |
34 | ```
35 |
36 | - Be awesome 🌈
37 |
38 | ## Available pipes
39 |
40 | ### Custom pipes
41 |
42 | Here's a list of custom pipes introduced to bring simplicity and clarity to Angular templates.
43 |
44 | - [length](#lengthpipe)
45 | - [log](#logpipe)
46 | - [not](#notpipe)
47 | - [get](#getpipe)
48 |
49 | ### RxJS
50 |
51 | Here's a list of **RxJS** operators provided as pipes. Each **RxJS** pipe has the same API as appropriate operator.
52 |
53 | - [debounce](https://rxjs.dev/api/operators/debounce)
54 | - [debounceTime](#debouncetimepipe)
55 | - [delay](#delaypipe)
56 | - [distinctUntilChanged](#distinctuntilchangedpipe)
57 | - [first](#firstpipe)
58 | - [last](#lastpipe)
59 | - [mapTo](#maptopipe)
60 | - [pairwise](#pairwisepipe)
61 | - [skip](#skippipe)
62 | - [skipLast](#skiplastpipe)
63 | - [skipUntil](https://rxjs.dev/api/operators/skipUntil)
64 | - [skipWhile](https://rxjs.dev/api/operators/skipWhile)
65 | - [take](#takepipe)
66 | - [takeLast](#takelastpipe)
67 | - [takeUntil](https://rxjs.dev/api/operators/takeUntil)
68 | - [takeWhile](https://rxjs.dev/api/operators/takeWhile)
69 | - [throttle](#throttlepipe)
70 | - [throttleTime](https://rxjs.dev/api/operators/throttleTime)
71 |
72 | ## Custom pipes
73 |
74 | ### LengthPipe
75 |
76 | ```typescript
77 | // app.module.ts
78 | import { LengthModule } from 'ngx-async-pipeline';
79 |
80 | @NgModule({
81 | imports: [ LengthModule ],
82 | })
83 | export class AppModule {}
84 |
85 | // app.component.ts
86 | @Component({
87 | template: `
88 | {{ title$ | length | async }}
89 | `,
90 | })
91 | export class AppComponent {
92 | title$: Observable = of('Hello, Async Pipeline!');
93 | }
94 | ```
95 |
96 | **length** operator has to be used to retrieve the length of the *string* or *array*
97 | **title$ | length**.
98 |
99 | ### LogPipe
100 |
101 | ```typescript
102 | // app.module.ts
103 | import { LogModule } from 'ngx-async-pipeline';
104 |
105 | @NgModule({
106 | imports: [ LogModule ],
107 | })
108 | export class AppModule {}
109 |
110 | // app.component.ts
111 | @Component({
112 | template: `
113 | {{ title$ | log | async }}
114 | `,
115 | })
116 | export class AppComponent {
117 | title$: Observable = of('Hello, Async Pipeline!');
118 | }
119 | ```
120 |
121 | **log** operator will *console.log* each value from the stream
122 | **title$ | log**.
123 |
124 | ### NotPipe
125 |
126 | ```typescript
127 | // app.module.ts
128 | import { NotModule } from 'ngx-async-pipeline';
129 |
130 | @NgModule({
131 | imports: [ NotModule ],
132 | })
133 | export class AppModule {}
134 |
135 | // app.component.ts
136 | @Component({
137 | template: `
138 |
139 | No Data
140 |
141 | `,
142 | })
143 | export class AppComponent {
144 | data$: Observable = of([
145 | 'Hello, Async Pipeline!',
146 | 'Some another string',
147 | 'And one more string',
148 | 'And so on...',
149 | ]);
150 | }
151 | ```
152 |
153 | **not** operator will negate the value from the stream using **!** operator
154 | **condition$ | not**
155 |
156 | ### GetPipe
157 |
158 | ```typescript
159 | // app.module.ts
160 | import { GetModule } from 'ngx-async-pipeline';
161 |
162 | @NgModule({
163 | imports: [ GetModule ],
164 | })
165 | export class AppModule {}
166 |
167 | // app.component.ts
168 | @Component({
169 | template: `
170 | {{ data$ | get:'title' | async }}
171 | `,
172 | })
173 | export class AppComponent {
174 | data$: Observable<{ title: string }> = of({ title: 'Here is a title!' });
175 | }
176 | ```
177 |
178 | Using **get** pipe you can get a value from an object by key provided as a param
179 | **get:'title'**. Or, **get** could be used to retrieve a specific item from an array
180 | **get:3**.
181 |
182 | ## RxJS pipes
183 |
184 | ### DebounceTimePipe
185 |
186 | ```typescript
187 | // app.module.ts
188 | import { DebounceTimeModule } from 'ngx-async-pipeline';
189 |
190 | @NgModule({
191 | imports: [ DebounceTimeModule ],
192 | })
193 | export class AppModule {}
194 |
195 | // app.component.ts
196 | @Component({
197 | template: `
198 | {{ title$ | debounceTime:1000 | async }}
199 | `,
200 | })
201 | export class AppComponent {
202 | title$: Observable = of('Hello, Async Pipeline!');
203 | }
204 | ```
205 |
206 | [Official documentation for *debounceTime* operator.](https://rxjs.dev/api/operators/debounceTime)
207 |
208 | ### DelayPipe
209 |
210 | ```typescript
211 | // app.module.ts
212 | import { DelayModule } from 'ngx-async-pipeline';
213 |
214 | @NgModule({
215 | imports: [ DelayModule ],
216 | })
217 | export class AppModule {}
218 |
219 | // app.component.ts
220 | @Component({
221 | template: `
222 | {{ title$ | delay:1000 | async }}
223 | `,
224 | })
225 | export class AppComponent {
226 | title$: Observable = of('Hello, Async Pipeline!');
227 | }
228 | ```
229 |
230 | [Official documentation for *delay* operator.](https://rxjs.dev/api/operators/delay)
231 |
232 | ### DistinctUntilChangedPipe
233 |
234 | ```typescript
235 | // app.module.ts
236 | import { DistinctUntilChangedModule } from 'ngx-async-pipeline';
237 |
238 | @NgModule({
239 | imports: [ DistinctUntilChangedModule ],
240 | })
241 | export class AppModule {}
242 |
243 | // app.component.ts
244 | @Component({
245 | template: `
246 | {{ title$ | distinctUntilChanged | async }}
247 | `,
248 | })
249 | export class AppComponent {
250 | title$: Observable = of('Hello, Async Pipeline!');
251 | }
252 | ```
253 |
254 | [Official documentation for *distinctUntilChanged* operator.](https://rxjs.dev/api/operators/distinctUntilChanged)
255 |
256 | ### FirstPipe
257 |
258 | ```typescript
259 | // app.module.ts
260 | import { FirstModule } from 'ngx-async-pipeline';
261 |
262 | @NgModule({
263 | imports: [ FirstModule ],
264 | })
265 | export class AppModule {}
266 |
267 | // app.component.ts
268 | @Component({
269 | template: `
270 | {{ title$ | first:3 | async }}
271 | `,
272 | })
273 | export class AppComponent {
274 | title$: Observable = of('Hello, Async Pipeline!');
275 | }
276 | ```
277 |
278 | [Official documentation for *first* operator.](https://rxjs.dev/api/operators/first)
279 |
280 | ### LastPipe
281 |
282 | ```typescript
283 | // app.module.ts
284 | import { LastModule } from 'ngx-async-pipeline';
285 |
286 | @NgModule({
287 | imports: [ LastModule ],
288 | })
289 | export class AppModule {}
290 |
291 | // app.component.ts
292 | @Component({
293 | template: `
294 | {{ title$ | last:3 | async }}
295 | `,
296 | })
297 | export class AppComponent {
298 | title$: Observable = of('Hello, Async Pipeline!');
299 | }
300 | ```
301 |
302 | [Official documentation for *last* operator.](https://rxjs.dev/api/operators/last)
303 |
304 | ### MapToPipe
305 |
306 | ```typescript
307 | // app.module.ts
308 | import { MapToModule } from 'ngx-async-pipeline';
309 |
310 | @NgModule({
311 | imports: [ MapToModule ],
312 | })
313 | export class AppModule {}
314 |
315 | // app.component.ts
316 | @Component({
317 | template: `
318 | {{ title$ | mapTo:'some other string' | async }}
319 | `,
320 | })
321 | export class AppComponent {
322 | title$: Observable = of('Hello, Async Pipeline!');
323 | }
324 | ```
325 |
326 | [Official documentation for *mapTo* operator.](https://rxjs.dev/api/operators/mapTo)
327 |
328 | ### PairwisePipe
329 |
330 | ```typescript
331 | // app.module.ts
332 | import { PairwiseModule } from 'ngx-async-pipeline';
333 |
334 | @NgModule({
335 | imports: [ PairwiseModule ],
336 | })
337 | export class AppModule {}
338 |
339 | // app.component.ts
340 | @Component({
341 | template: `
342 | {{ title$ | pairwise | async }}
343 | `,
344 | })
345 | export class AppComponent {
346 | title$: Observable = of('Hello, Async Pipeline!');
347 | }
348 | ```
349 |
350 | [Official documentation for *pairwise* operator.](https://rxjs.dev/api/operators/pairwise)
351 |
352 | ### SkipPipe
353 |
354 | ```typescript
355 | // app.module.ts
356 | import { SkipModule } from 'ngx-async-pipeline';
357 |
358 | @NgModule({
359 | imports: [ SkipModule ],
360 | })
361 | export class AppModule {}
362 |
363 | // app.component.ts
364 | @Component({
365 | template: `
366 | {{ title$ | skip:3 | async }}
367 | `,
368 | })
369 | export class AppComponent {
370 | title$: Observable = of('Hello, Async Pipeline!');
371 | }
372 | ```
373 |
374 | [Official documentation for *skip* operator.](https://rxjs.dev/api/operators/skip)
375 |
376 | ### SkipLastPipe
377 |
378 | ```typescript
379 | // app.module.ts
380 | import { SkipLastModule } from 'ngx-async-pipeline';
381 |
382 | @NgModule({
383 | imports: [ SkipLastModule ],
384 | })
385 | export class AppModule {}
386 |
387 | // app.component.ts
388 | @Component({
389 | template: `
390 | {{ title$ | skipLast:3 | async }}
391 | `,
392 | })
393 | export class AppComponent {
394 | title$: Observable = of('Hello, Async Pipeline!');
395 | }
396 | ```
397 |
398 | [Official documentation for *skipLast* operator.](https://rxjs.dev/api/operators/skipLast)
399 |
400 | ### TakePipe
401 |
402 | ```typescript
403 | // app.module.ts
404 | import { TakeModule } from 'ngx-async-pipeline';
405 |
406 | @NgModule({
407 | imports: [ TakeModule ],
408 | })
409 | export class AppModule {}
410 |
411 | // app.component.ts
412 | @Component({
413 | template: `
414 | {{ title$ | take:3 | async }}
415 | `,
416 | })
417 | export class AppComponent {
418 | title$: Observable = of('Hello, Async Pipeline!');
419 | }
420 | ```
421 |
422 | [Official documentation for *take* operator.](https://rxjs.dev/api/operators/take)
423 |
424 | ### TakeLastPipe
425 |
426 | ```typescript
427 | // app.module.ts
428 | import { TakeLastModule } from 'ngx-async-pipeline';
429 |
430 | @NgModule({
431 | imports: [ TakeLastModule ],
432 | })
433 | export class AppModule {}
434 |
435 | // app.component.ts
436 | @Component({
437 | template: `
438 | {{ title$ | takeLast:3 | async }}
439 | `,
440 | })
441 | export class AppComponent {
442 | title$: Observable = of('Hello, Async Pipeline!');
443 | }
444 | ```
445 |
446 | [Official documentation for *takeLast* operator.](https://rxjs.dev/api/operators/takeLast)
447 |
448 | ### ThrottlePipe
449 |
450 | ```typescript
451 | // app.module.ts
452 | import { ThrottleModule } from 'ngx-async-pipeline';
453 |
454 | @NgModule({
455 | imports: [ ThrottleModule ],
456 | })
457 | export class AppModule {}
458 |
459 | // app.component.ts
460 | @Component({
461 | template: `
462 | {{ title$ | throttle:1000 | async }}
463 | `,
464 | })
465 | export class AppComponent {
466 | title$: Observable = of('Hello, Async Pipeline!');
467 | }
468 | ```
469 |
470 | [Official documentation for *throttle* operator.](https://rxjs.dev/api/operators/throttle)
471 |
472 |
473 | ## How can I support the developer?
474 |
475 | - Create pull requests, submit bugs, suggest new features or documentation updates 🔧
476 | - Star my GitHub repos ⭐️
477 | - Read me on [Medium](https://medium.com/@nik.poltoratsky)
478 | - Follow me on [Twitter](https://twitter.com/nikpoltoratsky) 🐾
479 |
--------------------------------------------------------------------------------
/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "async-pipeline": {
7 | "projectType": "library",
8 | "root": "projects/async-pipeline",
9 | "sourceRoot": "projects/async-pipeline/src",
10 | "prefix": "lib",
11 | "architect": {
12 | "build": {
13 | "builder": "@angular-devkit/build-ng-packagr:build",
14 | "options": {
15 | "tsConfig": "projects/async-pipeline/tsconfig.lib.json",
16 | "project": "projects/async-pipeline/ng-package.json"
17 | }
18 | },
19 | "test": {
20 | "builder": "@angular-devkit/build-angular:karma",
21 | "options": {
22 | "main": "projects/async-pipeline/src/test.ts",
23 | "tsConfig": "projects/async-pipeline/tsconfig.spec.json",
24 | "karmaConfig": "projects/async-pipeline/karma.conf.js"
25 | }
26 | },
27 | "lint": {
28 | "builder": "@angular-devkit/build-angular:tslint",
29 | "options": {
30 | "tsConfig": [
31 | "projects/async-pipeline/tsconfig.lib.json",
32 | "projects/async-pipeline/tsconfig.spec.json"
33 | ],
34 | "exclude": [
35 | "**/node_modules/**"
36 | ]
37 | }
38 | }
39 | }
40 | },
41 | "demo": {
42 | "projectType": "application",
43 | "schematics": {
44 | "@schematics/angular:class": {
45 | "skipTests": true
46 | },
47 | "@schematics/angular:component": {
48 | "skipTests": true
49 | },
50 | "@schematics/angular:directive": {
51 | "skipTests": true
52 | },
53 | "@schematics/angular:guard": {
54 | "skipTests": true
55 | },
56 | "@schematics/angular:module": {
57 | "skipTests": true
58 | },
59 | "@schematics/angular:pipe": {
60 | "skipTests": true
61 | },
62 | "@schematics/angular:service": {
63 | "skipTests": true
64 | }
65 | },
66 | "root": "projects/demo",
67 | "sourceRoot": "projects/demo/src",
68 | "prefix": "app",
69 | "architect": {
70 | "build": {
71 | "builder": "@angular-devkit/build-angular:browser",
72 | "options": {
73 | "outputPath": "dist/demo",
74 | "index": "projects/demo/src/index.html",
75 | "main": "projects/demo/src/main.ts",
76 | "polyfills": "projects/demo/src/polyfills.ts",
77 | "tsConfig": "projects/demo/tsconfig.app.json",
78 | "aot": false,
79 | "assets": [
80 | "projects/demo/src/favicon.ico",
81 | "projects/demo/src/assets"
82 | ],
83 | "styles": [
84 | "projects/demo/src/styles.css"
85 | ],
86 | "scripts": []
87 | },
88 | "configurations": {
89 | "production": {
90 | "fileReplacements": [
91 | {
92 | "replace": "projects/demo/src/environments/environment.ts",
93 | "with": "projects/demo/src/environments/environment.prod.ts"
94 | }
95 | ],
96 | "optimization": true,
97 | "outputHashing": "all",
98 | "sourceMap": false,
99 | "extractCss": true,
100 | "namedChunks": false,
101 | "aot": true,
102 | "extractLicenses": true,
103 | "vendorChunk": false,
104 | "buildOptimizer": true,
105 | "budgets": [
106 | {
107 | "type": "initial",
108 | "maximumWarning": "2mb",
109 | "maximumError": "5mb"
110 | }
111 | ]
112 | }
113 | }
114 | },
115 | "serve": {
116 | "builder": "@angular-devkit/build-angular:dev-server",
117 | "options": {
118 | "browserTarget": "demo:build"
119 | },
120 | "configurations": {
121 | "production": {
122 | "browserTarget": "demo:build:production"
123 | }
124 | }
125 | },
126 | "extract-i18n": {
127 | "builder": "@angular-devkit/build-angular:extract-i18n",
128 | "options": {
129 | "browserTarget": "demo:build"
130 | }
131 | },
132 | "test": {
133 | "builder": "@angular-devkit/build-angular:karma",
134 | "options": {
135 | "main": "projects/demo/src/test.ts",
136 | "polyfills": "projects/demo/src/polyfills.ts",
137 | "tsConfig": "projects/demo/tsconfig.spec.json",
138 | "karmaConfig": "projects/demo/karma.conf.js",
139 | "assets": [
140 | "projects/demo/src/favicon.ico",
141 | "projects/demo/src/assets"
142 | ],
143 | "styles": [
144 | "projects/demo/src/styles.css"
145 | ],
146 | "scripts": []
147 | }
148 | },
149 | "lint": {
150 | "builder": "@angular-devkit/build-angular:tslint",
151 | "options": {
152 | "tsConfig": [
153 | "projects/demo/tsconfig.app.json",
154 | "projects/demo/tsconfig.spec.json",
155 | "projects/demo/e2e/tsconfig.json"
156 | ],
157 | "exclude": [
158 | "**/node_modules/**"
159 | ]
160 | }
161 | },
162 | "e2e": {
163 | "builder": "@angular-devkit/build-angular:protractor",
164 | "options": {
165 | "protractorConfig": "projects/demo/e2e/protractor.conf.js",
166 | "devServerTarget": "demo:serve"
167 | },
168 | "configurations": {
169 | "production": {
170 | "devServerTarget": "demo:serve:production"
171 | }
172 | }
173 | }
174 | }
175 | }
176 | },
177 | "defaultProject": "async-pipeline"
178 | }
179 |
--------------------------------------------------------------------------------
/assets/new-way.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tibing/async-pipeline/fd6ec235b3ab1b254ea77f56b2e73bfc2f9e3f7e/assets/new-way.png
--------------------------------------------------------------------------------
/assets/old-way.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tibing/async-pipeline/fd6ec235b3ab1b254ea77f56b2e73bfc2f9e3f7e/assets/old-way.png
--------------------------------------------------------------------------------
/browserslist:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # You can see what browsers were selected by your queries by running:
6 | # npx browserslist
7 |
8 | > 0.5%
9 | last 2 versions
10 | Firefox ESR
11 | not dead
12 | not IE 9-11 # For IE 9-11 support, remove 'not'.
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "async-pipeline",
3 | "version": "0.0.0",
4 | "scripts": {
5 | "ng": "ng",
6 | "start": "ng serve",
7 | "build": "ng build",
8 | "test": "ng test",
9 | "lint": "ng lint",
10 | "e2e": "ng e2e"
11 | },
12 | "private": true,
13 | "dependencies": {
14 | "@angular/animations": "~8.0.0",
15 | "@angular/common": "~8.0.0",
16 | "@angular/compiler": "~8.0.0",
17 | "@angular/core": "~8.0.0",
18 | "@angular/forms": "~8.0.0",
19 | "@angular/platform-browser": "~8.0.0",
20 | "@angular/platform-browser-dynamic": "~8.0.0",
21 | "@angular/router": "~8.0.0",
22 | "ngx-async-pipeline": "0.0.2",
23 | "rxjs": "~6.4.0",
24 | "tslib": "^1.9.0",
25 | "zone.js": "~0.9.1"
26 | },
27 | "devDependencies": {
28 | "@angular-devkit/build-angular": "~0.800.0",
29 | "@angular-devkit/build-ng-packagr": "~0.800.0",
30 | "@angular/cli": "~8.0.1",
31 | "@angular/compiler-cli": "~8.0.0",
32 | "@angular/language-service": "~8.0.0",
33 | "@types/node": "~8.9.4",
34 | "@types/jasmine": "~3.3.8",
35 | "@types/jasminewd2": "~2.0.3",
36 | "codelyzer": "^5.0.0",
37 | "jasmine-core": "~3.4.0",
38 | "jasmine-spec-reporter": "~4.2.1",
39 | "karma": "~4.1.0",
40 | "karma-chrome-launcher": "~2.2.0",
41 | "karma-coverage-istanbul-reporter": "~2.0.1",
42 | "karma-jasmine": "~2.0.1",
43 | "karma-jasmine-html-reporter": "^1.4.0",
44 | "ng-packagr": "^5.1.0",
45 | "protractor": "~5.4.0",
46 | "ts-node": "~7.0.0",
47 | "tsickle": "^0.35.0",
48 | "tslint": "~5.15.0",
49 | "typescript": "~3.4.3"
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/projects/async-pipeline/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage-istanbul-reporter'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../../coverage/async-pipeline'),
20 | reports: ['html', 'lcovonly'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false,
30 | restartOnFileChange: true
31 | });
32 | };
33 |
--------------------------------------------------------------------------------
/projects/async-pipeline/ng-package.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3 | "dest": "../../dist/async-pipeline",
4 | "lib": {
5 | "entryFile": "src/public-api.ts"
6 | }
7 | }
--------------------------------------------------------------------------------
/projects/async-pipeline/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ngx-async-pipeline",
3 | "version": "0.0.2",
4 | "peerDependencies": {
5 | "@angular/common": "^8.0.0",
6 | "@angular/core": "^8.0.0"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/debounce-time/debounce-time.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { DebounceTimePipe } from './debounce-time.pipe';
4 |
5 | @NgModule({ declarations: [DebounceTimePipe], exports: [DebounceTimePipe] })
6 | export class DebounceTimeModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/debounce-time/debounce-time.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { debounceTime } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'debounceTime', pure: true })
6 | export class DebounceTimePipe implements PipeTransform {
7 |
8 | transform(stream: Observable, d: number = 0): Observable {
9 | return stream.pipe(
10 | debounceTime(d),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/debounce/debounce.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { DebouncePipe } from './debounce.pipe';
4 |
5 | @NgModule({ declarations: [DebouncePipe], exports: [DebouncePipe] })
6 | export class DebounceModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/debounce/debounce.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable, SubscribableOrPromise } from 'rxjs';
3 | import { debounce } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'debounce', pure: true })
6 | export class DebouncePipe implements PipeTransform {
7 |
8 | transform(stream: Observable, durationSelector: (value: T) => SubscribableOrPromise): Observable {
9 | return stream.pipe(
10 | debounce(durationSelector),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/delay/delay.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { DelayPipe } from './delay.pipe';
4 |
5 | @NgModule({ declarations: [DelayPipe], exports: [DelayPipe] })
6 | export class DelayModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/delay/delay.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { delay } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'delay', pure: true })
6 | export class DelayPipe implements PipeTransform {
7 |
8 | transform(stream: Observable, d: number | Date = 0): Observable {
9 | return stream.pipe(
10 | delay(d),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/distinct-until-changed/distinct-until-changed.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { DistinctUntilChangedPipe } from './distinct-until-changed.pipe';
4 |
5 | @NgModule({ declarations: [DistinctUntilChangedPipe], exports: [DistinctUntilChangedPipe] })
6 | export class DistinctUntilChangedModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/distinct-until-changed/distinct-until-changed.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { distinctUntilChanged } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'distinctUntilChanged', pure: true })
6 | export class DistinctUntilChangedPipe implements PipeTransform {
7 |
8 | transform(stream: Observable, compare?: (x: T, y: T) => boolean): Observable {
9 | return stream.pipe(
10 | distinctUntilChanged(compare),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/first/first.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { FirstPipe } from './first.pipe';
4 |
5 | @NgModule({ declarations: [FirstPipe], exports: [FirstPipe] })
6 | export class FirstModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/first/first.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { first } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'first', pure: true })
6 | export class FirstPipe implements PipeTransform {
7 |
8 | transform(stream: Observable): Observable {
9 | return stream.pipe(
10 | first(),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/get/get.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { GetPipe } from './get.pipe';
4 |
5 | @NgModule({ declarations: [GetPipe], exports: [GetPipe] })
6 | export class GetModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/get/get.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { map } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'get', pure: true })
6 | export class GetPipe implements PipeTransform {
7 |
8 | transform(stream: Observable, prop: string | number): Observable {
9 | return stream.pipe(
10 | map((value: T) => value[prop]),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/index.ts:
--------------------------------------------------------------------------------
1 | export * from './length/length.pipe';
2 | export * from './length/length.module';
3 | export * from './log/log.pipe';
4 | export * from './log/log.module';
5 | export * from './not/not.pipe';
6 | export * from './not/not.module';
7 | export * from './get/get.pipe';
8 | export * from './get/get.module';
9 | export * from './last/last.pipe';
10 | export * from './last/last.module';
11 | export * from './first/first.pipe';
12 | export * from './first/first.module';
13 | export * from './delay/delay.pipe';
14 | export * from './delay/delay.module';
15 | export * from './debounce-time/debounce-time.pipe';
16 | export * from './debounce-time/debounce-time.module';
17 | export * from './debounce/debounce.pipe';
18 | export * from './debounce/debounce.module';
19 | export * from './distinct-until-changed/distinct-until-changed.pipe';
20 | export * from './distinct-until-changed/distinct-until-changed.module';
21 | export * from './map-to/map-to.pipe';
22 | export * from './map-to/map-to.module';
23 | export * from './skip/skip.pipe';
24 | export * from './skip/skip.module';
25 | export * from './skip-last/skip-last.pipe';
26 | export * from './skip-last/skip-last.module';
27 | export * from './skip-until/skip-until.pipe';
28 | export * from './skip-until/skip-until.module';
29 | export * from './skip-while/skip-while.pipe';
30 | export * from './skip-while/skip-while.module';
31 | export * from './take/take.pipe';
32 | export * from './take/take.module';
33 | export * from './take-last/take-last.pipe';
34 | export * from './take-last/take-last.module';
35 | export * from './take-until/take-until.pipe';
36 | export * from './take-until/take-until.module';
37 | export * from './take-while/take-while.pipe';
38 | export * from './take-while/take-while.module';
39 | export * from './throttle-time/throttle-time.pipe';
40 | export * from './throttle-time/throttle-time.module';
41 | export * from './throttle/throttle.pipe';
42 | export * from './throttle/throttle.module';
43 | export * from './pairwise/pairwise.pipe';
44 | export * from './pairwise/pairwise.module';
45 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/last/last.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { LastPipe } from './last.pipe';
4 |
5 | @NgModule({ declarations: [LastPipe], exports: [LastPipe] })
6 | export class LastModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/last/last.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { last } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'last', pure: true })
6 | export class LastPipe implements PipeTransform {
7 |
8 | transform(stream: Observable): Observable {
9 | return stream.pipe(
10 | last(),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/length/length.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { LengthPipe } from './length.pipe';
4 |
5 | @NgModule({ declarations: [LengthPipe], exports: [LengthPipe] })
6 | export class LengthModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/length/length.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { map } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'length', pure: true })
6 | export class LengthPipe implements PipeTransform {
7 |
8 | transform(stream: Observable): Observable {
9 | return stream.pipe(
10 | map((values: T[]) => values.length),
11 | );
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/log/log.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { LogPipe } from './log.pipe';
4 |
5 | @NgModule({ declarations: [LogPipe], exports: [LogPipe] })
6 | export class LogModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/log/log.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { tap } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'log', pure: true })
6 | export class LogPipe implements PipeTransform {
7 |
8 | transform(stream: Observable): Observable {
9 | return stream.pipe(
10 | tap(console.log.bind(console)),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/map-to/map-to.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { MapToPipe } from './map-to.pipe';
4 |
5 | @NgModule({ declarations: [MapToPipe], exports: [MapToPipe] })
6 | export class MapToModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/map-to/map-to.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { mapTo } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'mapTo', pure: true })
6 | export class MapToPipe implements PipeTransform {
7 |
8 | transform(stream: Observable, value: R): Observable {
9 | return stream.pipe(
10 | mapTo(value),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/not/not.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { NotPipe } from './not.pipe';
4 |
5 | @NgModule({ declarations: [NotPipe], exports: [NotPipe] })
6 | export class NotModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/not/not.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { map } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'not', pure: true })
6 | export class NotPipe implements PipeTransform {
7 |
8 | transform(stream: Observable): Observable {
9 | return stream.pipe(
10 | map((value: boolean | number) => !value),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/pairwise/pairwise.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { PairwisePipe } from './pairwise.pipe';
4 |
5 | @NgModule({ declarations: [PairwisePipe], exports: [PairwisePipe] })
6 | export class PairwiseModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/pairwise/pairwise.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { pairwise } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'pairwise', pure: true })
6 | export class PairwisePipe implements PipeTransform {
7 |
8 | transform(stream: Observable): Observable<[T, T]> {
9 | return stream.pipe(
10 | pairwise(),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/skip-last/skip-last.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { SkipLastPipe } from './skip-last.pipe';
4 |
5 | @NgModule({ declarations: [SkipLastPipe], exports: [SkipLastPipe] })
6 | export class SkipLastModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/skip-last/skip-last.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { skipLast } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'skipLast', pure: true })
6 | export class SkipLastPipe implements PipeTransform {
7 |
8 | transform(stream: Observable, count: number = 0): Observable {
9 | return stream.pipe(
10 | skipLast(count),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/skip-until/skip-until.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { SkipUntilPipe } from './skip-until.pipe';
4 |
5 | @NgModule({ declarations: [SkipUntilPipe], exports: [SkipUntilPipe] })
6 | export class SkipUntilModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/skip-until/skip-until.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { skipUntil } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'skipUntil', pure: true })
6 | export class SkipUntilPipe implements PipeTransform {
7 |
8 | transform(stream: Observable, notifier: Observable): Observable {
9 | return stream.pipe(
10 | skipUntil(notifier),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/skip-while/skip-while.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { SkipWhilePipe } from './skip-while.pipe';
4 |
5 | @NgModule({ declarations: [SkipWhilePipe], exports: [SkipWhilePipe] })
6 | export class SkipWhileModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/skip-while/skip-while.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { skipWhile } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'skipWhile', pure: true })
6 | export class SkipWhilePipe implements PipeTransform {
7 |
8 | transform(stream: Observable, predicate: (value: T, index: number) => boolean): Observable {
9 | return stream.pipe(
10 | skipWhile(predicate),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/skip/skip.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { SkipPipe } from './skip.pipe';
4 |
5 | @NgModule({ declarations: [SkipPipe], exports: [SkipPipe] })
6 | export class SkipModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/skip/skip.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { skip } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'skip', pure: true })
6 | export class SkipPipe implements PipeTransform {
7 |
8 | transform(stream: Observable, count: number = 0): Observable {
9 | return stream.pipe(
10 | skip(count),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/take-last/take-last.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { TakeLastPipe } from './take-last.pipe';
4 |
5 | @NgModule({ declarations: [TakeLastPipe], exports: [TakeLastPipe] })
6 | export class TakeLastModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/take-last/take-last.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { takeLast } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'takeLast', pure: true })
6 | export class TakeLastPipe implements PipeTransform {
7 |
8 | transform(stream: Observable, count: number = 0): Observable {
9 | return stream.pipe(
10 | takeLast(count),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/take-until/take-until.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { TakeUntilPipe } from './take-until.pipe';
4 |
5 | @NgModule({ declarations: [TakeUntilPipe], exports: [TakeUntilPipe] })
6 | export class TakeUntilModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/take-until/take-until.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { takeUntil } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'takeUntil', pure: true })
6 | export class TakeUntilPipe implements PipeTransform {
7 |
8 | transform(stream: Observable, notifier: Observable): Observable {
9 | return stream.pipe(
10 | takeUntil(notifier),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/take-while/take-while.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { TakeWhilePipe } from './take-while.pipe';
4 |
5 | @NgModule({ declarations: [TakeWhilePipe], exports: [TakeWhilePipe] })
6 | export class TakeWhileModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/take-while/take-while.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { takeWhile } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'takeWhile', pure: true })
6 | export class TakeWhilePipe implements PipeTransform {
7 |
8 | transform(stream: Observable, predicate: (value: T, index: number) => boolean): Observable {
9 | return stream.pipe(
10 | takeWhile(predicate),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/take/take.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { TakePipe } from './take.pipe';
4 |
5 | @NgModule({ declarations: [TakePipe], exports: [TakePipe] })
6 | export class TakeModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/take/take.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { take } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'take', pure: true })
6 | export class TakePipe implements PipeTransform {
7 |
8 | transform(stream: Observable, count: number = 0): Observable {
9 | return stream.pipe(
10 | take(count),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/throttle-time/throttle-time.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { ThrottleTimePipe } from './throttle-time.pipe';
4 |
5 | @NgModule({ declarations: [ThrottleTimePipe], exports: [ThrottleTimePipe] })
6 | export class ThrottleTimeModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/throttle-time/throttle-time.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable } from 'rxjs';
3 | import { throttleTime } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'throttleTime', pure: true })
6 | export class ThrottleTimePipe implements PipeTransform {
7 |
8 | transform(stream: Observable, d: number = 0): Observable {
9 | return stream.pipe(
10 | throttleTime(d),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/throttle/throttle.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 |
3 | import { ThrottlePipe } from './throttle.pipe';
4 |
5 | @NgModule({ declarations: [ThrottlePipe], exports: [ThrottlePipe] })
6 | export class ThrottleModule {
7 | }
8 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/lib/throttle/throttle.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Observable, SubscribableOrPromise } from 'rxjs';
3 | import { throttle } from 'rxjs/operators';
4 |
5 | @Pipe({ name: 'throttle', pure: true })
6 | export class ThrottlePipe implements PipeTransform {
7 |
8 | transform(stream: Observable, durationSelector: (value: T) => SubscribableOrPromise): Observable {
9 | return stream.pipe(
10 | throttle(durationSelector),
11 | );
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/public-api.ts:
--------------------------------------------------------------------------------
1 | export * from './lib/index';
2 |
--------------------------------------------------------------------------------
/projects/async-pipeline/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/zone';
4 | import 'zone.js/dist/zone-testing';
5 | import { getTestBed } from '@angular/core/testing';
6 | import {
7 | BrowserDynamicTestingModule,
8 | platformBrowserDynamicTesting
9 | } from '@angular/platform-browser-dynamic/testing';
10 |
11 | declare const require: any;
12 |
13 | // First, initialize the Angular testing environment.
14 | getTestBed().initTestEnvironment(
15 | BrowserDynamicTestingModule,
16 | platformBrowserDynamicTesting()
17 | );
18 | // Then we find all the tests.
19 | const context = require.context('./', true, /\.spec\.ts$/);
20 | // And load the modules.
21 | context.keys().map(context);
22 |
--------------------------------------------------------------------------------
/projects/async-pipeline/tsconfig.lib.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/lib",
5 | "target": "es2015",
6 | "declaration": true,
7 | "inlineSources": true,
8 | "types": [],
9 | "lib": [
10 | "dom",
11 | "es2018"
12 | ]
13 | },
14 | "angularCompilerOptions": {
15 | "annotateForClosureCompiler": true,
16 | "skipTemplateCodegen": true,
17 | "strictMetadataEmit": true,
18 | "fullTemplateTypeCheck": true,
19 | "strictInjectionParameters": true,
20 | "enableResourceInlining": true
21 | },
22 | "exclude": [
23 | "src/test.ts",
24 | "**/*.spec.ts"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/projects/async-pipeline/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts"
12 | ],
13 | "include": [
14 | "**/*.spec.ts",
15 | "**/*.d.ts"
16 | ]
17 | }
18 |
--------------------------------------------------------------------------------
/projects/async-pipeline/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "lib",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "lib",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/projects/demo/browserslist:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # You can see what browsers were selected by your queries by running:
6 | # npx browserslist
7 |
8 | > 0.5%
9 | last 2 versions
10 | Firefox ESR
11 | not dead
12 | not IE 9-11 # For IE 9-11 support, remove 'not'.
--------------------------------------------------------------------------------
/projects/demo/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // @ts-check
2 | // Protractor configuration file, see link for more information
3 | // https://github.com/angular/protractor/blob/master/lib/config.ts
4 |
5 | const { SpecReporter } = require('jasmine-spec-reporter');
6 |
7 | /**
8 | * @type { import("protractor").Config }
9 | */
10 | exports.config = {
11 | allScriptsTimeout: 11000,
12 | specs: [
13 | './src/**/*.e2e-spec.ts'
14 | ],
15 | capabilities: {
16 | 'browserName': 'chrome'
17 | },
18 | directConnect: true,
19 | baseUrl: 'http://localhost:4200/',
20 | framework: 'jasmine',
21 | jasmineNodeOpts: {
22 | showColors: true,
23 | defaultTimeoutInterval: 30000,
24 | print: function() {}
25 | },
26 | onPrepare() {
27 | require('ts-node').register({
28 | project: require('path').join(__dirname, './tsconfig.json')
29 | });
30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
31 | }
32 | };
--------------------------------------------------------------------------------
/projects/demo/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 | import { browser, logging } from 'protractor';
3 |
4 | describe('workspace-project App', () => {
5 | let page: AppPage;
6 |
7 | beforeEach(() => {
8 | page = new AppPage();
9 | });
10 |
11 | it('should display welcome message', () => {
12 | page.navigateTo();
13 | expect(page.getTitleText()).toEqual('Welcome to demo!');
14 | });
15 |
16 | afterEach(async () => {
17 | // Assert that there are no errors emitted from the browser
18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19 | expect(logs).not.toContain(jasmine.objectContaining({
20 | level: logging.Level.SEVERE,
21 | } as logging.Entry));
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/projects/demo/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo() {
5 | return browser.get(browser.baseUrl) as Promise;
6 | }
7 |
8 | getTitleText() {
9 | return element(by.css('app-root h1')).getText() as Promise;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/projects/demo/e2e/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../../out-tsc/e2e",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/projects/demo/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage-istanbul-reporter'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../../coverage/demo'),
20 | reports: ['html', 'lcovonly', 'text-summary'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false,
30 | restartOnFileChange: true
31 | });
32 | };
33 |
--------------------------------------------------------------------------------
/projects/demo/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 | import { of } from 'rxjs';
3 |
4 | @Component({
5 | selector: 'app-root',
6 | template: `
7 | {{ title$ | skip:3 | length | not | async }}
8 | `,
9 | })
10 | export class AppComponent {
11 | title$ = of('demo');
12 | }
13 |
--------------------------------------------------------------------------------
/projects/demo/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { BrowserModule } from '@angular/platform-browser';
2 | import { NgModule } from '@angular/core';
3 |
4 | import { AppComponent } from './app.component';
5 | import { LengthModule, NotModule, SkipModule } from 'ngx-async-pipeline';
6 |
7 | @NgModule({
8 | declarations: [
9 | AppComponent
10 | ],
11 | imports: [
12 | BrowserModule,
13 | LengthModule,
14 | NotModule,
15 | SkipModule,
16 | ],
17 | providers: [],
18 | bootstrap: [AppComponent]
19 | })
20 | export class AppModule { }
21 |
--------------------------------------------------------------------------------
/projects/demo/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tibing/async-pipeline/fd6ec235b3ab1b254ea77f56b2e73bfc2f9e3f7e/projects/demo/src/assets/.gitkeep
--------------------------------------------------------------------------------
/projects/demo/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/projects/demo/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/projects/demo/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tibing/async-pipeline/fd6ec235b3ab1b254ea77f56b2e73bfc2f9e3f7e/projects/demo/src/favicon.ico
--------------------------------------------------------------------------------
/projects/demo/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Demo
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/projects/demo/src/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | if (environment.production) {
8 | enableProdMode();
9 | }
10 |
11 | platformBrowserDynamic().bootstrapModule(AppModule)
12 | .catch(err => console.error(err));
13 |
--------------------------------------------------------------------------------
/projects/demo/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/guide/browser-support
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
22 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
23 |
24 | /**
25 | * Web Animations `@angular/platform-browser/animations`
26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
28 | */
29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
30 |
31 | /**
32 | * By default, zone.js will patch all possible macroTask and DomEvents
33 | * user can disable parts of macroTask/DomEvents patch by setting following flags
34 | * because those flags need to be set before `zone.js` being loaded, and webpack
35 | * will put import in the top of bundle, so user need to create a separate file
36 | * in this directory (for example: zone-flags.ts), and put the following flags
37 | * into that file, and then add the following code before importing zone.js.
38 | * import './zone-flags.ts';
39 | *
40 | * The flags allowed in zone-flags.ts are listed here.
41 | *
42 | * The following flags will work for all browsers.
43 | *
44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
47 | *
48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
50 | *
51 | * (window as any).__Zone_enable_cross_context_check = true;
52 | *
53 | */
54 |
55 | /***************************************************************************************************
56 | * Zone JS is required by default for Angular itself.
57 | */
58 | import 'zone.js/dist/zone'; // Included with Angular CLI.
59 |
60 |
61 | /***************************************************************************************************
62 | * APPLICATION IMPORTS
63 | */
64 |
--------------------------------------------------------------------------------
/projects/demo/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/projects/demo/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: any;
11 |
12 | // First, initialize the Angular testing environment.
13 | getTestBed().initTestEnvironment(
14 | BrowserDynamicTestingModule,
15 | platformBrowserDynamicTesting()
16 | );
17 | // Then we find all the tests.
18 | const context = require.context('./', true, /\.spec\.ts$/);
19 | // And load the modules.
20 | context.keys().map(context);
21 |
--------------------------------------------------------------------------------
/projects/demo/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/app",
5 | "types": [],
6 | "paths": {
7 | "ngx-async-pipeline": [
8 | "dist/async-pipeline"
9 | ]
10 | }
11 | },
12 | "include": [
13 | "src/**/*.ts"
14 | ],
15 | "exclude": [
16 | "src/test.ts",
17 | "src/**/*.spec.ts"
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/projects/demo/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts",
12 | "src/polyfills.ts"
13 | ],
14 | "include": [
15 | "src/**/*.spec.ts",
16 | "src/**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/projects/demo/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "outDir": "./dist/out-tsc",
6 | "sourceMap": true,
7 | "declaration": false,
8 | "module": "esnext",
9 | "moduleResolution": "node",
10 | "emitDecoratorMetadata": true,
11 | "experimentalDecorators": true,
12 | "importHelpers": true,
13 | "target": "es2015",
14 | "typeRoots": [
15 | "node_modules/@types"
16 | ],
17 | "lib": [
18 | "es2018",
19 | "dom"
20 | ]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "tslint:recommended",
3 | "rules": {
4 | "array-type": false,
5 | "arrow-parens": false,
6 | "deprecation": {
7 | "severity": "warn"
8 | },
9 | "component-class-suffix": true,
10 | "contextual-lifecycle": true,
11 | "directive-class-suffix": true,
12 | "directive-selector": [
13 | true,
14 | "attribute",
15 | "app",
16 | "camelCase"
17 | ],
18 | "component-selector": [
19 | true,
20 | "element",
21 | "app",
22 | "kebab-case"
23 | ],
24 | "import-blacklist": [
25 | true,
26 | "rxjs/Rx"
27 | ],
28 | "interface-name": false,
29 | "max-classes-per-file": false,
30 | "max-line-length": [
31 | true,
32 | 140
33 | ],
34 | "member-access": false,
35 | "member-ordering": [
36 | true,
37 | {
38 | "order": [
39 | "static-field",
40 | "instance-field",
41 | "static-method",
42 | "instance-method"
43 | ]
44 | }
45 | ],
46 | "no-consecutive-blank-lines": false,
47 | "no-console": [
48 | true,
49 | "debug",
50 | "info",
51 | "time",
52 | "timeEnd",
53 | "trace"
54 | ],
55 | "no-empty": false,
56 | "no-inferrable-types": [
57 | true,
58 | "ignore-params"
59 | ],
60 | "no-non-null-assertion": true,
61 | "no-redundant-jsdoc": true,
62 | "no-switch-case-fall-through": true,
63 | "no-use-before-declare": true,
64 | "no-var-requires": false,
65 | "object-literal-key-quotes": [
66 | true,
67 | "as-needed"
68 | ],
69 | "object-literal-sort-keys": false,
70 | "ordered-imports": false,
71 | "quotemark": [
72 | true,
73 | "single"
74 | ],
75 | "trailing-comma": false,
76 | "no-conflicting-lifecycle": true,
77 | "no-host-metadata-property": true,
78 | "no-input-rename": true,
79 | "no-inputs-metadata-property": true,
80 | "no-output-native": true,
81 | "no-output-on-prefix": true,
82 | "no-output-rename": true,
83 | "no-outputs-metadata-property": true,
84 | "template-banana-in-box": true,
85 | "template-no-negated-async": true,
86 | "use-lifecycle-interface": true,
87 | "use-pipe-transform-interface": true
88 | },
89 | "rulesDirectory": [
90 | "codelyzer"
91 | ]
92 | }
--------------------------------------------------------------------------------