# @rocketstation/meta-name

> parses path to name based on provided config

Latest version **3.0.1** (published 2019-04-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rocketstation/meta-name
pnpm add @rocketstation/meta-name
yarn add @rocketstation/meta-name
bun add @rocketstation/meta-name
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2019-04-11 |
| First published | 2018-03-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Rocket Station |
| Maintainers | oleksiibilous, oleksiipysanko |

## Links

- npm: https://www.npmjs.com/package/@rocketstation/meta-name
- Repository: https://github.com/rocketstation/meta-name
- Homepage: https://github.com/rocketstation/meta-name#readme
- Issues: https://github.com/rocketstation/meta-name/issues
- npm.io page: https://npm.io/package/@rocketstation/meta-name

## Dependencies (1)

- [@rocketstation/change-case](https://npm.io/package/@rocketstation/change-case.md) 2

## Recent versions

- 3.0.1 (latest) — 2019-04-11
- 3.0.0 — 2019-04-11
- 2.0.0 — 2019-01-11
- 1.0.1 — 2018-03-29
- 1.0.0 — 2018-03-24

## README

# Meta Name

Meta Name parses path to name based on provided config

## Installation

```
npm i @rocketstation/meta-name
```

## Usage

```javascript
import parser from '@rocketstation/meta-name'

const path = 'dir/name.ext'

const parse = parser({
  dispEnd: 0,
  dispStart: 0,
  exts: ['ext'],
  filters: [],
  prefix: '',
  roots: ['dir'],
  suffix: [],
  template: ['dir', 'name'],
})

console.log(parse(path, 'k')) // dir-name
```

## Config

  `parser()`

  `dispEnd` - amount of dirs from root to be omitted. Default is `0`

  `dispStart` - amount of dirs from file to be omitted. Default is `0`

  `exts` - array of extensions to be handled. If provided, paths with invalid extensions will be omitted. Default is `undefined`

  `filters` - array of strings which must be omitted. Default is `[]`

  `prefix` - string or array of strings to be added before result. Default is `undefined`

  `roots` - array of roots to be handled. If provided, paths with invalid roots will be omitted. Default is `undefined`

  `suffix` - string or array of strings to be added after result. Default is `undefined`

  `template` - array of strings. supported values are `'root', 'dir', 'base', 'name', 'ext'`. Default is `['dir', 'name']`

  `parse()`

  `source` - any valid path. Default is `''`
  `case` - Default is `'c'`. Any case kind from [@rocketstation/change-case](https://github.com/rocketstation/change-case)

## Motivation

We were tired of writing this code again and again

## License

Meta Name is licensed under the [MIT License](http://opensource.org/licenses/MIT)

Created by [RocketStation](http://rstation.io)

---
_Source: https://npm.io/package/@rocketstation/meta-name · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
