You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

gulp-revert-path

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-revert-path - npm Package Compare versions

Comparing version
1.0.1
to
1.1.0
+9
-4
index.js
'use strict';
var through = require('through2');
module.exports = function () {
module.exports = function (reversions) {
reversions = typeof reversions === 'number' ? reversions : 1;
return through.obj(function (file, enc, cb) {
var history = file.history;
var highestIndex = history.length - 1;
if (history.length > 1) {
history.pop();
file.path = history[history.length - 1];
if (reversions > highestIndex) {
reversions = highestIndex;
}
history.splice(-reversions, reversions);
file.path = history[history.length - 1];
cb(null, file);
});
};
{
"name": "gulp-revert-path",
"version": "1.0.1",
"version": "1.1.0",
"description": "Revert the previous `file.path` change",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -5,3 +5,3 @@ # gulp-revert-path [![Build Status](https://travis-ci.org/sindresorhus/gulp-revert-path.svg?branch=master)](https://travis-ci.org/sindresorhus/gulp-revert-path)

Many plugins change the `file.path` somehow. Most commenly the file extension. For example `gulp-babel` changes `.jsx` extensions to `.js` since it compiles JSX. Sometimes that's undesirable though. This plugin makes it easy to revert the path change.
Many plugins change the `file.path` somehow. Most commonly the file extension. For example `gulp-babel` changes `.jsx` extensions to `.js` since it compiles JSX. Sometimes that's undesirable though. This plugin makes it easy to revert the path change.

@@ -22,2 +22,3 @@

var revertPath = require('gulp-revert-path');
var rename = require('gulp-rename');

@@ -30,7 +31,32 @@ gulp.task('default', function () {

});
gulp.task('es2015', function () {
return gulp.src('src/app.txt')
.pipe(rename('src/app.jsx')) // file.path => src/app.jsx
.pipe(babel()) // file.path => src/app.js
.pipe(revertPath(2)) // file.path => src/app.txt
.pipe(gulp.dest('dist'));
});
```
## API
### revertPath(reversions)
#### reversions
Type: `number`
Default: `1`
Number of times to revert the path.
## Related
- [vinyl-paths](https://github.com/sindresorhus/vinyl-paths) - Get the file paths in a vinyl stream
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)