Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
sumo-templates
Advanced tools
An HTML-ish JavaScript templateing system. This is a work in progress. See the todo list at the bottom to see what still needs to be done.
<!-- List users by name -->
<h1>User List</h1>
<p>Total users: <count collection="people" /></p>
<ul>
<iterate
collection="people as person, index"
sort="name asc">
<li id="person-{{person.id}}">
<h2>{{(index + 1)}}. {{person.name}}</h2>
<if condition="person.age || person.eyeColor">
<h3>Personal Data:</h3>
<ul>
<if condition="person.age">
<li>{{person.age}}</li>
</if>
<if condition="person.eyeColor">
<li>{{person.eyeColor}}</li>
</if>
</ul>
</if>
<if condition="person.friends.length">
<ul>
<iterate
collection="person.friends as friend"
sort="name asc">
<li id="{{friend.id}}">{{friend.name}}</li>
</iterate>
</ul>
<else>
{{person.name}} has no friends :`(
</else>
</if>
</li>
</iterate>
</ul>
var myData = {
someArr: [1, 2, 3]
};
var myTemplate = '<count collection="someArr" />';
var myOutput = sumo.compile(myTemplate, myData);
// myOutput is now '3'
<count collection="collectionName" />
: Counts the number of elements in an array or object<iterate collection="collectionName[ as value[, key]"></iterate>
: Iterates over an array or object
sort
attribute like so:
sort="asc|desc"
: sort arrays or single level objects ascending or descending by valuesort="property asc|desc"
: sort an array of objects or an object of objects by property namesort="property.key asc|desc"
: sort an array of objects or an object of objects by nested property name<if condition="conditionalExpression"></if>
: Displays content only if the provided condition evaluates to true
<if condition="myArr.length">This is true</if>
==
, ===
, !=
, !==
, !
, ||
, &&
, >
, <
, >=
, <=
<if condition="valTrue && !(valFalse && valEmptyStr && val0)">This is true</if>
<else></else>
: When nested in an <if></if>
element, the content within <else></else>
will be displayed when the condition is not satisfied.<elseif condition="conditionalExpression"></elseif>
: When nested in an <if></if>
element, the content within <elseif></elseif>
will be displayed when the if
condition is not satisfied and the elseif
condition is.sort
attribute to <iterate></iterate>
<else></else>
element<elseif></elseif>
element<if condition="(index + 1) === myArr.length"></if>
{{(index + 1)}}
FAQs
An HTML-ish templating engine
The npm package sumo-templates receives a total of 2 weekly downloads. As such, sumo-templates popularity was classified as not popular.
We found that sumo-templates 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.