package
utils for comments in TypeScript/JavaScript file
npm install ts-commentGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
utils for comments in TypeScript/JavaScript file
# using npm
npm install --save ts-comment
# using yarn
yarn add ts-commentimport * as ts_comment from 'ts-comment';
const file_content = `
class X {}
// comment 1
const y = 0;
/* comment 2 */
function z() {}
`;
ts_comment.gets(file_content); //=> ['// comment 1', '/* comment 2 */']/**
* iterate every comment, return `false` to stop iteration
*/
function for_each(
source: string | ts.SourceFile,
callback: (comment: string, scanner: ts.Scanner, source_file: ts.SourceFile) => boolean | void,
ts?: typeof ts,
): void;
/**
* get comments from source, optional callback for custom results
*/
function gets(source: string | ts.SourceFile)
# lint
yarn run lint
# build
yarn run build
# test
yarn run testMIT © Ika
Estimated unpacked size across 22 packages.
534.1 MB
Includes dependencies.