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

@datafire/wheretocredit

v3.0.0

Published

DataFire integration for Where to Credit API

Readme

@datafire/wheretocredit

Client library for Where to Credit API

Installation and Usage

npm install --save @datafire/wheretocredit
let wheretocredit = require('@datafire/wheretocredit').create({
  "api-key": ""
});

.then(data => {
  console.log(data);
});

Description

The Where to Credit API provides mileage earning calculations for frequent flyer programs around the world.

Actions

api.1.0.calculate.post

Calculates the number of miles earned for every frequent flyer program.

wheretocredit.api.1.0.calculate.post({}, context)

Input

  • input object
    • body array: Collection of Itinerary to allow multiple frequent flyer mile or point calculations at once.

Output

api.1.0.programs.get

Lists all supported frequent flyer programs.

wheretocredit.api.1.0.programs.get(null, context)

Input

This action has no parameters

Output

Definitions

CalculateItineraryProgramResult

  • CalculateItineraryProgramResult object
    • airlines array: Two-letter IATA carrier codes that are associated with the frequent flyer program.
      • items string
    • id string: Unique identifier for the frequent flyer program. See Programs API.
    • name string: Frequent flyer program name. See Programs API.
    • revenueBased boolean: Indicates that the itinerary includes revenue-based miles earnings.
    • unpublished boolean: Indicates that the itinerary may be missing miles due to unpublished earning rates from the program.
    • value integer: Total redeemable miles or points earned for the frequent flyer program.

CalculateItineraryResult

  • CalculateItineraryResult object
    • id string: Unique identifier provided for this itinerary.
    • totals array: Total miles earned for each frequent flyer program.

CalculateResult

  • CalculateResult object
    • errorMessage string: Error message if the API call was not successful.
    • success boolean: Indicates whether the API call was successful.
    • value CalculateItineraryResult

Itinerary

  • Itinerary object
    • baseFareUSD number: Amount in USD that will be used to calculate revenue program mileage earning. This amount should generally include carrier imposed surcharges but exclude other taxes. Default is 0.
    • id string: Unique identifier for this itinerary that will be passed back to help correlate a result.
    • segments required array: Every flight transfer or stopover should be considered a separate segment.
    • ticketingCarrier string: Two-letter IATA carrier code for the ticketing or plating airline. This is used for revenue programs (i.e. UA, DL, B6). Leaving this value blank will exclude revenue programs.

Program

  • Program object
    • airlines array: Two-letter IATA carrier codes that are associated with the frequent flyer program.
      • items string
    • denomination string: Name of the unit of a mile or point.
    • fullName string: Full name of the frequent flyer program including the airline, if applicable.
    • id string: Unique identifier for the frequent flyer program.
    • programName string: Name of the frequent flyer program.
    • tierNames array: Name of each tier level for the frequent flyer program.
      • items string

Segment

  • Segment object
    • bookingClass required string: Single-letter booking class used to determine the earning rate for the flight segment.
    • carrier required string: Two-letter IATA carrier code for the marketing airline. This is used to determine which earnings chart will be applied for this segment.
    • departure string: The date on the flight will depart from the origin to go to the destination. This is used to determine which earnings chart will be in effect at time of departure.
    • destination required string: Three-letter IATA airport code to which the flight is going.
    • distance number: The number of miles for this flight segment. Otherwise, distance is calculated using the great-circle distance between the origin and destination and may not match other data sources exactly.
    • flightNumber integer: The airline identifier for the flight segment, most commonly (but not always) a number and is used for earning charts that are restricted to specific flight numbers.
    • operatingCarrier string: Two-letter IATA carrier code for the operating airline. This value is only used when earning is based on marketing carrier but restricted to a specific operating carrier. Leaving this value blank will assume the flight is operated by the marketing carrier.
    • origin required string: Three-letter IATA airport code from which the flight will depart.