
Security News
AI Agent Lands PRs in Major OSS Projects, Targets Maintainers via Cold Outreach
An AI agent is merging PRs into major OSS projects and cold-emailing maintainers to drum up more work.
level-indexer
Advanced tools
Generic indexer for leveldb. Only stores document keys for space efficiency.
Generic indexer for leveldb. Only stores document keys for space efficiency.
npm install level-indexer
var indexer = require('level-indexer')
// create a index (by country)
var country = indexer(db, ['country']) // index by country
country.add({
key: 'mafintosh',
name: 'mathias',
country: 'denmark'
})
country.add({
key: 'maxogden',
name: 'max',
country: 'united states'
})
var stream = country.find({
gte:{country:'denmark'},
lte:{country:'denmark'}
})
// or using the shorthand syntax
var stream = country.find('denmark')
stream.on('data', function(key) {
console.log(key) // will print mafintosh
})
The stored index is prefix with the index key names which means you can use the same levelup instance to store multiple indexes.
index = indexer(db, [prop1, prop2, ...], [options])Creates a new index using the given properties. Options include
{
map: function(key, cb) {
// map find results to another value
db.get(key, cb)
}
}
index.add(doc, [key], [cb])Add a document to the index. The document needs to have a key or provide one. Only the key will be stored in the index.
index.remove(doc, [key], [cb])Remove a document from the index.
index.key(doc, [key])Returns the used leveldb key. Useful if you want to batch multiple index updates together yourself
var batch = [{type:'put', key:index.key(doc), value:doc.key}, ...]
stream = index.find(options, [cb])Search the index. Use options.{gt,gte,lt,lte} to scope your search.
// find everyone in the age range 20-50 in denmark
var index = indexer(db, ['country', 'age'])
...
var stream = index.find({
gt: {
country: 'denmark',
age: 20
},
lt: {
country: 'denmark',
age: 50
}
})
Optionally you can specify the ranges using arrays
var stream = index.find({
gt: ['denmark', 20],
lt: ['denmark', 50]
})
Or if you do not care about ranges
var stream = index.find(['denmark', 20])
// equivalent to
var stream = index.find({
gte: ['denmark', 20],
lte: ['denmark', 20]
})
The stream will contain the keys of the documents that where found in the index.
Use options.map to map the to the document values.
Options also include the regular levelup db.createReadStream options.
If you set cb the stream will be buffered and passed as an array.
index.findOne(options, cb)Only find the first match in the index and pass that to the callbck
MIT
FAQs
Generic indexer for leveldb. Only stores document keys for space efficiency.
We found that level-indexer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
An AI agent is merging PRs into major OSS projects and cold-emailing maintainers to drum up more work.

Research
/Security News
Chrome extension CL Suite by @CLMasters neutralizes 2FA for Facebook and Meta Business accounts while exfiltrating Business Manager contact and analytics data.

Security News
After Matplotlib rejected an AI-written PR, the agent fired back with a blog post, igniting debate over AI contributions and maintainer burden.