
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
This library analyzes JavaScript code and returns all the public interfaces exposed at runtime.
##Install
npm install public.js
Browser-based version may be available in the future.
##Example
/* this is the code we want to analyze
function pattern1(param){
function pattern1Private(){
return "should not be testable";
}
return param;
}
var pattern1Variable = "testable";
*/
var inputStr = <string representation of code to analyze>;
var output = publicjs.getPublic(backboneStr,{
dependencies: [underscoreStr],
tree: true
});
console.log(output);
Result:
[
{ name: 'pattern1', type: 'function', parameters: [{ name: 'param' }] },
{ name: 'pattern1Variable', type: 'string', value: 'testable' }
]
##Applications
Automated unit test scaffolding: The tree returned by publicjs could be parsed and used to automatically create unit test cases based on the publically exposed functions. See example at Scaffold.js.
Code security: Add publicjs to your build process to ensure that only the functionality that should be exposed publically by your code is, and that private functions are not accessible.
Code documentation: The interface tree could be parsed to automatically generate documentation for public methods. See example at Scaffold.js.
FAQs
Display the public interfaces for given JavaScript files
The npm package public.js receives a total of 1 weekly downloads. As such, public.js popularity was classified as not popular.
We found that public.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.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.