File tree Expand file tree Collapse file tree 1 file changed +21
-19
lines changed Expand file tree Collapse file tree 1 file changed +21
-19
lines changed Original file line number Diff line number Diff line change 2
2
3
3
const Promise = require ( 'bluebird' ) ;
4
4
5
- function Deployer ( ) {
6
- this . store = { } ;
7
- }
5
+ class Deployer {
6
+ constructor ( ) {
7
+ this . store = { } ;
8
+ }
8
9
9
- Deployer . prototype . list = function ( ) {
10
- return this . store ;
11
- } ;
10
+ list ( ) {
11
+ return this . store ;
12
+ }
12
13
13
- Deployer . prototype . get = function ( name ) {
14
- return this . store [ name ] ;
15
- } ;
14
+ get ( name ) {
15
+ return this . store [ name ] ;
16
+ }
16
17
17
- Deployer . prototype . register = function ( name , fn ) {
18
- if ( ! name ) throw new TypeError ( 'name is required' ) ;
19
- if ( typeof fn !== 'function' ) throw new TypeError ( 'fn must be a function' ) ;
18
+ register ( name , fn ) {
19
+ if ( ! name ) throw new TypeError ( 'name is required' ) ;
20
+ if ( typeof fn !== 'function' ) throw new TypeError ( 'fn must be a function' ) ;
20
21
21
- if ( fn . length > 1 ) {
22
- fn = Promise . promisify ( fn ) ;
23
- } else {
24
- fn = Promise . method ( fn ) ;
25
- }
22
+ if ( fn . length > 1 ) {
23
+ fn = Promise . promisify ( fn ) ;
24
+ } else {
25
+ fn = Promise . method ( fn ) ;
26
+ }
26
27
27
- this . store [ name ] = fn ;
28
- } ;
28
+ this . store [ name ] = fn ;
29
+ }
30
+ }
29
31
30
32
module . exports = Deployer ;
You can’t perform that action at this time.
0 commit comments