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

purchasing-power-parity-advanced

v1.0.0

Published

An advanced PPP conversion calculator with optional flags and country names, and country code listing functions.

Readme

purchasing-power-parity-advanced

An advanced Node.js module and CLI for converting currency amounts between countries using PPP (Purchasing Power Parity), with optional flags, country names, and country code lookup.


Installation

# Install globally (CLI)
npm install -g purchasing-power-parity-advanced

# Or install locally in your project
npm install purchasing-power-parity-advanced

CLI Usage

Once installed globally, use the ppp-calculator command:

ppp-calculator <ORIG_CODE> <AMOUNT> <TARGET1,TARGET2,...>

Example:

ppp-calculator USA 100 CAN,GBR,IND

Sample output:

{
  "origin": {
    "code": "USA",
    "amount": 100,
    "flag": "🇺🇸",
    "currencyCode": "USD",
    "currencyName": "US Dollar",
    "currencySymbol": "$",
    "countryName": "United States"
  },
  "results": [
    {
      "code": "CAN",
      "amount": 114.23,
      "flag": "🇨🇦",
      "currencyCode": "CAD",
      "currencyName": "Canadian Dollar",
      "currencySymbol": "$",
      "countryName": "Canada"
    },
    …
  ]
}

Note: CLI always includes flags and names. For more control, use the programmatic API.


Programmatic API

Import and use in your Node.js code:

const {
  convertPPP,
  listCountries,
  listCountryCodes
} = require('purchasing-power-parity-advanced');

1) listCountries()

Returns a sorted array of ISO3 country codes available for PPP conversion.

(async () => {
  const codes = await listCountries();
  console.log(codes); // ['AFG','ALB','DZA',…,'USA',…]
})();

2) listCountryCodes()

Returns an array of all countries with ISO3, ISO2 codes and full names.

const allCountries = listCountryCodes();
console.log(allCountries[0]);
// { iso3: 'AFG', iso2: 'AF', name: 'Afghanistan' }

3) convertPPP(originCode, amount, targetCodes, options?)

Convert an amount from one country to multiple target countries.

Signature:

async function convertPPP(
  originCode: string,       // ISO3 origin country code, e.g. 'USA'
  amount: number,           // amount in origin currency
  targetCodes: string[],    // array of ISO3 target codes, e.g. ['CAN','GBR']
  options?: {
    includeFlags?: boolean;   // default: true
    includeNames?: boolean;   // default: true
  }
): Promise<{
  origin: {
    code: string;
    amount: number;
    flag?: string;
    currencyCode: string | null;
    currencyName: string | null;
    currencySymbol: string | null;
    countryName?: string;
  };
  results: Array<{
    code: string;
    amount: number | null;
    flag?: string;
    currencyCode: string | null;
    currencyName: string | null;
    currencySymbol: string | null;
    countryName?: string;
  }>;
}>

Example:

(async () => {
  // Basic conversion (flags + names enabled)
  let res = await convertPPP('USA', 100, ['CAN','GBR']);

  // Disable flags and names
  res = await convertPPP('USA', 100, ['CAN','GBR'], {
    includeFlags: false,
    includeNames: false
  });

  console.dir(res, { depth: null });
})();

License

MIT