Skip to content

Commit

Permalink
+
Browse files Browse the repository at this point in the history
  • Loading branch information
lifeart committed Jan 29, 2024
1 parent f1896b8 commit 186048b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
25 changes: 8 additions & 17 deletions pnpm-lock.yaml

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

19 changes: 19 additions & 0 deletions src/utils/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,25 @@ if (!import.meta.env.SSR) {
};
}
}

export const $_maybeHelper = (value: any, _hash: Record<string, unknown>) => {
// helper manager
if (isPrimitive(value)) {
return value;
}
const hash = $_args(_hash, false);
if (value.prototype && value.prototype.compute) {
const helper = new value();
return (...args: any[]) => {
return helper.compute.call(helper, args, hash);
};
}

return (...params: any[]) => {
return value(...params, hash);
}
};

function component(
comp: ComponentReturnType | Component,
args: Record<string, unknown>,
Expand Down

0 comments on commit 186048b

Please sign in to comment.