npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

range-index

v0.5.2

Published

levelup based range index

Downloads

58

Readme

range

levelup based range index

install

npm install [--save/--save-dev] range-index

examples

data set

| ID | NAME | AGE | SEX | | :--: | :--: | :-: | :-: | | 1 | Divina Ventimiglia | 7 | F | | 2 | Nakisha Robuck | 54 | F | | 3 | Amira Markus | 18 | F | | 4 | Mohamed Kincannon | 60 | M | | 5 | Juana Ardon | 23 | F | | 6 | Hyon Davie | 60 | F | | 7 | Estell Cromer | 18 | F | | 8 | Jacob Neeley | 13 | M | | 9 | Carlene Weatherman | 42 | F | | 10 | Carie Markland | 7 | F |

age/id range index

| AGE | ID | | :-: | :-------: | | 7 | 1, 10 | | 13 | 8 | | 18 | 3, 7 | | 23 | 5 | | 42 | 9 | | 54 | 2 | | 60 | 4, 6 |


as seen in Database Indexes for The Inquisitive Mind

data set

| DOCUMENT | COUNTRIES | | :--------: | :-----------------------------: | | A | Australia, Canada, Portugal | | B | Canada, Portugal, Togo | | C | Algeria, Canada, Portugal, Togo | | D | Algeria, Canada, Togo | | E | Canada, Togo | | F | Togo |

country/document range index

| COUNTRY | DOCUMENTS | | :-------: | :---------------------: | | Algeria | C, D | | Australia | A | | Canada | A, B, C, D, E | | Portugal | A, B, C | | Togo | B, C, D, E, F |

api

var range = require('range-index');

index range(string: location)

var age = range('path/to/location');

void index.put(string/number: value, *: key, function: callback)

age.put(18, 7, function (e) {
  if(e) throw e;
  console.log('index saved successfully');
});

countries.put('Portugal', 'A', function (e) {
  if(e) throw e;
  console.log('index saved successfully');
});

stream index.get(string/number: index)

var user = age.get(18);

user.on('data', function (data) {
  assert(data.value == [3, 7]);
  assert(data.key == 18);
});

user.on('error', function (e) {
  throw e;
});

user.on('close', function () {
  console.log('Stream closed')
});

user.on('end', function () {
  console.log('Stream closed')
});

var country = countries.get('Portugal');

user.on('data', function (data) {
  assert(data.value == ['A', 'B', 'C']);
  assert(data.key == 'Portugal');
});

user.on('error', function (e) {
  throw e;
});

user.on('close', function () {
  console.log('Stream closed')
});

user.on('end', function () {
  console.log('Stream closed')
});

index.all()

var users = age.all();

users.on('data', function (data) {
  console.log('Age: ', data.key, 'ID\'s: ', data.value)
});

user.on('error', function (e) {
  throw e;
});

user.on('close', function () {
  console.log('Stream closed')
});

user.on('end', function () {
  console.log('Stream closed')
});

index.from(start)

var users = age.from(54);

users.on('data', function (data) {
  console.log('Age: ', data.key, 'ID\'s: ', data.value)
});

user.on('error', function (e) {
  throw e;
});

user.on('close', function () {
  console.log('Stream closed')
});

user.on('end', function () {
  console.log('Stream closed')
});

returned indexes:

| AGE | ID | | :-: | :-------: | | 54 | 2 | | 60 | 4, 6 |


var from_countries = countries.from('P');

from_countries.on('data', function (data) {
  console.log('Age: ', data.key, 'ID\'s: ', data.value)
});

from_countries.on('error', function (e) {
  throw e;
});

from_countries.on('close', function () {
  console.log('Stream closed')
});

from_countries.on('end', function () {
  console.log('Stream closed')
});

returned indexes:

| COUNTRY | DOCUMENTS | | :-------: | :---------------------: | | Portugal | A, B, C | | Togo | B, C, D, E, F |

index.between(start, end)

var users = age.between(13, 23);

users.on('data', function (data) {
  console.log('Age: ', data.key, 'ID\'s: ', data.value)
});

user.on('error', function (e) {
  throw e;
});

user.on('close', function () {
  console.log('Stream closed')
});

user.on('end', function () {
  console.log('Stream closed')
});

returned indexes:

| AGE | ID | | :-: | :-------: | | 13 | 8 | | 18 | 3, 7 | | 23 | 5 |


var between_countries = countries.between('A', 'C');

from_countries.on('data', function (data) {
  console.log('Age: ', data.key, 'ID\'s: ', data.value)
});

from_countries.on('error', function (e) {
  throw e;
});

from_countries.on('close', function () {
  console.log('Stream closed')
});

from_countries.on('end', function () {
  console.log('Stream closed')
});

returned indexes:

| COUNTRY | DOCUMENTS | | :-------: | :---------------------: | | Algeria | C, D | | Australia | A |

index.until(end)

var users = age.until(18);

users.on('data', function (data) {
  console.log('Age: ', data.key, 'ID\'s: ', data.value)
});

user.on('error', function (e) {
  throw e;
});

user.on('close', function () {
  console.log('Stream closed')
});

user.on('end', function () {
  console.log('Stream closed')
});

returned indexes:

| AGE | ID | | :-: | :-------: | | 7 | 1, 10 | | 13 | 8 | | 18 | 3, 7 |


var from_countries = countries.until('P');

from_countries.on('data', function (data) {
  console.log('Age: ', data.key, 'ID\'s: ', data.value)
});

from_countries.on('error', function (e) {
  throw e;
});

from_countries.on('close', function () {
  console.log('Stream closed')
});

from_countries.on('end', function () {
  console.log('Stream closed')
});

returned indexes:

| COUNTRY | DOCUMENTS | | :-------: | :---------------------: | | Algeria | C, D | | Australia | A | | Canada | A, B, C, D, E |

test Build Status

npm test

license

MIT