Comparing version 1.0.1 to 1.0.2
14
index.js
var Source = require('pull-defer/source') | ||
var pull = require('pull-stream') | ||
var error = require('pull-stream/sources/error') | ||
var values = require('pull-stream/sources/values') | ||
var collect = require('pull-stream/sinks/collect') | ||
module.exports = function (compare) { | ||
var source = Source() | ||
var sink = pull.collect(function (err, ary) { | ||
source.resolve(pull.values(ary.sort(compare))) | ||
var sink = collect(function (err, ary) { | ||
if (err) { | ||
return source.resolve(error(err)) | ||
} | ||
source.resolve(values(ary.sort(compare))) | ||
}) | ||
@@ -17,3 +22,2 @@ | ||
} | ||
} |
{ | ||
"name": "pull-sort", | ||
"description": "", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"homepage": "https://github.com/dominictarr/pull-sort", | ||
@@ -11,7 +11,7 @@ "repository": { | ||
"dependencies": { | ||
"pull-defer": "^0.2.2", | ||
"pull-stream": "^3.6.0" | ||
"pull-defer": "^0.2.3", | ||
"pull-stream": "^3.6.9" | ||
}, | ||
"devDependencies": { | ||
"tape": "^4.6.3" | ||
"tape": "^4.9.1" | ||
}, | ||
@@ -18,0 +18,0 @@ "scripts": { |
@@ -1,13 +0,12 @@ | ||
var test = require('tape') | ||
var tape = require('tape') | ||
var sort = require('../') | ||
var pull = require('pull-stream') | ||
test('Should sort a stream of values', function(t) { | ||
tape('sort an array', function (t) { | ||
pull( | ||
pull.values([7,3,5,2]), | ||
sort( function(a, b) {return b - a} ), | ||
pull.collect( function(err, values) { | ||
for(var i=0; i<values.length; ++i) { | ||
t.equal(values[i], [7, 5, 3, 2][i]) | ||
} | ||
pull.values([3, 2, 1]), | ||
sort(), | ||
pull.collect(function (err, values) { | ||
t.notOk(err) | ||
t.deepEqual(values, [1, 2, 3]) | ||
t.end() | ||
@@ -18,1 +17,13 @@ }) | ||
tape('do not swallow errors', function (t) { | ||
var error = new Error('Something went wrong') | ||
pull( | ||
pull.error(error), | ||
sort(), | ||
pull.collect(function (err, values) { | ||
t.deepEqual(err, error) | ||
t.end() | ||
}) | ||
) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3000
42
Updatedpull-defer@^0.2.3
Updatedpull-stream@^3.6.9