Platform
Resources
Pricing
Sign in
Get started
Sébastien Pierre
Using Observable for software engineering, programming language and user interface research.
Workspace
Fork
Public
By
Sébastien Pierre
Edited
Dec 27, 2022
Insert cell
Insert cell
Insert cell
{
const
name
=
slot
(
"name"
)
;
const
context
=
new
RenderingContext
(
)
;
const
template
=
new
DataTemplate
(
{
name
}
)
;
const
value
=
{
name
:
"John Smith"
}
;
return
context
.
update
(
value
,
template
)
.
get
(
name
)
;
}
Insert cell
Insert cell
{
const
name
=
slot
(
"name"
)
;
const
t
=
new
TemplateEffector
(
{
name
}
,
H
.
div
(
"Hello, my name is: "
,
name
)
)
;
assert
(
t
.
inputs
.
extract
(
{
name
:
"Danger"
}
)
.
get
(
name
)
==
"Danger"
,
"Input extraction failed"
)
;
return
t
.
apply
(
{
name
:
"Danger"
}
)
;
}
Insert cell
Insert cell
equals
=
(
value
,
expected
,
...
context
)
=>
(
assert
(
value
==
expected
,
"Value is different from what is expected"
,
{
value
,
expected
}
,
...
context
)
,
value
)
Insert cell
assert
=
(
assertion
,
message
,
...
context
)
=>
assertion
?
assertion
:
(
onError
(
"Assertion failed"
,
assertion
,
...
context
)
,
assertion
)
Insert cell
import
{
H
,
$
,
render
,
slots
,
slot
,
TemplateEffector
,
RenderingContext
,
DataTemplate
,
onError
}
from
"40edfc310b5ce694"
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
equals
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
assert
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML