Skip to content

Commit

Permalink
implements #1
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrodger committed May 18, 2020
1 parent e7434d6 commit 8a1484e
Show file tree
Hide file tree
Showing 6 changed files with 581 additions and 573 deletions.
12 changes: 6 additions & 6 deletions ordu.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ interface Events {
}
declare type OrduEmitter = StrictEventEmitter<EventEmitter, Events>;
interface OrduIF {
add(td: TaskDef): void;
add(td: TaskDef[]): void;
add(te: TaskExec): void;
add(te: TaskExec, td: TaskDef): void;
add(te: TaskExec[]): void;
add(td: TaskDef): OrduIF;
add(td: TaskDef[]): OrduIF;
add(te: TaskExec): OrduIF;
add(te: TaskExec, td: TaskDef): OrduIF;
add(te: TaskExec[]): OrduIF;
tasks(): Task[];
task: {
[name: string]: Task;
Expand Down Expand Up @@ -107,7 +107,7 @@ declare class Ordu extends Ordu_base implements OrduIF {
operators(): {
[op: string]: Operator;
};
add(first: any, second?: any): void;
add(first: any, second?: any): Ordu;
private _add_task;
exec(ctx: any, data: any, opts: any): Promise<ExecResult>;
tasks(): Task[];
Expand Down
1 change: 1 addition & 0 deletions ordu.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ordu.js.map

Large diffs are not rendered by default.

28 changes: 15 additions & 13 deletions ordu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ interface Events {
type OrduEmitter = StrictEventEmitter<EventEmitter, Events>

interface OrduIF {
add(td: TaskDef): void
add(td: TaskDef[]): void
add(td: TaskDef): OrduIF
add(td: TaskDef[]): OrduIF

add(te: TaskExec): void
add(te: TaskExec, td: TaskDef): void
add(te: TaskExec[]): void
add(te: TaskExec): OrduIF
add(te: TaskExec, td: TaskDef): OrduIF
add(te: TaskExec[]): OrduIF

tasks(): Task[]

Expand Down Expand Up @@ -81,7 +81,7 @@ class Task {
this.name = taskdef.name || 'task' + Task.count++
this.before = taskdef.before
this.after = taskdef.after
this.exec = taskdef.exec || ((_: TaskSpec) => {})
this.exec = taskdef.exec || ((_: TaskSpec) => { })
this.if = taskdef.if || void 0
this.active = null == taskdef.active ? true : taskdef.active
this.meta = Object.assign(taskdef.meta || {}, {
Expand Down Expand Up @@ -151,7 +151,7 @@ type ExecResult = {

type Operator = (r: TaskResult, ctx: any, data: object) => Operate

class Ordu extends (EventEmitter as { new (): OrduEmitter }) implements OrduIF {
class Ordu extends (EventEmitter as { new(): OrduEmitter }) implements OrduIF {
private _opts: any

private _tasks: Task[]
Expand Down Expand Up @@ -200,7 +200,7 @@ class Ordu extends (EventEmitter as { new (): OrduEmitter }) implements OrduIF {
return this._operator_map
}

add(first: any, second?: any): void {
add(first: any, second?: any): Ordu {
if ('function' == typeof first) {
second = second || {}
let t = second
Expand All @@ -218,6 +218,8 @@ class Ordu extends (EventEmitter as { new (): OrduEmitter }) implements OrduIF {
} else {
this._add_task(first)
}

return this
}

private _add_task(td: TaskDef): void {
Expand Down Expand Up @@ -387,9 +389,9 @@ function make_callpoint(err: Error) {
return null == err
? []
: (err.stack || '')
.split(/\n/)
.slice(4)
.map((line) => line.substring(4))
.split(/\n/)
.slice(4)
.map((line) => line.substring(4))
}
/* $lab:coverage:on$ */

Expand Down Expand Up @@ -471,13 +473,13 @@ function LegacyOrdu(opts?: any): any {
}

function api_tasknames() {
return tasks.map(function (v) {
return tasks.map(function(v) {
return v.name
})
}

function api_taskdetails() {
return tasks.map(function (v) {
return tasks.map(function(v) {
return v.name + ':{tags:' + v.tags + '}'
})
}
Expand Down

0 comments on commit 8a1484e

Please sign in to comment.