
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
Ever find yourself handling complex data structures in JavaScript? With cmd.js, one can assemble small blocks of logic, and easily pass data through them for processing. Here's a sample task, and how it's made clearer with cmd.js:
Sort the users by increasing age, and display the name and id of each user.
var users = [
{name: 'John', id: 1, age: 37},
{name: 'Kimberly', id: 2, age: 35},
{name: 'Janine', id: 3, age: 33},
{name: 'Justin', id: 4, age: 31},
];
users.sort(function (a, b) {
return a.age > b.age;
});
users.forEach(function (user) {
console.log(user.name, user.id);
});
// The output:
// Justin 4
// Janine 3
// Kimberly 2
// John 1
Pretty simple, right?
var pluck = cmd.pluck;
var sortAndPrint = cmd.sort(pluck('age')).
and.logger(pluck('name'), pluck('id'));
sortAndPrint(users);
// The output:
// Justin 4
// Janine 3
// Kimberly 2
// John 1
The benefits of this style include reusability, clear logical flow, and less code in general. By composing commands you keep your functionality completely isolated from your data.
This project uses gulp. Make all changes/additions in lib/*.js
while running gulp
from the command line.
cmd.name(... args ...)(... vals ...);
Some commands do not accept args, and you are given the command with empty args already provided.
cmd.sum(... vals ...);
cmd.alert(val1, ...)
name | all or each? | accepts args? | return value |
---|---|---|---|
alert | each | no | [undefined, ...] |
The following example displays two alerts in sequence.
cmd.alert('Hello World!', 'Will Smith here.');
cmd.compare(val1, val2)
name | all or each? | accepts args? | return value |
---|---|---|---|
compare | all | no | -1 or 0 or 1 |
Compare is a unique command in that it only accepts 2 values. Any further values will be ignored.
The following example compares two values.
console.log(cmd.compare(8, 5)); // logs 3
cmd.exists(val1, ...)
name | all or each? | accepts args? | return value |
---|---|---|---|
exists | each | no | [true or false, ...] |
The following example checks the existence of the values. Only null and undefined count as not existing.
cmd.exists(null, undefined, false, '', 0, true);
// [false, false, true, true, true, true]
cmd.extend(arg1, ...)(val1, ...)
name | all or each? | accepts args? | return value |
---|---|---|---|
extend | each | yes | [{...}, ...] |
Extends each value with each argument, in order.
cmd.extend({color: 'red'})({item: 'wrench'}, {item: 'apple'});
// [{item: 'wrench', color: 'red'}, {item: 'apple', color: 'red'}]
FAQs
A chainable utility toolkit for JavaScript.
We found that cmd.js 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
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.