https://github.com/richienb/convert-typing-name
Convert a package name to it's Typescript typings equivalent package name and vice versa.
https://github.com/richienb/convert-typing-name
Last synced: 10 months ago
JSON representation
Convert a package name to it's Typescript typings equivalent package name and vice versa.
- Host: GitHub
- URL: https://github.com/richienb/convert-typing-name
- Owner: Richienb
- License: mit
- Created: 2019-11-02T00:28:54.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-08-14T05:19:38.000Z (over 4 years ago)
- Last Synced: 2024-10-18T13:13:50.033Z (about 1 year ago)
- Language: JavaScript
- Size: 713 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Convert typing name [](https://travis-ci.com/Richienb/convert-typing-name)
Convert the name of a Typescript typings package to it's npm package counterpart.
[](https://npmjs.com/package/convert-typing-name)
## Install
```sh
npm install convert-typing-name
```
## Usage
```js
const typingName = require("convert-typing-name");
typingName("a");
//=> "@types/a"
typingName("@a/b");
//=> "@types/a__b"
typingName.from("@types/a");
//=> "a"
typingName.from("@types/a__b");
//=> "@a/b"
```
## API
### typingName(name)
Convert the name of a npm package to it's Typescript typings package counterpart.
#### name
Type: `string`
The npm package name to convert.
### typingName.from(name)
Convert the name of a Typescript typings package to it's npm package counterpart.
#### name
Type: `string`
The typings package name to convert.
## Similar
- [parse-pkg-name](https://github.com/Richienb/parse-pkg-name) - Parse and stringify package names.
## Migrating from 1.x
- A minimum version of Node.js 10 is required.
- `typingName.toTyping` is now `typingName`
- `typingName.fromTyping` is now `typingName.from`