https://github.com/zoubin/util-path
extend node path module with useful methods
https://github.com/zoubin/util-path
Last synced: 9 months ago
JSON representation
extend node path module with useful methods
- Host: GitHub
- URL: https://github.com/zoubin/util-path
- Owner: zoubin
- Created: 2015-05-26T05:49:03.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-06-10T03:54:39.000Z (about 11 years ago)
- Last Synced: 2025-09-07T11:22:12.494Z (10 months ago)
- Language: JavaScript
- Size: 152 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
Awesome Lists containing this project
README
# util-path
extend node path module with useful methods
## path.replaceExtname(filename, [ext=''])
Replace extname of filename with ext.
```javascript
var replace = require('util-path').replaceExtname;
replace('/a/b/c.scss', '.css'); // '/a/b/c.css'
replace('/a/b/c.scss'); // '/a/b/c'
```
## path.basename(filename, pattern)
Extend original `path.basename`, so that the second pattern can be a pattern proper for [minimatch](https://www.npmjs.com/package/minimatch)
```javascript
var basename = require('util-path').basename;
basename('/a/b/c.scss', '.{sc,c,sa}ss'); // 'c'
basename('/a/b/c.scss', '.*'); // 'c'
```