Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pull-sort

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pull-sort - npm Package Compare versions

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()
})
)
})
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc