strip-literal

Strip comments and string literals from JavaScript code

MIT 16 个版本
安装
npm install strip-literal
yarn add strip-literal
pnpm add strip-literal
bun add strip-literal
README

strip-literal

NPM version

Strip comments and string literals from JavaScript code. Powered by js-tokens.

Usage

import { stripLiteral } from 'strip-literal'

stripLiteral('const foo = `//foo ${bar}`') // 'const foo = `       ${bar}`'

Comments, string literals will be replaced by spaces with the same length to keep the source map untouched.

Sponsors

License

MIT License © 2022 Anthony Fu

版本列表
3.1.0 2025-09-27
3.0.0 2025-01-15
2.1.1 2024-11-23
2.1.0 2024-03-29
2.0.0 2023-12-29
1.3.0 2023-08-03
1.2.0 2023-08-02
1.1.0 2023-08-02
1.0.1 2023-02-03
1.0.0 2022-11-14
0.4.2 2022-09-18
0.4.1 2022-09-12
0.4.0 2022-06-14
0.3.0 2022-05-07
0.2.0 2022-05-07
0.1.0 2022-05-07