Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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


© Art Deco for Depack 2019


Tech Nation Visa


Tech Nation Visa Sucks