Skip to content

Commit

Permalink
chore: make conditional more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
nebrelbug committed May 29, 2023
1 parent e30a863 commit ea37ebb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 252 deletions.
8 changes: 5 additions & 3 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ export class Eta {
template: string | TemplateFunction, // template string or template function
options?: { async: boolean }
): void {
let templates = options && options.async ? this.templatesAsync : this.templatesSync;

if (typeof template === "string") {
const templates = options && options.async ? this.templatesAsync : this.templatesSync;

templates.define(name, this.compile(template, options));
} else {
if (template.constructor.name === "AsyncFunction") {
let templates = this.templatesSync;

if (template.constructor.name === "AsyncFunction" || (options && options.async)) {
templates = this.templatesAsync;
}

Expand Down
147 changes: 0 additions & 147 deletions test/file-handlers.spec.ts

This file was deleted.

66 changes: 0 additions & 66 deletions test/file-helpers.spec.ts

This file was deleted.

36 changes: 0 additions & 36 deletions test/helpers.spec.ts

This file was deleted.

0 comments on commit ea37ebb

Please sign in to comment.