File tree Expand file tree Collapse file tree 4 files changed +2411
-70
lines changed Expand file tree Collapse file tree 4 files changed +2411
-70
lines changed Original file line number Diff line number Diff line change 1
1
# Parallel.js
2
2
3
+ [ ![ Build Status] ( https://travis-ci.org/parallel-js/parallel.js.svg?branch=master )] ( https://travis-ci.org/parallel-js/parallel.js )
4
+
5
+ ## Idea
6
+
7
+ ``` js
8
+ import { Jobs , ParallelArray } from ' paralleljs' ;
9
+
10
+ // Execute multiple jobs in parallel and asynchrnously
11
+ const jobs = new Jobs ();
12
+ const [job1 , job2 , job3 ] = await jobs .all ([
13
+ () => fibonacci (1 ),
14
+ gaussianSumm,
15
+ foobar
16
+ ]);
17
+ console .log (job1, job2, job3);
18
+
19
+ // An array with all methods parallelized
20
+ const array = new ParallelArray ([1 , 2 , 3 ]);
21
+ array .push (1 );
22
+ array .map (e => e + 1 );
23
+ array .filter (e => !! e);
24
+ ```
25
+
26
+ ## Local Development
27
+
28
+ ``` bash
29
+ git clone https://github.com/parallel-js/parallel.js
30
+ cd parallel.js
31
+ yarn
32
+ yarn test
33
+ ```
34
+
3
35
## Contributors
4
36
5
37
Parallel.js is made up of four contributors:
6
38
7
- [ Adam Savitzky (Adam)] ( https://github.com/adambom )
8
- [ Mathias Rangel Wulff (Mathias)] ( https://github.com/mathiasrw )
9
- [ Amila Welihinda (amilajack)] ( https://github.com/amilajack )
10
- [ MaXwell Falstein (MaX)] ( https://github.com/MaXwellFalstein )
39
+ * [ Adam Savitzky (Adam)] ( https://github.com/adambom )
40
+ * [ Mathias Rangel Wulff (Mathias)] ( https://github.com/mathiasrw )
41
+ * [ Amila Welihinda (amilajack)] ( https://github.com/amilajack )
42
+ * [ MaXwell Falstein (MaX)] ( https://github.com/MaXwellFalstein )
Original file line number Diff line number Diff line change 39
39
"babel-core" : " ^7.0.0-0" ,
40
40
"babel-jest" : " ^23.6.0" ,
41
41
"eslint" : " ^5.9.0" ,
42
- "eslint-config-bliss" : " ^3.1.1"
42
+ "eslint-config-bliss" : " ^3.1.1" ,
43
+ "jest" : " ^23.6.0"
43
44
},
44
45
"eslintConfig" : {
45
46
"extends" : [
Original file line number Diff line number Diff line change 1
- const Parallel = require ( '..' ) ;
1
+ const { ParallelArray, Jobs } = require ( '..' ) ;
2
+
3
+ const fibonacci = ( ) => { } ;
4
+ const gaussianSumm = ( ) => { } ;
5
+ const foobar = ( ) => { } ;
2
6
3
7
describe ( 'basic' , ( ) => {
4
8
it ( 'should construct object' , ( ) => {
5
- new Parallel ( [ ] ) ;
6
- new Parallel ( ) ;
9
+ new ParallelArray ( [ ] ) ;
10
+ new ParallelArray ( ) ;
7
11
} ) ;
8
12
9
13
it ( 'should take expected arguments' , ( ) => {
10
- const array = new Parallel ( ) ;
14
+ const array = new ParallelArray ( ) ;
11
15
array . push ( 1 ) ;
12
16
array . push ( 2 ) ;
13
17
} ) ;
14
18
15
19
it ( 'should call parallel methods' , ( ) => {
16
- const array = new Parallel ( ) ;
20
+ const array = new ParallelArray ( ) ;
17
21
array . map ( e => e + 1 ) ;
18
22
array . filter ( e => ! ! e ) ;
19
23
} ) ;
24
+
25
+ it ( 'should call execute jobs in parallel' , async ( ) => {
26
+ const jobs = new Jobs ( ) ;
27
+ const [ job1 , job2 , job3 ] = await jobs . all ( [
28
+ ( ) => fibonacci ( 1 ) ,
29
+ gaussianSumm ,
30
+ foobar
31
+ ] ) ;
32
+ console . log ( job1 , job2 , job3 ) ;
33
+ } ) ;
20
34
} ) ;
You can’t perform that action at this time.
0 commit comments