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 🙏

© 2025 – Pkg Stats / Ryan Hefner

zunzuna

v1.3.3

Published

Notify user when to book uber to reach destination on time.

Downloads

75

Readme

zunzuna

Notify user when to book uber to reach destination on time. :)

Install

In your node.js project, run:

npm install --save zunzuna

Quickstart

Run in your terminal:

node examples/template.js

NOTE: set GOOGLE_API_KEY & UBER_API_KEY environment variables

Basic Example

NOTE: update event.time

const Zunzuna = require('zunzuna');

const zunzuna = new Zunzuna();

const event = {
	"id" : "1234",
    "source": "Bengaluru Airport",
    "destination": "Soul Space Spirit, Bengaluru",
    "time":  "2016-05-04T02:33:17+05:30",
    "emailid": "test@test.com"
};

try {
    zunzuna.createEvent(event);
} catch (e) {
    console.log("Error occured: " + e.message);
}

zunzuna.on('notify', (params) => {
    console.log(params);
});

Advance Example

node examples/messenger.js

Special Thanks to node-wit

####Messenger API integration with wit.ai and zunzuna

We assume you have:

  • a Wit.ai bot setup (https://wit.ai/docs/quickstart)
  • a Messenger Platform setup (https://developers.facebook.com/docs/messenger-platform/quickstart)

You need to npm install the following dependencies: body-parser, express, request, node-wit, zunzuna

  1. npm install body-parser express request node-wit zunzuna

  2. Download and install ngrok from https://ngrok.com/download

  3. ./ngrok -http 8080

  4. set following environment variables

    WIT_TOKEN=your_access_token

    FB_PAGE_ID=your_page_id

    FB_PAGE_TOKEN=your_page_token

    FB_VERIFY_TOKEN=verify_token

    GOOGLE_API_KEY=your_google_api_key

    UBER_API_KEY=your_uber_api_key

    PORT=8080

  5. Subscribe your page to the Webhooks using verify_token and https://<your_ngrok_io>/fb as callback URL.

  6. Talk to your bot on Messenger!

  7. You need to define the sories to get the appropriate context from wit.ai

For now you can use these wit.ai stories

For windows users, set the environment variables using settoken.bat file and run settoken.bat on cmd prompt

How Zunzuna works?

  • Get at the source (event.source), destination (event.destination), travel start time (event.startTravelAt) and email id (event.email) of an user event (event).
  • Fetch the total travel time (travelTime) to destination (destination) at this instance (event.requestedAt).
  • Set the maximum travel time (maxTravelTime) to (travelTime + maxDeviationToTravelTime = 60 mins )
  • Set the maximum buffer time (maxBufferTime = 10 mins)
  • Set the maximum time for the uber to reach source (maxWaitingTime = 15 mins)
  • Calculate the best time to send a notification to user for booking cab (sendNotificationAt())
  • Calculate the best time to fetch travel time from source to destination (getTravelTimeAt())

Algorithm

  1. set event.updateTravelTimeAt to currentTime and fetch the event.travelTime
  2. Calculate maxTravelTime = event.travelTime @ event.requestedAt + maxDeviationToTravelTime
  3. set event.updateTravelTimeAt to [event.startTravelAt - (maxBufferTime + maxTravelTime + maxWaitingTime)]
  4. set event.notificationTime to [event.startTravelAt - (maxBufferTime + event.travelTime + maxWaitingTime)]
  5. If the event.updateTravelTimeAt matches to currentTime, getTravelTime() [i.e update event.travelTime] and update event.notificationTime and calculate event.updateTravelTimeAt.
  6. If the event.udpateWaitingTimeAt matches to currentTIme, getWaitingTime() [i.e update event.waitingTime] and update event.notificationTime and calculate event.updateWaitingTime.
  7. If event.notificationTime matches to currentTime, send notification.

Assumptions

  • Google api polling will start at (maxTravelTime + maxWaitingTime + maxBufferTime)
  • Uber api polling will start at (notificationTime - startUberPolling)
  • Google api polling stops 5 mins prior to notificationTime
  • Uber api polls every 2 mins till the notificationTime
  • NOTE: Values can be changed from node_modules/zunzuna/lib/algo.js file