extra-javascript-text
Advanced tools
Comparing version 0.1.4 to 0.1.5
144
index.d.ts
/** | ||
* String match function. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/StringMatchFunction) | ||
* @param full full string | ||
* */ | ||
*/ | ||
declare type StringMatchFunction = (full: string) => void; | ||
/** | ||
* Match string in javascript text. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/forEachString) | ||
* @param txt javascript text | ||
* @param fn match function | ||
* */ | ||
*/ | ||
declare function forEachString(txt: string, fn: StringMatchFunction): void; | ||
/** | ||
* Get strings in javascript text. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/strings) | ||
* @param txt javascript text | ||
* @returns strings | ||
* */ | ||
*/ | ||
declare function strings(txt: string): string[]; | ||
/** | ||
* String replace function. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/StringReplaceFunction) | ||
* @param full full string | ||
* @returns updated string | ||
* */ | ||
*/ | ||
declare type StringReplaceFunction = (full: string) => string; | ||
/** | ||
* Replace strings in javascript text. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/replaceStrings) | ||
* @param txt javascript text | ||
* @param fn replace function | ||
* @returns updated javascript text | ||
* */ | ||
*/ | ||
declare function replaceStrings(txt: string, fn: StringReplaceFunction): string; | ||
/** | ||
* Tag strings in javascript text and remove them. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/tagStrings) | ||
* @param txt javascript text | ||
* @returns [updated javascript text, tags] | ||
* */ | ||
*/ | ||
declare function tagStrings(txt: string): [string, Map<string, string>]; | ||
/** | ||
* Untag strings in javascript text by adding them back. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/untagStrings) | ||
* @param txt javascript text | ||
* @param tags tags | ||
* @returns updated javascript text | ||
* */ | ||
*/ | ||
declare function untagStrings(txt: string, tags: Map<string, string>): string; | ||
/** | ||
* Comment match function. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/CommentMatchFunction) | ||
* @param full full comment | ||
* */ | ||
*/ | ||
declare type CommentMatchFunction = (full: string) => void; | ||
/** | ||
* Match links in javascript text. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/forEachComment) | ||
* @param txt javascript text | ||
* @param fn match function | ||
* */ | ||
*/ | ||
declare function forEachComment(txt: string, fn: CommentMatchFunction): void; | ||
/** | ||
* Get comments in javascript text. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/comments) | ||
* @param txt javascript text | ||
* @returns comments | ||
* */ | ||
*/ | ||
declare function comments(txt: string): string[]; | ||
/** | ||
* Comment replace function. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/CommentReplaceFunction) | ||
* @param full full comment | ||
* @returns updated comment | ||
* */ | ||
*/ | ||
declare type CommentReplaceFunction = (full: string) => string; | ||
/** | ||
* Replace comments in javascript text. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/replaceComments) | ||
* @param txt javascript text | ||
* @param fn replace function | ||
* @returns updated javascript text | ||
* */ | ||
*/ | ||
declare function replaceComments(txt: string, fn: CommentReplaceFunction): string; | ||
/** | ||
* Tag comments in javascript text and remove them. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/tagComments) | ||
* @param txt javascript text | ||
* @returns [updated javascript text, tags] | ||
* */ | ||
*/ | ||
declare function tagComments(txt: string): [string, Map<string, string>]; | ||
/** | ||
* Untag comments in javascript text by adding them back. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/untagComments) | ||
* @param txt javascript text | ||
* @param tags tags | ||
* @returns updated javascript text | ||
* */ | ||
*/ | ||
declare function untagComments(txt: string, tags: Map<string, string>): string; | ||
/** | ||
* Remove comments from javascript text. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/uncomment) | ||
* */ | ||
* @param {string} txt javascript text | ||
* @param {boolean} empty keep empty lines? | ||
*/ | ||
declare function uncomment(txt: string, empty?: boolean): string; | ||
/** | ||
* JSDoc symbol match function. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/JsdocSymbolMatchFunction) | ||
* @param full full jsdoc symbol match | ||
@@ -130,18 +101,11 @@ * @param jsdoc jsdoc attached to symbol | ||
* @param isDefault symbol is default? | ||
* */ | ||
*/ | ||
declare type JsdocSymbolMatchFunction = (full: string, jsdoc: string, name: string, kind: string, isExported: boolean, isDefault: boolean) => void; | ||
/** | ||
* Match jsdoc symbols in javascript text. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/forEachJsdocSymbol) | ||
* @param txt javascript text | ||
* @param fn match function | ||
* */ | ||
*/ | ||
declare function forEachJsdocSymbol(txt: string, fn: JsdocSymbolMatchFunction): void; | ||
/** | ||
* JSDoc symbol. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/JsdocSymbol) | ||
* */ | ||
/** JSDoc symbol. */ | ||
interface JsdocSymbol { | ||
@@ -163,11 +127,8 @@ /** Full jsdoc symbol match. */ | ||
* Get jsdoc symbols in javascript text. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/jsdocSymbols) | ||
* @param txt javascript text | ||
* @returns jsdoc symbols | ||
* */ | ||
*/ | ||
declare function jsdocSymbols(txt: string): JsdocSymbol[]; | ||
/** | ||
* Jsdoc symbol replace function. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/JsdocSymbolReplaceFunction) | ||
* @param full full jsdoc symbol match | ||
@@ -180,17 +141,13 @@ * @param jsdoc jsdoc attached to symbol | ||
* @returns updated jsdoc symbol | ||
* */ | ||
*/ | ||
declare type JsdocSymbolReplaceFunction = (full: string, jsdoc: string, name: string, kind: string, isExported: boolean, isDefault: boolean) => string; | ||
/** | ||
* Replace jsdoc symbols in javascript text. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/replaceJsdocSymbols) | ||
* @param txt javascript text | ||
* @param fn replace function | ||
* @returns updated javascript text | ||
* */ | ||
*/ | ||
declare function replaceJsdocSymbols(txt: string, fn: JsdocSymbolReplaceFunction): string; | ||
/** | ||
* Export symbol match function. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/ExportSymbolMatchFunction) | ||
* @param full full export symbol match | ||
@@ -200,18 +157,11 @@ * @param name symbol name | ||
* @param isDefault symbol is default? | ||
* */ | ||
*/ | ||
declare type ExportSymbolMatchFunction = (full: string, name: string, kind: string, isDefault: boolean) => void; | ||
/** | ||
* Match export symbols in javascript text. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/forEachExportSymbol) | ||
* @param txt javascript text | ||
* @param fn match function | ||
* */ | ||
*/ | ||
declare function forEachExportSymbol(txt: string, fn: ExportSymbolMatchFunction): void; | ||
/** | ||
* Export symbol. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/ExportSymbol) | ||
* */ | ||
/** Export symbol. */ | ||
interface ExportSymbol { | ||
@@ -229,11 +179,8 @@ /** Full export symbol match. */ | ||
* Get export symbols in javascript text. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/exportSymbols) | ||
* @param txt javascript text | ||
* @returns export symbols | ||
* */ | ||
*/ | ||
declare function exportSymbols(txt: string): ExportSymbol[]; | ||
/** | ||
* Export symbol replace function. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/ExportSymbolReplaceFunction) | ||
* @param full full export symbol match | ||
@@ -244,35 +191,24 @@ * @param name symbol name | ||
* @returns updated export symbol | ||
* */ | ||
*/ | ||
declare type ExportSymbolReplaceFunction = (full: string, name: string, kind: string, isDefault: boolean) => string; | ||
/** | ||
* Replace export symbols in javascript text. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/replaceExportSymbols) | ||
* @param txt javascript text | ||
* @param fn replace function | ||
* @returns updated javascript text | ||
* */ | ||
*/ | ||
declare function replaceExportSymbols(txt: string, fn: ExportSymbolReplaceFunction): string; | ||
/** | ||
* Import symbol match function. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/ImportSymbolMatchFunction) | ||
* @param full full import symbol match | ||
* @param file import file | ||
* */ | ||
*/ | ||
declare type ImportSymbolMatchFunction = (full: string, file: string) => void; | ||
/** | ||
* Match import symbols in javascript text. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/forEachImportSymbol) | ||
* @param txt javascript text | ||
* @param fn match function | ||
* */ | ||
*/ | ||
declare function forEachImportSymbol(txt: string, fn: ImportSymbolMatchFunction): void; | ||
/** | ||
* Import symbol. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/ImportSymbol) | ||
* */ | ||
/** Import symbol. */ | ||
interface ImportSymbol { | ||
@@ -286,36 +222,28 @@ /** Full import symbol match. */ | ||
* Get import symbols in javascript text. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/importSymbols) | ||
* @param txt javascript text | ||
* @returns export symbols | ||
* */ | ||
*/ | ||
declare function importSymbols(txt: string): ImportSymbol[]; | ||
/** | ||
* Import symbol replace function. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/ImportSymbolReplaceFunction) | ||
* @param full full import symbol match | ||
* @param file import file | ||
* @returns updated import symbol | ||
* */ | ||
*/ | ||
declare type ImportSymbolReplaceFunction = (full: string, file: string) => string; | ||
/** | ||
* Replace import symbols in javascript text. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/replaceImportSymbols) | ||
* @param txt javascript text | ||
* @param fn replace function | ||
* @returns updated javascript text | ||
* */ | ||
*/ | ||
declare function replaceImportSymbols(txt: string, fn: ImportSymbolReplaceFunction): string; | ||
/** | ||
* Correct type declarations after generation. | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/correctDeclarations) | ||
* @param txt javascript text | ||
* @param module module name | ||
* @returns corrected javascript text | ||
* */ | ||
*/ | ||
declare function correctDeclarations(txt: string, module?: string): string; | ||
export { CommentMatchFunction, CommentReplaceFunction, ExportSymbol, ExportSymbolMatchFunction, ExportSymbolReplaceFunction, ImportSymbol, ImportSymbolMatchFunction, ImportSymbolReplaceFunction, JsdocSymbol, JsdocSymbolMatchFunction, JsdocSymbolReplaceFunction, StringMatchFunction, StringReplaceFunction, comments, correctDeclarations, exportSymbols, forEachComment, forEachExportSymbol, forEachImportSymbol, forEachJsdocSymbol, forEachString, importSymbols, jsdocSymbols, replaceComments, replaceExportSymbols, replaceImportSymbols, replaceJsdocSymbols, replaceStrings, strings, tagComments, tagStrings, uncomment, untagComments, untagStrings }; |
{ | ||
"name": "extra-javascript-text", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Utilities for processing JavaScript text.", | ||
@@ -25,36 +25,31 @@ "main": "index.js", | ||
"text", | ||
"ExportSymbol", | ||
"ImportSymbol", | ||
"JsdocSymbol", | ||
"CommentMatchFunction", | ||
"CommentReplaceFunction", | ||
"ExportSymbolMatchFunction", | ||
"ExportSymbolReplaceFunction", | ||
"ImportSymbolMatchFunction", | ||
"ImportSymbolReplaceFunction", | ||
"JsdocSymbolMatchFunction", | ||
"JsdocSymbolReplaceFunction", | ||
"StringMatchFunction", | ||
"StringReplaceFunction", | ||
"tag-strings", | ||
"untag-strings", | ||
"comment-match-function", | ||
"for-each-comment", | ||
"comments", | ||
"correctDeclarations", | ||
"exportSymbols", | ||
"forEachComment", | ||
"forEachExportSymbol", | ||
"forEachImportSymbol", | ||
"forEachJsdocSymbol", | ||
"forEachString", | ||
"importSymbols", | ||
"jsdocSymbols", | ||
"replaceComments", | ||
"replaceExportSymbols", | ||
"replaceImportSymbols", | ||
"replaceJsdocSymbols", | ||
"replaceStrings", | ||
"strings", | ||
"tagComments", | ||
"tagStrings", | ||
"comment-replace-function", | ||
"replace-comments", | ||
"tag-comments", | ||
"untag-comments", | ||
"uncomment", | ||
"untagComments", | ||
"untagStrings" | ||
"jsdoc-symbol-match-function", | ||
"for-each-jsdoc-symbol", | ||
"jsdoc-symbol", | ||
"jsdoc-symbols", | ||
"jsdoc-symbol-replace-function", | ||
"replace-jsdoc-symbols", | ||
"export-symbol-match-function", | ||
"for-each-export-symbol", | ||
"export-symbol", | ||
"export-symbols", | ||
"export-symbol-replace-function", | ||
"replace-export-symbols", | ||
"import-symbol-match-function", | ||
"for-each-import-symbol", | ||
"import-symbol", | ||
"import-symbols", | ||
"import-symbol-replace-function", | ||
"replace-import-symbols", | ||
"correct-declarations" | ||
], | ||
@@ -68,9 +63,9 @@ "author": "wolfram77@gmail.com", | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^22.0.1", | ||
"@rollup/plugin-node-resolve": "^13.3.0", | ||
"@types/node": "^18.0.5", | ||
"extra-build": "^2.2.3", | ||
"@rollup/plugin-commonjs": "^21.0.3", | ||
"@rollup/plugin-node-resolve": "^13.1.3", | ||
"@types/node": "^17.0.23", | ||
"extra-build": "^2.0.29", | ||
"rollup-plugin-cleanup": "^3.2.1", | ||
"rollup-plugin-dts": "^4.2.2" | ||
"rollup-plugin-dts": "^4.2.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30708
620