Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code formatting CI step #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install
- run: npm run check-format
build:
runs-on: ubuntu-latest
Expand Down
12 changes: 3 additions & 9 deletions src/api/plugin-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,25 +358,19 @@ export class DataviewApi {
* execution via `result.successful` and obtain `result.value` or `result.error` resultingly. If
* you'd rather this method throw on an error, use `dv.tryEvaluate`.
*/
public evaluate(
expression: string,
context?: DataObject,
originFile?: string): Result<Literal, string> {
public evaluate(expression: string, context?: DataObject, originFile?: string): Result<Literal, string> {
let field = EXPRESSION.field.parse(expression);
if (!field.status) return Result.failure(`Failed to parse expression "${expression}"`);

let evaluationContext = originFile
? new Context(defaultLinkHandler(this.index, originFile), this.settings)
: this.evaluationContext
: this.evaluationContext;

return evaluationContext.evaluate(field.value, context);
}

/** Error-throwing version of `dv.evaluate`. */
public tryEvaluate(
expression: string,
context?: DataObject,
originFile?: string): Literal {
public tryEvaluate(expression: string, context?: DataObject, originFile?: string): Literal {
return this.evaluate(expression, context, originFile).orElseThrow();
}

Expand Down
Loading