Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 31e0975

Browse files
authored
Add seq alias (#18)
1 parent 97a0653 commit 31e0975

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

composer.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ class Composer {
8686
return Array.prototype.map.call(arguments, x => this.task(x), this).reduce(chain)
8787
}
8888

89+
seq() {
90+
return this.sequence(...arguments)
91+
}
92+
8993
if(test, consequent, alternate) {
9094
if (test == null || consequent == null) throw new ComposerError('Missing arguments in composition', arguments)
9195
const id = {}

test/test.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ describe('composer', function () {
117117
} catch (error) {
118118
assert.equal(error, 'Error: Invalid composition argument')
119119
}
120-
})
120+
})
121121

122122
it('42 must throw', function () {
123123
try {
@@ -126,7 +126,7 @@ describe('composer', function () {
126126
} catch (error) {
127127
assert.equal(error, 'Error: Invalid composition argument')
128128
}
129-
})
129+
})
130130

131131
it('{ foo: \'bar\' } must throw', function () {
132132
try {
@@ -161,6 +161,11 @@ describe('composer', function () {
161161
return invoke(composer.sequence(composer.sequence('TripleAndIncrement', 'DivideByTwo'), 'DivideByTwo'), { n: 5 })
162162
.then(activation => assert.deepEqual(activation.response.result, { n: 4 }))
163163
})
164+
165+
it('seq', function () {
166+
return invoke(composer.seq('TripleAndIncrement', 'DivideByTwo', 'DivideByTwo'), { n: 5 })
167+
.then(activation => assert.deepEqual(activation.response.result, { n: 4 }))
168+
})
164169
})
165170

166171
describe('if', function () {

0 commit comments

Comments
 (0)