@depack/split
v1.0.0
Published
Splits The Package Name To Return The Name With Scope And Paths.
Downloads
205
Readme
@depack/split
@depack/split
Splits The Package Name To Return The Name With Scope And Paths.
yarn add -E @depack/split
Table Of Contents
API
The package is available by importing its default function:
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.
/* 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'))
{ name: 'package-name', paths: '' }
{ name: 'package-name', paths: 'src/index.js' }
{ name: '@scope/package-name', paths: '' }
{ name: '@scope/package-name', paths: 'src/index.js' }