Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
astro-wt
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
769b1bb0
authored
2024-11-11 15:46:21 -0600
by
Adam Heath
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Add a function creator that can be used to force-set attributes during
the adjustment phase of Replace.
1 parent
77ef5056
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
lib/astro.ts
lib/astro.ts
View file @
769b1bb
...
...
@@ -9,3 +9,10 @@ export { Children, Custom, Match, Node, Replace }
import
type
{
NodeType
}
from
'ultrahtml'
type
SlotHandler
=
(
string
,
NodeType
)
=>
Promise
<
Any
>
type
Replacements
=
Record
<
string
,
string
>
export
const
createForceSetAttributes
=
(
overrideAttributes
)
=>
(
node
)
=>
{
if
(
!
overrideAttributes
)
return
node
const
{
attributes
}
=
node
if
(
!
attributes
)
return
node
return
{...
node
,
attributes
:
{...
attributes
,
...
overrideAttributes
}}
}
...
...
Please
register
or
sign in
to post a comment