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

@uvalib/data-wrap

v0.2.18

Published

Webcomponent data-wrap following open-wc recommendations

Readme

EventsData Class Usage

The EventsData class is part of the data-wrap package and is used to fetch event data from the LibCal API. It allows you to retrieve and work with event information, providing options to customize your requests with various parameters.

Installation

You can install the data-wrap package using npm:


npm install data-wrap


Importing EventsData

To use the EventsData class in your project, import it as follows:


import { EventsData } from 'data-wrap';


Constructor Parameters

When creating an instance of EventsData, you can provide an optional initialization object to configure your data fetching needs. The available parameters are:

  • calId (string): The calendar ID to fetch events from. Defaults to '4299' if not provided.
  • lid (string): The LibCal system ID (also referred to as iid). Defaults to '863' if not provided.
  • limit (number): The maximum number of events to fetch. Defaults to 100 if not provided.
  • category (string): The category ID to filter events by.
  • query (string): A search query to filter events.

Methods

fetchData()

Fetches the event data from the LibCal API based on the configured parameters. Returns a promise that resolves to an object containing:

  • items: An array of Event objects.
  • meta: Metadata about the fetched data (e.g., totalResults).

Example Usage

Below is an example of how to use the EventsData class to fetch and display events:


import { EventsData } from 'data-wrap';

const eventsData = new EventsData({ calId: '4299', // Optional: Calendar ID lid: '863', // Optional: LibCal system ID limit: 100, // Optional: Number of events to fetch category: '33496', // Optional: Category ID to filter events query: 'workshop', // Optional: Search query });

eventsData.fetchData().then(results => { console.log(results); // Process the results as needed results.items.forEach(event => { console.log(Title: ${event.title}); console.log(Start Time: ${new Date(event.start).toLocaleString()}); // Additional processing... }); }).catch(error => { console.error('Error fetching events:', error); });


HTML Example

You can also use the EventsData class in an HTML file with a script module:


Notes

  • Ensure that you have network access to the LibCal API and the necessary permissions to fetch data.
  • The API key used in the EventsData class is hardcoded. If you need to use a different API key, you should modify the class accordingly.

API Reference

EventsData Class

Properties

  • category?: string
  • calId: string (default: '4299')
  • lid: string (default: '863')
  • limit: number (default: 100)
  • query?: string

Methods

  • fetchData(): Promise<{ items: Event[], meta: any }>

Event Object

An Event object returned in the items array has the following properties:

  • id: number
  • title: string
  • allday?: boolean
  • start?: number (timestamp)
  • end?: number (timestamp)
  • description?: string
  • link?: string
  • location?: string
  • campusLocation?: string
  • category?: string
  • owner?: string
  • calendar?: { name: string; url: string }
  • registration?: boolean
  • registrationOpen?: boolean
  • registrationClosed?: boolean
  • seats?: number
  • seatsTaken?: number
  • physicalSeats?: number
  • physicalSeatsTaken?: number
  • onlineSeats?: number
  • onlineSeatsTaken?: number
  • waitList?: boolean
  • image?: string
  • futureDates?: { id: number; start: number }[]
  • registrationCost?: number
  • moreInfo?: string
  • setupTime?: number
  • teardownTime?: number

Contributing

If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the project's GitHub repository.