New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

map-reduce

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

map-reduce - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

package.json
{
"name": "map-reduce",
"description": "map-reduce on leveldb",
"version": "1.0.2",
"version": "1.0.3",
"homepage": "https://github.com/dominictarr/map-reduce",

@@ -6,0 +6,0 @@ "repository": {

@@ -13,3 +13,3 @@ var MR = require('..')

var vowels = 'aeiou'.split('')
var vowels = 'AEIOU'.split('')

@@ -20,3 +20,3 @@ MR({

//console.log('map', ''+key,''+value)
if(~vowels.indexOf(key.toString().toLowerCase()))
if(~vowels.indexOf(''+key))
this.emit('vowel', value)

@@ -45,3 +45,3 @@ else

var puts = [], deletes = []
var i = 0
var sum = 0

@@ -55,6 +55,12 @@ times(26, 100, function (i) {

}, function () {
times(21, 100, function (i) {
var k = keys[i + 4]
deletes.push(k)
db.del(k)
times(26, 100, function (i) {
var k = keys[i - 1]
if(~vowels.indexOf(k)) {
deletes.push(k)
db.del(k)
} else {
sum += i
}
}, function () {
console.log('SUM', sum)
})

@@ -66,17 +72,28 @@ })

var _group, _vowels, _consonant
db.on('map-reduce:reduce:deletes', function (key, sum) {
console.log("REDUCE", key, sum)
return
if(key.length == 0) {
assert.equal(Number(sum), 300)
console.log('passed')
//mr.readStream({group: ['even']})
//.pipe(through(console.log))
} else if(key[0] == 'vowel')
assert.equal(Number(sum), 20)
else if(key[0] == 'consonant')
assert.equal(Number(sum), 20)
if(key.length == 0 && sum == 300)
_group = true
else if(key[0] == 'vowel' && sum === 0)
_vowels = true
else if(key[0] == 'consonant' && sum == 300)
_consonant = true
})
process.on('exit', function () {
assert(_group)
assert(_vowels)
assert(_consonant)
console.log('passed')
})
db.mapReduce.view('deletes', {start: [true]})
.on('data', function (data) {
console.log(''+data.key,''+data.value)
})
})
})

@@ -38,2 +38,7 @@

})
db.mapReduce.view('range', {start: [true]})
.on('data', function (data) {
console.log(''+data.value)
})
})
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