Constructor
new JobLoader(opts, jsonopt)
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
opts |
object |
An object, typically the command line options. Properties
|
|||||||||
json |
string | Buffer |
<optional> |
A string or buffer containing JSON data. Typically, this is read from STDIN when DART is run from the command line. |
- Source:
Methods
loadJob() → {Job}
Loads a job. If json is not empty, this tries to parse the data as Job JSON or as JobParams JSON. Otherwise if opts.job is a UUID, it tries to load the job with that UUID from the Jobs database. If opts.job is any string other than a UUID, this tries to read the file at the path specified by opts.job and parse it as Job JSON.
This will throw an error if it encounters unparsable JSON, is asked to read a non-existent or unopenable file, or cannot find a Job with the specified UUID.
- Source:
looksLikeJob(data) → {boolean}
Returns true if the generic JavaScript object in param data looks like it may be a Job object.
Parameters:
Name | Type | Description |
---|---|---|
data |
object |
Any generic JavaScript object. |
- Source:
looksLikeJobParams(data) → {boolean}
Returns true if the generic JavaScript object in param data looks like it may be a JobParams object.
Parameters:
Name | Type | Description |
---|---|---|
data |
object |
Any generic JavaScript object. |
- Source: