Skip to content

antfu/strip-literal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jan 15, 2025
215fc67 · Jan 15, 2025

History

50 Commits
Nov 23, 2024
Dec 29, 2023
Jan 15, 2025
Jan 15, 2025
Jan 15, 2025
May 7, 2022
May 7, 2022
May 7, 2022
Dec 29, 2023
May 7, 2022
Jan 15, 2025
Jan 15, 2025
Jan 15, 2025
May 7, 2022
Dec 29, 2023

Repository files navigation

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