
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Better templating with LinkedIn's dust fork.
Dustin extends dust with some missing functionality like cache control and formatting option for white space preservation.
It also provides a convenient express engine (dust.__express
).
This package also includes dustjs-helpers
alongside some useful helpers.
npm i dustin --save
var dustin = require("dustin")
var dust = dustin({
cache: true,
views: "/",
helpers: "helpers/*.js",
whiteSpace: true
})
If false, every dust.render()
will purge the cache.
It is especially useful for development, when changes to a template should be
reflected in the browser on reload.
Partials will resolve to this folder. It helps so you don't have to write full template paths all the time.
A glob pattern for user helpers to extend the dust.helpers
object.
A helper should export a function with one or two arguments:
module.exports = function( helpers, dust ){
helpers.something = function(chunk, context, bodies, params){}
}
An express engine.
Hook it to express like this:
var dustin = require("dustin")
var engine = dustin({
cache: false,
views: "app/views",
helpers: "app/helpers/*.js",
whiteSpace: true
})
app.engine("dust", engine.__express)
app.set("view engine", "dust")
app.set("views", "app/views")
app.set("view cache", false)
Returns a template name according to the options you passed to dustin
Returns an absolute path concatenated from the cwd, the template dir you passed to dustin and the name argument with the .dust extension
var dustin = require("dustin")
dustin.client("destination folder", "resolve path", {
dust: true,
user: "",
custom: ""
})
Client side scripts will be copied here.
Client templates are loaded like this:
script.src = /^(https?:)?\/\/?/.test(template)
? template
: ("RESOLVE_PATH" + "/" + template + ".js").replace(/\/+/g, "/")
Set the resolve path to a template root.
a variable name for the key. defaults to $key
a variable for the value. defaults to $value
the object to iterate over if not provided context.current()
will be used
params are prefixed with a $
so it's less likely they clash with context members
@example
Context
"ooo": {
"a": {
"1": "1"
},
"b": {
"2": "2"
}
}
Template
{@for var="asd" value="qwe" $in=ooo}
{asd}
{@for:qwe}
{$key} - {$value} {~n}
{/for}
{/for}
Output
a1 - 1
b2 - 2
Embed a file from the file system into the template.
The file's source.
Render a partial's body with the macro's params (except the partial).
The template name of a partial
This simply sets the context to the head of the stack. It helps cutting down on typing accessors.
context
"someObject": {
"a": "hello",
"b": "hi"
}
template
{@with:someObject}
{a}{~n}
{b}
{/with}
Output
hello
hi
The same as dust.render, but instead of a string it calls done(err, out)
with a document fragment.
MIT
FAQs
An abstraction on LinkedIn's Dust fork with express support
The npm package dustin receives a total of 65 weekly downloads. As such, dustin popularity was classified as not popular.
We found that dustin 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.