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

@cape-io/rg-utils

v7.3.0

Published

Tools and utilities for R&G + D&L item processing.

Downloads

1,989

Readme

rg-utils

Tools and utilities for R&G + D&L item ID and Category processing.

ID Requirements

{prefix}-{patternId}-{colorId}

Prefer using a patternSeparator (-) between prefix and patternId when creating new prefix options.

Options are defined in lib/cat-ids.js.

  • prefix valid options are [null, rg, p, l, dl, dli, dlt, pf, pft, pfi]. Max of 16 options including null (textile). 4 bits.
  • patternId NUMBER must be less than 16777215. 24 bits.
  • colorId NUMBER must be less than 99. Note this is smaller than the 7 bit max of 127. We assume it always two digits/chars long. Id 99 is reserved for color items that are the same as (wire/sample) the pattern.

ID Processing

  • getItemIdInfo(itemItemNumber) Parsing of itemId into an object { patternId, colorId, otherId, invalidId: Boolean }
  • String must start with a valid patternId or it will not be processed.
  • Pattern numbers over 9 are allowed. Pattern must have three or more letter chars.
  • Double colorId will be turned into 01|02. Able to parse as 01/02, 01_02, or 01-02. Will mark as invalidId if used _ or /.
  • DL patternId prefix can have hyphen or not. Does not force to have or not.
  • otherId is joined with underscore.
  • hasValidIdChars() uses a regex expression to check if the id is in a known format.

Category Processing

Primary categories in the data should be fabric, trim, accessory.

ID Number

If under 14 bits just use the number 16384.

Need to fit into smaller than 24 bits. Larger numbers almost always have zeros. How to compress out the zeros?

910003 = source 910, size 6, style 3

28 bits

  • source = 11 sourceNum | length
    • sourceNum = 9 bits (511) Assume 489 is min for 5 length and higher?
    • length = 2 bits 0:4, 1:5, 2:6, 3:7
  • style = 7 bits (127) Assume it's 99 or smaller
  • colorId = 7
  • prefix = 3

ColorItem <-> Pattern

  • categoryId is a property of colorItem based on pattern.categoryId. Used for searches.

Notes

  • appId is the web application id.
  • appCode is the backend data feed application code. Should really be dataFeedCode or something like that.

Changelog

v7

  • searchHashParse() should return categoryId when passed valid itemId
  • Updated fields Using categoryId & pattern.imageUrl
  • added fixItemId(itemNumber) -> itemId
  • Remove extra junk.

v6

  • 6.1 Return simpleSearch prop on parse.

  • Switch all instances of patternNumber to patternInt.

  • dl prefix items are not always textile.

  • getCategory(item) no longer send categories to it first, just item.

  • v5.4.0 pager data

  • 5.x Includes fields and categories as code.

  • 4.x Allows colorIds from 63 to 99.

npm run up to update field & category data.