
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
@times-components/markup-forest
Advanced tools
The exported renderTree
and renderTrees
methods take AST data as the first
argument, and a renderer object as the second argument. Each renderer should
return an object with an element
property (the component to be rendered), and
an optional shouldRenderChildren
boolean that can ensure the renderer does not
render that node's children.
renderTrees
is used typically because an AST is a list of trees, however
renderTree
can be used if it's known that it is a single tree being traversed.
For most usages you will want to use the markup package which provides renderers out of the box for all simple elements. These functions will only render elements which have a renderer with no fallback.
import { renderTrees } from "@times-components/markup-forest";
import coreRenderers from "@times-components/markup";
const trees = [
{
"name": "paragraph",
"attributes": {},
"children": [
{
"name": "text",
"attributes": {
"value": "I am one paragraph"
}
"children": []
}
]
},
{
"name": "paragraph",
"attributes": {},
"children": [
{
"name": "text",
"attributes": {
"value": "I am another paragraph"
}
"children": []
}
]
}
];
// element is now
// <View>
// <Text key="1">I am one paragraph</Text>
// <Text key="2">I am another paragraph</Text>
// </View>
const element = <View>{renderTrees(trees, coreRenderers)}<View>
import { renderTree } from "@times-components/markup-forest";
import coreRenderers from "@times-components/markup";
const tree = {
"name": "bold",
"attributes": {},
"children": [
{
"name": "text",
"attributes": {
"value": "I am bold"
}
"children": []
}
]
}
// element is now
// <Text style={{fontWeight: bold}}>
// I am bold
// </Text>
const element = renderTree(tree, coreRenderers)
Please read CONTRIBUTING.md before contributing to this package
Please see our main README.md to get the project running locally
The code can be formatted and linted in accordance with the agreed standards.
yarn fmt
yarn lint
Testing can be done on each platform individually
yarn test
FAQs
Utility functions for traversing The Times' AST
The npm package @times-components/markup-forest receives a total of 292 weekly downloads. As such, @times-components/markup-forest popularity was classified as not popular.
We found that @times-components/markup-forest demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.