Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dpck/split
Splits The Package Name To Return The Name With Scope And Paths.
https://github.com/dpck/split
Last synced: about 1 month ago
JSON representation
Splits The Package Name To Return The Name With Scope And Paths.
- Host: GitHub
- URL: https://github.com/dpck/split
- Owner: dpck
- License: mit
- Created: 2019-04-18T00:50:14.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-04-18T01:01:02.000Z (over 5 years ago)
- Last Synced: 2024-11-18T11:25:22.782Z (about 1 month ago)
- Language: JavaScript
- Homepage: https://artd.eco/depack
- Size: 28.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @depack/split
[![npm version](https://badge.fury.io/js/%40depack%2Fsplit.svg)](https://npmjs.org/package/@depack/split)
`@depack/split` Splits The Package Name To Return The Name With Scope And Paths.
```sh
yarn add -E @depack/split
```## Table Of Contents
- [Table Of Contents](#table-of-contents)
- [API](#api)
- [`split(name: string): { name: string, paths: string }`](#splitname-string--name-string-paths-string-)
- [Copyright](#copyright)## API
The package is available by importing its default function:
```js
import split from '@depack/split'
```## `split(`
`name: string,`
`): { name: string, paths: string }`Returns the name and paths for the given package string that can have a scope and the paths after the package name.
```js
/* alanode example/ */
import split from '@depack/split'console.log(split('package-name'))
console.log(split('package-name/src/index.js'))
console.log(split('@scope/package-name'))
console.log(split('@scope/package-name/src/index.js'))
```
```js
{ name: 'package-name', paths: '' }
{ name: 'package-name', paths: 'src/index.js' }
{ name: '@scope/package-name', paths: '' }
{ name: '@scope/package-name', paths: 'src/index.js' }
```## Copyright
© Art Deco for Depack 2019
Tech Nation Visa Sucks