Acme.BookStore.HttpApi.Host/node_modules/parse-filepath/README.md

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

# parse-filepath [![NPM version](https://img.shields.io/npm/v/parse-filepath.svg?style=flat)](https://www.npmjs.com/package/parse-filepath) [![NPM downloads](https://img.shields.io/npm/dm/parse-filepath.svg?style=flat)](https://npmjs.org/package/parse-filepath) [![Build Status](https://img.shields.io/travis/jonschlinkert/parse-filepath.svg?style=flat)](https://travis-ci.org/jonschlinkert/parse-filepath)

> Pollyfill for node.js `path.parse`, parses a filepath into an object.

You might also be interested in [global-prefix](https://github.com/jonschlinkert/global-prefix).

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install parse-filepath --save
```

## Usage

```js
var parsePath = require('parse-filepath');
parsePath(filepath);
```

This can be used as a polyfill for the native node.js `path.parse()` method, and it also adds a few properties:

* `path`: the original filepath
* `isAbsolute`: (getter) true if the given path is absolute
* `absolute`: (getter) fully resolved, absolute filepath
* `dirname`: alias for `dir`
* `basename`: alias for `base`
* `extname`: alias for `ext`
* `stem`: alias for `name`

**Example**

```js
var parsePath = require('parse-filepath');
console.log(parsePath('foo/bar/baz/index.js'));
```

Returns:

```js
{ root: '',
  dir: 'foo/bar/baz',
  base: 'index.js',
  ext: '.js',
  name: 'index',

  // aliases
  extname: '.js',
  basename: 'index.js',
  dirname: 'foo/bar/baz',
  stem: 'index',

  // original path
  path: 'foo/bar/baz/index.js',

  // getters
  absolute: [Getter/Setter],
  isAbsolute: [Getter/Setter] }
```
后面还有 51 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。