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

loystore

v0.2.8

Published

Make your firestore quickly and easily.

Readme

Loystore

Make your firestore quickly and easily.

Example

import firebase from 'firebase';
import 'firebase/firestore';
import Loystore from 'loystore';

const db = firebase.firestore();

type Post = {
  title: string;
  description: string;
  rating: number;
  author: string;
};

const post = new Loystore(db, 'posts');

async function get(documentID: string) {
  try {
    const data = await post.get(documentID);
    return data; /**
                  * {
                  *   id: documentID,
                  *   data: {
                  *     title: 'Hello',
                  *     description: 'Hello Loystore',
                  *     rating: 10,
                  *     author: 'Kim'
                  *   }
                  * }
                  */
  } catch (err) {
    console.log(err);
  }
}

async function set(documentID: string, data: Post, merge: boolean) {
  try {
    const data = await post.set(documentID, data, merge);
    return data; // { id: documentID, data: data }
  } catch (err) {
    console.log(err);
  }
}

async function add(data: Post) {
  try {
    const data = await post.add(data);
    return data; // { id: 1rcI0EZrzQ0zoWNwWbUY, data: data }
  } catch (err) {
    console.log(err);
  }
}

async function update(documentID: string, data: Post) {
  try {
    const data = await post.update(documentID, data);
    return data; // { id: documentID, data: data }
  } catch (err) {
    console.log(err);
  }
}

async function delete(documentID) {
  try {
    const data = await post.delete(documentID);
    return data; // true
  } catch (err) {
    console.log(err);
  }
}

async function getAll(limit: number) {
  try {
    // const data = await post.getAll(); // limit default 50.
    const data = await post.getAll(limit);
    return data; /**
                  * [
                  *   {
                  *     id: '1rcI0EZrzQ0zoWNwWbUY',
                  *     data: {
                  *       title: 'Hello',
                  *       description: 'Hello loystore.',
                  *       rating: 10,
                  *       author: 'Kim'
                  *     }
                  *   },
                  *   {
                  *     id: '3OlEQ0Md1fgpv2gznGg3',
                  *     data: {
                  *       title: 'Good morning',
                  *       description: 'Good morning everyone!',
                  *       rating: 0,
                  *       author: 'John'
                  *     }
                  *   },
                  *   {
                  *     id: '8qVKhEcULd6U9Dcfm0ae',
                  *     data: {
                  *       title: 'Good night',
                  *       description: 'Good night everyone!',
                  *       rating: 5,
                  *       author: 'Jack'
                  *     }
                  *   }
                  * ];
                  */
  } catch (err) {
    console.log(err);
  }
}

const query1 = post.collection.where('rating', '<=', 8).orderBy('author', 'desc');
async function getFilter(query, limit: number) {
  // const data = await post.getFilter(query); // limit default 50.
  const data = await post.getFilter(query, limit);
  return data; /**
                * [
                *   {
                *     id: '3OlEQ0Md1fgpv2gznGg3',
                *     data: {
                *       title: 'Good morning',
                *       description: 'Good morning everyone!',
                *       rating: 0,
                *       author: 'John'
                *     }
                *   },
                *   {
                *     id: '8qVKhEcULd6U9Dcfm0ae',
                *     data: {
                *       title: 'Good night',
                *       description: 'Good night everyone!',
                *       rating: 5,
                *       author: 'Jack'
                *     }
                *   }
                * ];
                */
}
// getFilter(query1, 50); // example

const query2 = post.collection.where('rating', '<=', 8).orderBy('author', 'asc');
async function getPage(query, limit: number, offset: number) { // next is lastDoc
  try {
    const data1 = await post.getPage(query, 100); 
    // Get 1 ~ 100 documents.

    const data2 = await post.getPage(query, 100, 101);
    // Get 101 ~ 200 documents.

    const next = data2.next;
    const data3 = await post.getPage(query, 10, 10, next);
    // Get 10 ~ 20 documents starting with next(Doc).

    return [...data1, ...data2, ...data3, ...data4]; // 1 ~ 200 + 210 ~ 220 documents.
  } catch (err) {
    console.log(err);
  }
}
// getPage(query2, 20); // example

// Only working on firebase-admin instance.
async function getCollections() {
  try {
    const data = await post.getCollections();
    return data; // posts collections.
  } catch (err) {
    console.log(err);
  }
}

0.2.5

  • Modify getPage parameters
 // before
 getPage(query, startAt, limit, next);

 // after
 getPage(query, limit, offset = 1, next);