@fav/path.parse
v0.9.0
Published
Provides same behaviors of `path.parse` module for all versions of node.js
Downloads
6
Readme
@fav/path.parse
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.