
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
javadoc-tokenizer
Advanced tools
Tokenize source code documentation created to document non-component functions
in StoryBook.js. StoryBook generates component documentations by adding a
__docgenInfo
property to components. This package can add a __docgenInfo
to
most functions.
npm install javadoc-tokenizer
Download and run npm start
.
@property
bool => Boolean
bytesToText(bytes, precision = 'auto') ⇒ {String}
Tag | Output | Description |
---|---|---|
@name | String | The name of the function (if not present, name will be inferred) |
@description | String | The name of the function (if not present, top text will be used) |
@param | Object[] | type, description, default value and properties of an argument |
@property | Object[] | type, description and default value of an argument's property |
@throws | Object[] | type, description and properties of an Error that may be thrown |
@examples | Object[] | type, text, description and language of a code example |
@access | String | May be public , private , protected or a custom value |
@api | String | Alias for @access |
@public | String | Same as @access public |
@private | String | Same as @access private |
@protected | String | Same as @access protected |
@chainable | Boolean | True if function is chainable |
@deprecated | Boolean | True if function is deprecated |
@version | String | Function version |
@since | String | Version of library when function was added |
@todo | String[] | A list of TODOs |
@see | String[] | A list of text/links for more information |
@returns | Object | type, description and properties of the return value |
@ignore | Boolean | True if function should be omitted from displayed documentation |
Note: Other tags will be put into a customTags
array.
Tokenize source code
const fs = require('fs');
const { extract } = require('javadoc-tokenizer');
let src = fs.readFileSync(path, 'utf8');
const functionDocs = extract(src);
Add a __docgenInfo
property to all functions possible
const fs = require('fs');
const { getDocgenCode } = require('javadoc-tokenizer');
let src = fs.readFileSync(path, 'utf8');
const docgenCode = getDocgenCode(src);
if (docgenCode) {
src += '\n\n' + docgenCode;
}
Input:
/**
* Convert numeric bytes to a rounded number with label
* @example
* bytesToText(23 * 1024 + 35); // 23.4 KB
* @param {Number} bytes The number of bytes
* @param {Number|String} precision The decimal precision or "auto"
* @returns {String}
*/
export default function bytesToText(bytes, precision = 'auto') {
// ...
}
Output:
[
{
access: 'public',
canAddDocgen: true,
chainable: null,
contextCode:
"export default function bytesToText(bytes, precision = 'auto')",
customTags: [],
deprecated: null,
description: 'Convert numeric bytes to a rounded number with label',
examples: [
{
description: '',
language: 'js',
text: 'bytesToText(23 * 1024 + 35); // 23.4 KB',
type: 'javadoc',
},
],
ignore: false,
name: 'bytesToText',
params: [
{
default: undefined,
description: 'The number of bytes',
name: 'bytes',
properties: [],
required: true,
type: 'Number',
},
{
default: undefined,
description: 'The decimal precision or "auto"',
name: 'precision',
properties: [],
required: true,
type: 'Number|String',
},
],
returns: {
description: '',
properties: [],
type: 'String',
},
see: [],
signature: "bytesToText(bytes, precision = 'auto') ⇒ {String}",
since: null,
subtype: null,
throws: [],
todos: [],
type: 'function',
version: null,
},
];
Powered by jest
npm test
npm run coverage
Contributions are welcome. Please open a GitHub ticket for bugs or feature requests. Please make a pull request for any fixes or new code you'd like to be incorporated.
Open Source under the ISC License.
v0.9.4 on 2021-05-20
defaultValue: { value, computed }
to props for StorybookJSFAQs
Tokenize source code documentation
The npm package javadoc-tokenizer receives a total of 0 weekly downloads. As such, javadoc-tokenizer popularity was classified as not popular.
We found that javadoc-tokenizer 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
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.