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 🙏

© 2024 – Pkg Stats / Ryan Hefner

skucon-decomposer

v1.1.4

Published

A simple **npm package** to decompose Android/iOS opinionated SKUs in my convetion/pattern, to allow information changes and additions to the SKUs easily and future-proofable.

Downloads

6

Readme

SKUcon-Decomposer

npm version PRs Welcome TypeScript

A simple npm package to decompose Android/iOS opinionated SKUs in my convetion/pattern, to allow information changes and additions to the SKUs easily and future-proofable.

In this pattern, each information in the SKU string isn't important, as it searchs for the key of the info to get its value. '_' separates the key from the value. '.' separates the key-value pair from another.

You can easily add a field you wish to the pattern, wrapping the decomposeSku() function and adding your fields (read index.ts to see how it's done there).

SKU full example: 'app_myapp.os_ios.id_license.id2_0.t_3m.loc_br.v_1'

export interface DescomposedSku {
  // App identifier. To make easier the identification of the SKU from other apps. Optional.
  app?: string;
  // Operational System.
  os: 'android' | 'ios';
  // The duration of the subscription if it's one (you may pass like '3m' for 3 months), or 'consumable' if it's one. It's the `t` field with a better name.
  duration: string | 'consumable';
  // The main identifier of the SKU.
  id: string;
  // An additional identifier for the "same" product. Useful to have multiple active subscriptions of the same product for different targets.
  id2?: string;
  // Locale. Lowercase [ISO 3166–1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) or another pattern you may preffer. Useful for iOS specific pricing. Optional. Omitting it means default / international value.
  loc?: string;
  // The version of this SKU. Useful for deprecating an older one. A number.
  v: number;
  // The raw SKU you inputted. Useful for retrieving it after some filtrations.
  sku: string;
}

decomposeSku(sku: string): DescomposedSku

The function to decompose the SKU.

As it may throw errors for missing required fields or invalid values, you should wrap it in a try/catch block and at least console.error() the error to know what is wrong in your SKU in dev environment. You should even send this error to your backend so you can fix the SKU asap, decreasing the UX and gain losses.

IAPHUB recommended!