pax_global_header00006660000000000000000000000064127544773170014533gustar00rootroot0000000000000052 comment=adaec75e316f1c375dc7a2cb51c7b762b135cc0e replace-ext-1.0.0/000077500000000000000000000000001275447731700137425ustar00rootroot00000000000000replace-ext-1.0.0/.editorconfig000066400000000000000000000003051275447731700164150ustar00rootroot00000000000000# http://editorconfig.org root = true [*] indent_style = space indent_size = 2 charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace = false replace-ext-1.0.0/.eslintrc000066400000000000000000000000301275447731700155570ustar00rootroot00000000000000{ "extends": "gulp" } replace-ext-1.0.0/.gitignore000066400000000000000000000012541275447731700157340ustar00rootroot00000000000000# Logs logs *.log # Runtime data pids *.pid *.seed # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) .grunt # Compiled binary addons (http://nodejs.org/api/addons.html) build/Release # Dependency directory # Commenting this out is preferred by some people, see # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- node_modules # Users Environment Variables .lock-wscript # Garbage files .DS_Store # Generated by integration tests test/fixtures/tmp test/fixtures/out replace-ext-1.0.0/.jscsrc000066400000000000000000000000271275447731700152310ustar00rootroot00000000000000{ "preset": "gulp" } replace-ext-1.0.0/.travis.yml000066400000000000000000000001711275447731700160520ustar00rootroot00000000000000sudo: false language: node_js node_js: - '6' - '5' - '4' - '0.12' - '0.10' after_script: - npm run coveralls replace-ext-1.0.0/LICENSE000077500000000000000000000022141275447731700147510ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2014 Blaine Bublitz , Eric Schoffstall and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. replace-ext-1.0.0/README.md000066400000000000000000000031401275447731700152170ustar00rootroot00000000000000

# replace-ext [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] Replaces a file extension with another one. ## Usage ```js var replaceExt = require('replace-ext'); var path = '/some/dir/file.js'; var newPath = replaceExt(path, '.coffee'); console.log(newPath); // /some/dir/file.coffee ``` ## API ### `replaceExt(path, extension)` Replaces the extension from `path` with `extension` and returns the updated path string. Does not replace the extension if `path` is not a string or is empty. ## License MIT [downloads-image]: http://img.shields.io/npm/dm/replace-ext.svg [npm-url]: https://www.npmjs.com/package/replace-ext [npm-image]: http://img.shields.io/npm/v/replace-ext.svg [travis-url]: https://travis-ci.org/gulpjs/replace-ext [travis-image]: http://img.shields.io/travis/gulpjs/replace-ext.svg?label=travis-ci [appveyor-url]: https://ci.appveyor.com/project/gulpjs/replace-ext [appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/replace-ext.svg?label=appveyor [coveralls-url]: https://coveralls.io/r/gulpjs/replace-ext [coveralls-image]: http://img.shields.io/coveralls/gulpjs/replace-ext/master.svg [gitter-url]: https://gitter.im/gulpjs/gulp [gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg replace-ext-1.0.0/appveyor.yml000066400000000000000000000007211275447731700163320ustar00rootroot00000000000000# http://www.appveyor.com/docs/appveyor-yml # http://www.appveyor.com/docs/lang/nodejs-iojs environment: matrix: # node.js - nodejs_version: "0.10" - nodejs_version: "0.12" - nodejs_version: "4" - nodejs_version: "5" - nodejs_version: "6" install: - ps: Install-Product node $env:nodejs_version - npm install test_script: - node --version - npm --version - cmd: npm test build: off # build version format version: "{build}" replace-ext-1.0.0/index.js000066400000000000000000000005221275447731700154060ustar00rootroot00000000000000'use strict'; var path = require('path'); function replaceExt(npath, ext) { if (typeof npath !== 'string') { return npath; } if (npath.length === 0) { return npath; } var nFileName = path.basename(npath, path.extname(npath)) + ext; return path.join(path.dirname(npath), nFileName); } module.exports = replaceExt; replace-ext-1.0.0/package.json000066400000000000000000000020731275447731700162320ustar00rootroot00000000000000{ "name": "replace-ext", "version": "1.0.0", "description": "Replaces a file extension with another one", "author": "Gulp Team (http://gulpjs.com/)", "contributors": [ "Eric Schoffstall ", "Blaine Bublitz " ], "repository": "gulpjs/replace-ext", "license": "MIT", "engines": { "node": ">= 0.10" }, "main": "index.js", "files": [ "LICENSE", "index.js" ], "scripts": { "lint": "eslint . && jscs index.js test/", "pretest": "npm run lint", "test": "mocha --async-only", "cover": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly", "coveralls": "npm run cover && istanbul-coveralls" }, "dependencies": {}, "devDependencies": { "eslint": "^1.10.3", "eslint-config-gulp": "^2.0.0", "expect": "^1.16.0", "istanbul": "^0.4.3", "istanbul-coveralls": "^1.0.3", "jscs": "^2.3.5", "jscs-preset-gulp": "^1.0.0", "mocha": "^2.4.5" }, "keywords": [ "gulp", "extensions", "filepath", "basename" ] } replace-ext-1.0.0/test/000077500000000000000000000000001275447731700147215ustar00rootroot00000000000000replace-ext-1.0.0/test/.eslintrc000066400000000000000000000000351275447731700165430ustar00rootroot00000000000000{ "extends": "gulp/test" } replace-ext-1.0.0/test/main.js000066400000000000000000000027311275447731700162060ustar00rootroot00000000000000'use strict'; var path = require('path'); var expect = require('expect'); var replaceExt = require('../'); describe('replace-ext', function() { it('returns a valid replaced extension on long path', function(done) { var fname = path.join(__dirname, './fixtures/test.coffee'); var expected = path.join(__dirname, './fixtures/test.js'); var result = replaceExt(fname, '.js'); expect(result).toEqual(expected); done(); }); it('returns a valid replaced extension on basename', function(done) { var fname = 'test.coffee'; var expected = 'test.js'; var result = replaceExt(fname, '.js'); expect(result).toEqual(expected); done(); }); it('should not return a valid replaced extension on empty string', function(done) { var fname = ''; var expected = ''; var result = replaceExt(fname, '.js'); expect(result).toEqual(expected); done(); }); it('returns a valid removed extension on long path', function(done) { var fname = path.join(__dirname, './fixtures/test.coffee'); var expected = path.join(__dirname, './fixtures/test'); var result = replaceExt(fname, ''); expect(result).toEqual(expected); done(); }); it('returns a valid added extension on long path', function(done) { var fname = path.join(__dirname, './fixtures/test'); var expected = path.join(__dirname, './fixtures/test.js'); var result = replaceExt(fname, '.js'); expect(result).toEqual(expected); done(); }); });