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.
Get some fn' help from your functions (parse for comments!). This is an experiment in making JS more self-explanatory while playing around, similar to R's ?something
or python's docblock.
This might be a horrible idea.
Somewhere in your code...
function Corgi() {
/**
* This class does some cool stuff, and is apparently complicated enough
* that comments are useful.
*/
this.shedding = 'all the time';
}
Corgi.prototype.croissant = function() {
// It's just really quite ridiculous. He forms nearly an entire circle.
// Long dog is long.
var isLong = true;
// At the end are where the tail should be but isn't.
}
And then maybe from a repl?
> Function.prototype.help = require('fnhelp');
[Function: help]
> Corgi.help()
' This class does some cool stuff, and is apparently complicated enough\n that comments are useful.'
> Corgi.prototype.croissant.help()
' It\'s just really quite ridiculous. He forms nearly an entire circle.\n Long dog is long.'
> var c = new Corgi; c.croissant.help();
' It\'s just really quite ridiculous. He forms nearly an entire circle.\n Long dog is long.'
> c.croissant.help(true);
' It\'s just really quite ridiculous. He forms nearly an entire circle.\n Long dog is long.\n At the end are where the tail should be but isn\'t.'
fnhelp()
Calls toString()
on the current this
and returns the first comments it finds.
fnhelp(true)
Calls toString()
on the current this
and returns all comments it finds.
fnhelp(thing)
Calls toString()
on thing
and returns the first comments it finds.
fnhelp(thing, true)
Calls toString()
on thing
and returns all comments it finds.
For ease of use this might be neat:
Function.prototype.help = require('fnhelp');
fnhelp is a function that will toString
another function and then do minimal parsing to grab the comments. By default it returns the first set of comments it finds. If given a single non-function or second truthy argument, it will return all the comments it finds in the function.
By default, fnhelp supports the following styles of comments:
// This is a comment
/** This is a comment */
/***** what
* this is fine too
*/
/*
* this is fine too
*/
/*****
* are you getting it yet
*****/
/*
I hope you get it by now
*/
fnhelp will also strip leading *
if within a multiline comment, and strip //
if within a single line comment.
MIT
FAQs
Get some fn' help from your functions (parse for comments!)
We found that fnhelp 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.