Socket
Socket
Sign inDemoInstall

gulp-sort

Package Overview
Dependencies
10
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 2.0.0

10

index.js

@@ -11,2 +11,3 @@ var through = require('through2');

var files = [];
var customSortFn;

@@ -21,2 +22,3 @@ if (typeof params === 'function') {

comparator = params.comparator || defaultComparator;
customSortFn = params.customSortFn;
}

@@ -28,3 +30,9 @@

}, function (cb) {
files.sort(comparator);
if (customSortFn) {
// expect customSortFn to return the files array
files = customSortFn(files, comparator);
} else {
// sort in-place
files.sort(comparator);
}
if (!asc) {

@@ -31,0 +39,0 @@ files.reverse();

7

package.json

@@ -5,3 +5,3 @@ {

"repository": "pgilad/gulp-sort",
"version": "1.1.1",
"version": "2.0.0",
"license": "MIT",

@@ -29,8 +29,9 @@ "author": {

"dependencies": {
"through2": "^0.6.5"
"through2": "^2.0.1"
},
"devDependencies": {
"gulp-util": "^3.0.4",
"mocha": "^2.1.0"
"mocha": "^2.1.0",
"stable": "^0.1.5"
}
}

@@ -28,3 +28,3 @@ # [gulp](https://github.com/wearefractal/gulp)-sort

.pipe(sort({
asc: false
asc: false
}))

@@ -47,2 +47,12 @@ .pipe(gulp.dest('./build/js'));

.pipe(gulp.dest('./build/js'));
// sort with a custom sort function
var stable = require('stable');
gulp.src('./src/js/**/*.js')
.pipe(sort({
customSortFn: function(files, comparator) {
return stable(files, comparator);
}
}))
.pipe(gulp.dest('./build/js'));
```

@@ -62,4 +72,17 @@

### customSortFn
Use `customSortFn` in order to control the sorting yourself (useful for stable sorts).
`customSortFn` signature is as follows:
`customSortFn(<files>, <comparator>)`
- `files` being the vinyl file objects that were passed in
- `comparator` is the default comparator used, or a custom one that was passed as param
This function is expected to return back the sorted list of files.
## License
MIT ©[Gilad Peleg](http://giladpeleg.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc