https://github.com/nodef/extra-javascript-text
Utilities for processing JavaScript text.
https://github.com/nodef/extra-javascript-text
comment-match-function comment-replace-function comments correct-declarations export-symbol export-symbol-match-function export-symbol-replace-function export-symbols extra for-each-comment import-symbol import-symbol-match-function import-symbol-replace-function javascript jsdoc-symbol jsdoc-symbol-match-function jsdoc-symbol-replace-function string-match-function string-replace-function text
Last synced: about 1 month ago
JSON representation
Utilities for processing JavaScript text.
- Host: GitHub
- URL: https://github.com/nodef/extra-javascript-text
- Owner: nodef
- License: mit
- Created: 2022-04-01T14:47:23.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-08T17:18:58.000Z (about 1 year ago)
- Last Synced: 2026-04-11T15:38:47.765Z (2 months ago)
- Topics: comment-match-function, comment-replace-function, comments, correct-declarations, export-symbol, export-symbol-match-function, export-symbol-replace-function, export-symbols, extra, for-each-comment, import-symbol, import-symbol-match-function, import-symbol-replace-function, javascript, jsdoc-symbol, jsdoc-symbol-match-function, jsdoc-symbol-replace-function, string-match-function, string-replace-function, text
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/extra-javascript-text
- Size: 85 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
Utilities for processing JavaScript text.
📦 [Node.js](https://www.npmjs.com/package/extra-javascript-text),
🌐 [Web](https://www.npmjs.com/package/extra-javascript-text.web),
📜 [Files](https://unpkg.com/extra-javascript-text/),
📰 [Docs](https://nodef.github.io/extra-javascript-text/).
This package is available in *Node.js* and *Web* formats. To use it on the web,
simply use the `extra_javascript_text` global variable after loading with a ``
tag from the [jsDelivr CDN].
> Stability: [Experimental](https://www.youtube.com/watch?v=L1j93RnIxEo).
[jsDelivr CDN]: https://cdn.jsdelivr.net/npm/extra-javascript-text.web/index.js
<br>
```javascript
const fs = require('fs');
const xjavascript = require('extra-javascript-text');
function main() {
var txt = fs.readFileSync('src/index.ts', 'utf8').replace(/\r?\n/, '\n');
xjavascript.importSymbols(txt);
// []
xjavascript.exportSymbols(txt);
// [
// {
// full: 'export function tagStrings',
// name: 'tagStrings',
// kind: 'function',
// isDefault: false
// },
// {
// full: 'export function untagStrings',
// name: 'untagStrings',
// kind: 'function',
// isDefault: false
// },
// ...
// ]
xjavascript.jsdocSymbols(txt);
// [
// {
// full: '/**\r\n' +
// ' * Get index of string end.\r\n' +
// ' * @param txt javascript text\r\n' +
// ' * @param i index of string begin\r\n' +
// ' */\r\n' +
// ' function indexOfClosingString',
// jsdoc: '/**\r\n' +
// ' * Get index of string end.\r\n' +
// ' * @param txt javascript text\r\n' +
// ' * @param i index of string begin\r\n' +
// ' */',
// name: 'indexOfClosingString',
// kind: 'function',
// isExported: false,
// isDefault: false
// },
// {
// full: '/**\r\n' +
// ' * Tag strings in javascript text and remove them.\r\n' +
// ' * @param txt javascript text\r\n' +
// ' * @returns [updated javascript text, tags]\r\n' +
// ' */\r\n' +
// 'export function tagStrings',
// jsdoc: '/**\r\n' +
// ' * Tag strings in javascript text and remove them.\r\n' +
// ' * @param txt javascript text\r\n' +
// ' * @returns [updated javascript text, tags]\r\n' +
// ' */',
// name: 'tagStrings',
// kind: 'function',
// isExported: true,
// isDefault: false
// },
// ...
// ]
}
main();
```
<br>
<br>
## Index
| Property | Description |
| ---- | ---- |
| [tagStrings] | Tag strings in javascript text and remove them. |
| [untagStrings] | Untag strings in javascript text by adding them back. |
| [forEachComment] | Match links in javascript text. |
| [comments] | Get comments in javascript text. |
| [replaceComments] | Replace comments in javascript text. |
| [tagComments] | Tag comments in javascript text and remove them. |
| [untagComments] | Untag comments in javascript text by adding them back. |
| [uncomment] | Remove comments from javascript text. |
| [forEachJsdocSymbol] | Match jsdoc symbols in javascript text. |
| [jsdocSymbols] | Get jsdoc symbols in javascript text. |
| [replaceJsdocSymbols] | Replace jsdoc symbols in javascript text. |
| [forEachExportSymbol] | Match export symbols in javascript text. |
| [exportSymbols] | Get export symbols in javascript text. |
| [replaceExportSymbols] | Replace export symbols in javascript text. |
| [forEachImportSymbol] | Match import symbols in javascript text. |
| [importSymbols] | Get import symbols in javascript text. |
| [replaceImportSymbols] | Replace import symbols in javascript text. |
| [correctDeclarations] | Correct type declarations after generation. |
<br>
<br>
[](https://www.youtube.com/watch?v=rJYcZX8na_Q)<br>
[](https://nodef.github.io)
[](https://zenodo.org/badge/latestdoi/476759917)

[tagStrings]: https://nodef.github.io/extra-javascript-text/modules.html#tagStrings
[untagStrings]: https://nodef.github.io/extra-javascript-text/modules.html#untagStrings
[forEachComment]: https://nodef.github.io/extra-javascript-text/modules.html#forEachComment
[comments]: https://nodef.github.io/extra-javascript-text/modules.html#comments
[replaceComments]: https://nodef.github.io/extra-javascript-text/modules.html#replaceComments
[tagComments]: https://nodef.github.io/extra-javascript-text/modules.html#tagComments
[untagComments]: https://nodef.github.io/extra-javascript-text/modules.html#untagComments
[uncomment]: https://nodef.github.io/extra-javascript-text/modules.html#uncomment
[forEachJsdocSymbol]: https://nodef.github.io/extra-javascript-text/modules.html#forEachJsdocSymbol
[jsdocSymbols]: https://nodef.github.io/extra-javascript-text/modules.html#jsdocSymbols
[replaceJsdocSymbols]: https://nodef.github.io/extra-javascript-text/modules.html#replaceJsdocSymbols
[forEachExportSymbol]: https://nodef.github.io/extra-javascript-text/modules.html#forEachExportSymbol
[exportSymbols]: https://nodef.github.io/extra-javascript-text/modules.html#exportSymbols
[replaceExportSymbols]: https://nodef.github.io/extra-javascript-text/modules.html#replaceExportSymbols
[forEachImportSymbol]: https://nodef.github.io/extra-javascript-text/modules.html#forEachImportSymbol
[importSymbols]: https://nodef.github.io/extra-javascript-text/modules.html#importSymbols
[replaceImportSymbols]: https://nodef.github.io/extra-javascript-text/modules.html#replaceImportSymbols
[correctDeclarations]: https://nodef.github.io/extra-javascript-text/modules.html#correctDeclarations