Miss any of our Open RFC calls?Watch the recordings here! »

@fav/path.basename

0.9.0 • Public • Published

@fav/path.basename NPM version

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

Install

For installing @fav/path with npm:

$ npm install @fav/path --save

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

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

Usage

When installing @fav/path:

const path = require('@fav/path');
 
path.basename('path/to/file.ext');
// => file.ext
 
path.basename('path/to/file.ext', '.ext');
// => file

When installing @fav/path.basename:

const basename = require('@fav/path.basename');
 
basename('path/to/file.ext');
// => file.ext
 
basename('path/to/file.ext', '.ext');
// => file

API

basename(path, [, ext])

Returns a basename of a file path.

Arguments
  • path [string] : an absolute or relative path string.
  • ext [string] : an extension (optional).
Errors
  • [TypeError] : if path is not a string, or ext is given and 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.

Install

npm i @fav/path.basename

DownloadsWeekly Downloads

20

Version

0.9.0

License

MIT

Last publish

Collaborators

  • avatar