Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
function-names-at-line
Advanced tools
Name the functions found at a particular line number in some JavaScript source
I was working on this run test by line number feature for teenytest, and needed a way to tell what functions might be described by a given line number.
For example, say you have this file:
// 1
var foo = function () { // 2
var baz = 'lol' // 3
function bar () {} // 4
} // 5
// 6
And read the file into a string named someSource
, then you can:
var functionNamesAtLine = require('function-names-at-line')
functionNamesAtLine(someSource, 1) // []
functionNamesAtLine(someSource, 2) // ['foo']
functionNamesAtLine(someSource, 3) // ['foo']
functionNamesAtLine(someSource, 4) // ['bar', 'foo']
functionNamesAtLine(someSource, 5) // ['foo']
functionNamesAtLine(someSource, 6) // []
This is a pretty naive implementation, focused just on getting basic (not nested) names of functions.
FAQs
Name the functions found at a particular line number in some JavaScript source
The npm package function-names-at-line receives a total of 31 weekly downloads. As such, function-names-at-line popularity was classified as not popular.
We found that function-names-at-line 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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.