@@ -7,7 +7,7 @@ const validate = require('aproba')
7
7
const cmd = module . exports = { }
8
8
9
9
cmd . create = ( entity , opts = { description : undefined } ) => {
10
- return pwrap ( opts , ( ) => {
10
+ return Promise . resolve ( ) . then ( ( ) => {
11
11
const { scope, team } = splitEntity ( entity )
12
12
validate ( 'SSO' , [ scope , team , opts ] )
13
13
const uri = `/-/org/${ eu ( scope ) } /team`
@@ -21,7 +21,7 @@ cmd.create = (entity, opts = { description: undefined }) => {
21
21
}
22
22
23
23
cmd . destroy = ( entity , opts = { } ) => {
24
- return pwrap ( opts , ( ) => {
24
+ return Promise . resolve ( ) . then ( ( ) => {
25
25
const { scope, team } = splitEntity ( entity )
26
26
validate ( 'SSO' , [ scope , team , opts ] )
27
27
const uri = `/-/team/${ eu ( scope ) } /${ eu ( team ) } `
@@ -34,7 +34,7 @@ cmd.destroy = (entity, opts = {}) => {
34
34
}
35
35
36
36
cmd . add = ( user , entity , opts = { } ) => {
37
- return pwrap ( opts , ( ) => {
37
+ return Promise . resolve ( ) . then ( ( ) => {
38
38
const { scope, team } = splitEntity ( entity )
39
39
validate ( 'SSO' , [ scope , team , opts ] )
40
40
const uri = `/-/team/${ eu ( scope ) } /${ eu ( team ) } /user`
@@ -48,7 +48,7 @@ cmd.add = (user, entity, opts = {}) => {
48
48
}
49
49
50
50
cmd . rm = ( user , entity , opts = { } ) => {
51
- return pwrap ( opts , ( ) => {
51
+ return Promise . resolve ( ) . then ( ( ) => {
52
52
const { scope, team } = splitEntity ( entity )
53
53
validate ( 'SSO' , [ scope , team , opts ] )
54
54
const uri = `/-/team/${ eu ( scope ) } /${ eu ( team ) } /user`
@@ -62,7 +62,7 @@ cmd.rm = (user, entity, opts = {}) => {
62
62
}
63
63
64
64
cmd . lsTeams = ( scope , opts = { } ) => {
65
- return pwrap ( opts , ( ) => {
65
+ return Promise . resolve ( ) . then ( ( ) => {
66
66
return cmd . lsTeams . stream ( scope , { ...opts } ) . collect ( )
67
67
} )
68
68
}
@@ -76,7 +76,7 @@ cmd.lsTeams.stream = (scope, opts = {}) => {
76
76
}
77
77
78
78
cmd . lsUsers = ( entity , opts = { } ) => {
79
- return pwrap ( opts , ( ) => {
79
+ return Promise . resolve ( ) . then ( ( ) => {
80
80
return cmd . lsUsers . stream ( entity , { ...opts } ) . collect ( )
81
81
} )
82
82
}
@@ -98,9 +98,3 @@ function splitEntity (entity = '') {
98
98
const [ , scope , team ] = entity . match ( / ^ @ ? ( [ ^ : ] + ) : ( .* ) $ / ) || [ ]
99
99
return { scope, team }
100
100
}
101
-
102
- function pwrap ( opts , fn ) {
103
- return new Promise ( ( resolve , reject ) => {
104
- fn ( ) . then ( resolve , reject )
105
- } )
106
- }
0 commit comments