Skip to content

Commit

Permalink
feat(hiccup): add auto deref() support
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Mar 14, 2018
1 parent 2351240 commit 0d2c16f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/hiccup/src/serialize.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { implementsFunction } from "@thi.ng/checks/implements-function";
import { isPlainObject } from "@thi.ng/checks/is-plain-object";
import { isFunction } from "@thi.ng/checks/is-function";
import { isString } from "@thi.ng/checks/is-string";
Expand Down Expand Up @@ -132,6 +133,9 @@ const _serialize = (tree: any, esc: boolean) => {
if (isFunction(tree)) {
return _serialize(tree(), esc);
}
if (implementsFunction(tree, "deref")) {
return _serialize(tree.deref(), esc);
}
if (iter(tree)) {
return _serializeIter(tree, esc);
}
Expand Down

0 comments on commit 0d2c16f

Please sign in to comment.