Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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!)
The npm package fnhelp receives a total of 0 weekly downloads. As such, fnhelp popularity was classified as not popular.
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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.