ts-blank-space-lite
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

ts-blank-space-lite

CI NPM VERSION NPM DOWNLOADS LICENSE

Fork of bloomberg/ts-blank-space, a small, fast, pure JavaScript type-stripper that uses the official TypeScript parser.

Changes in this fork:

  • Rename and publish as ts-blank-space-lite
  • Wrap all index.ts content in async function createTSBlankSpace
  • Export only function createTSBlankSpace
  • Replace String#charCodeAt to String#codePointAt
  • Ships ESM and CJS bundles
  • Change dependency typescript to a params of createTSBlankSpace
  • Support import typescript module by path
  • Drop Node.js loader support

Install

npm install ts-blank-space-lite
yarn add ts-blank-space-lite
pnpm add ts-blank-space-lite

Usage

import { createTSBlankSpace } from 'ts-blank-space-lite'

const { tsBlankSpace } = await createTSBlankSpace()

console.log(tsBlankSpace(`const foo: string = 'foo'`))
// => `const foo         = 'foo'`

Api

createTSBlankSpace(tsLibOrTsPath)

Create a tsBlankSpace function with tsLibOrTsPath.

tsLibOrTsPath

  • type: typeof import('typescript') | string
  • default: require.resolve('typescript')
  • required: false

typescript module or path to typescript/lib/typescript.js.

Credits

License

Apache-2.0 License

Readme

Keywords

none

Package Sidebar

Install

npm i ts-blank-space-lite

Weekly Downloads

3

Version

0.0.3

License

Apache-2.0

Unpacked Size

75.7 kB

Total Files

12

Last publish

Collaborators

  • ntnyq