Skip to content

Commit 528413c

Browse files
authored
Add the when() function to all action types. (#1119)
* Add the when() function to all action types. * bump version
1 parent 74d1743 commit 528413c

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

core/assertion.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,16 @@ export class AssertionContext implements ICommonContext {
209209
this.assertion.dependencies(name);
210210
return "";
211211
}
212+
212213
public tags(name: string | string[]) {
213214
this.assertion.tags(name);
214215
return "";
215216
}
216217

218+
public when(cond: boolean, trueCase: string, falseCase: string = "") {
219+
return cond ? trueCase : falseCase;
220+
}
221+
217222
public apply<T>(value: AContextable<T>): T {
218223
if (typeof value === "function") {
219224
return (value as any)(this);

core/operation.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,10 @@ export class OperationContext implements ICommonContext {
252252
return "";
253253
}
254254

255+
public when(cond: boolean, trueCase: string, falseCase: string = "") {
256+
return cond ? trueCase : falseCase;
257+
}
258+
255259
public apply<T>(value: Contextable<ICommonContext, T>): T {
256260
if (typeof value === "function") {
257261
return (value as any)(this);

version.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# NOTE: If you change the format of this line, you must change the bash command
22
# in /scripts/publish to extract the version string correctly.
3-
DF_VERSION = "1.16.3"
3+
DF_VERSION = "1.16.4"

0 commit comments

Comments
 (0)