-
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hiccup): add support for dynamic user context values
- add derefContext() helper to auto-deref any IDeref vals - update serialize()
- Loading branch information
1 parent
46bf1a7
commit a947873
Showing
3 changed files
with
22 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { implementsFunction } from "@thi.ng/checks/implements-function"; | ||
|
||
export const derefContext = | ||
(ctx: any) => { | ||
if (ctx == null) return ctx; | ||
const res = {}; | ||
for (let k in ctx) { | ||
const v = ctx[k]; | ||
res[k] = implementsFunction(v, "deref") ? | ||
v.deref() : | ||
v; | ||
} | ||
return res; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from "./api"; | ||
export * from "./css"; | ||
export * from "./deref"; | ||
export * from "./escape"; | ||
export * from "./serialize"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters