@fav/path.parse

0.9.0 • Public • Published

@fav/path.parse NPM version

Provides same behaviors of path.parse module for all versions of node.js

Install

For installing @fav/path with npm:

$ npm install @fav/path --save

For installing only @fav/path.parse with npm:

$ npm install @fav/path.parse --save

Usage

When installing @fav/path:

const path = require('@fav/path');

path.parse('/path/to/file.txt');
// => {
//      root: '/',
//      dir: '/path/to',
//      base: 'file.txt',
//      ext: '.txt',
//      name: 'file'
//    }

When installing @fav/path.parse:

const parse = require('@fav/path.parse');

parse('/path/to/file.txt');
// => {
//      root: '/',
//      dir: '/path/to',
//      base: 'file.txt',
//      ext: '.txt',
//      name: 'file'
//    }

API

parse(path)

Parses the path string and returns the result object which has the path elements as its properties. The properties are as follows:

  • root [String]
  • dir [String]
  • base [String]
  • ext [String]
  • name [String]
Arguments
  • path [string] : a path string.
Errors
  • [TypeError] : if path is not a string.

License

Copyright (C) 2016 Takayuki Sato

This program is free software under MIT License. See the file LICENSE in this distribution for more details.

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @fav/path.parse

    Weekly Downloads

    2

    Version

    0.9.0

    License

    MIT

    Last publish

    Collaborators

    • sttk