
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@rickcole/json-to-html
Advanced tools
a small tool convert json to html template
npm i @rickcole/json-to-html
convert json object, array, string into html template:
import jsonToHtml from '@rickcole/json-to-html';
let schema = {
tag: 'div',
children: [
{
tag: 'div',
class: 'inner-div',
children: [
{
tag: 'p',
children: 'this is a paragraph'
},
{
tag: 'h1',
children: 'this is a header'
},
]
},
'a simple string',
{
tag: 'span',
children: 'this is a span'
}
]
};
jsonToHtml(schema);
result :
<div>
<div class="inner-div">
<p>this is a paragraph</p>
<h1>this is a header</h1>
</div>
a simple string
<span>this is a span</span>
</div>
you can use config to change the output:
jsonToHtml(schema, {
indent: 4,
wrap: true,
raw: false
});
name | type | default value | description |
---|---|---|---|
indent | number | 4 | indent |
wrap | boolean | true | whether wrap the content or not |
raw | boolean | false | escacpe the content.(e.g.,< to < ) |
tagKey | string | 'tag' | you can change your tag key by setting this |
const schema = {
rick: 'div',
children: [
{
rick: 'span',
children: [
{
rick: 'span',
children: 'a'
}
]
},
]
};
jsonToHtml(schema, {
tagKey: 'rick'
});
<component tag="sometag"></component>
or <component children="somechildren"></component>
?{
tag: 'component',
class: 'a-div',
extraAttrs: { // set this key only if necessary
tag: 'sometag',
children: 'somechildren'
},
}
// result
<component class="a-div" tag="sometag" children="somechildren"></component>
FAQs
a small tool convert json to html template
We found that @rickcole/json-to-html demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.