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

@switchfly/core-search-url

v1.2.0

Published

Build Switchfly shopping deep-link URLs from search parameters

Readme

@switchfly/core-search-url

Build Switchfly shopping deep-link URLs from search parameters.

Getting location tokens

Location tokens (e.g. |city:7321, |airport:LAX, |hotel:abc123) are required for the location and fromLocation parameters. They are returned by the Switchfly locations autocomplete API:

GET /apps/api/locations/?locationType=DESTINATION&productTypes=ROOM&searchQuery=san+diego

Each result includes a search field — that value is the token to pass to buildUrl. You can query this API directly or use the @switchfly/sdk locations client if available.

Install

npm install @switchfly/core-search-url

Usage

import { buildUrl } from '@switchfly/core-search-url';

const url = buildUrl(
  {
    type: 'HOTEL',
    location: '|city:7321',
    fromDate: '06/01/2026',
    toDate: '06/05/2026',
    numAdults: 2,
  },
  {
    targetUrl: 'https://arrivals.switchfly.com',
    cobrand: 'aav',
  }
);

console.log(url.toString());
// https://arrivals.switchfly.com/shopping/search/?clear=true&room1=true&...

API

buildUrl(searchInfo, config)

Returns a URL object representing the deep link.


searchInfo

| Parameter | Type | Required | Description | |---|---|---|---| | type | 'HOTEL' \| 'AIR' \| 'CAR' \| 'ACTIVITY' \| 'BUNDLE' | ✅ | Product type | | bundleTypes | string[] | BUNDLE only | e.g. ['AIR', 'HOTEL'] | | location | string | ✅ | Destination token (e.g. '\|city:7321', '\|airport:LAX') | | fromLocation | string | AIR / CAR | Origin token | | fromDate | Date \| string | ✅ | Check-in / departure (MM/DD/YYYY or Date) | | toDate | Date \| string | | Check-out / return | | numAdults | number | | Adults (default: 2) | | childAges | number[] | | Child ages. For AIR: 0 = infant in seat, 1 = infant in lap | | rooms | object[] | | Per-room traveler config for multi-room hotel searches | | roundtrip | boolean | AIR | true = roundtrip, false = one-way | | serviceClass | string | AIR | e.g. 'coach', 'business' (default: 'coach') | | airline | string | AIR | Airline code filter | | directOnly | boolean | AIR | Nonstop flights only | | fromTime | number | CAR | Pickup hour 0–23 (default: 12) | | toTime | number | CAR | Dropoff hour 0–23 (default: 12) | | driverAge | number | CAR | Driver age | | driverAgeDefault | boolean | CAR | Use platform default driver age | | numRooms | number | HOTEL | Number of rooms | | switchflyId | string | | Hotel or activity ID — triggers redirect to details page | | crsName | string | ACTIVITY | CRS name (required with switchflyId for activities) | | activities | object[] | ACTIVITY | [{ activityId, crsName }] for multi-activity | | partialRoomStay | boolean | BUNDLE | Enable partial hotel stay | | partialCheckIn | Date \| string | BUNDLE | Partial stay check-in | | partialCheckOut | Date \| string | BUNDLE | Partial stay check-out |


config

| Parameter | Type | Description | |---|---|---| | targetUrl | string | Base URL of the Switchfly booking platform ✅ | | cobrand | string | Cobrand identifier (appended as nav=) | | originUrl | string | Referring page URL (for analytics) | | discountCode | string | Discount / promo code | | currency | string | 3-letter ISO currency code (e.g. 'USD') | | languageId | number | Language ID | | utmSource | string | UTM source | | utmMedium | string | UTM medium | | utmCampaign | string | UTM campaign | | utmContent | string | UTM content | | trackId | number | Track ID | | hotel_id | string | Hotel ID override | | redirect_to_hotel_details | boolean | Redirect to hotel details page | | activity_id | string | Activity ID override | | activity_crs | string | Activity CRS name | | redirect_to_activity_details | boolean | Redirect to activity details page |


Examples

Hotel search

buildUrl(
  { type: 'HOTEL', location: '|city:7321', fromDate: '06/01/2026', toDate: '06/05/2026' },
  { targetUrl: 'https://arrivals.switchfly.com', cobrand: 'aav' }
);

Round-trip flight

buildUrl(
  {
    type: 'AIR',
    location: '|airport:JFK',
    fromLocation: '|airport:LAX',
    fromDate: '06/01/2026',
    toDate: '06/08/2026',
    roundtrip: true,
    serviceClass: 'business',
  },
  { targetUrl: 'https://arrivals.switchfly.com' }
);

Air + Hotel bundle

buildUrl(
  {
    type: 'BUNDLE',
    bundleTypes: ['AIR', 'HOTEL'],
    location: '|city:7321',
    fromLocation: '|airport:LAX',
    fromDate: '06/01/2026',
    toDate: '06/08/2026',
    roundtrip: true,
  },
  { targetUrl: 'https://arrivals.switchfly.com', cobrand: 'aav' }
);

Featured hotel (redirect to details)

buildUrl(
  { type: 'HOTEL', location: '|city:7321', fromDate: '06/01/2026', toDate: '06/05/2026', switchflyId: 'abc123' },
  { targetUrl: 'https://arrivals.switchfly.com' }
);

License

UNLICENSED — internal Switchfly use.