Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing style codes #1

Open
luqmaan opened this issue Jun 10, 2017 · 1 comment
Open

Parsing style codes #1

luqmaan opened this issue Jun 10, 2017 · 1 comment

Comments

@luqmaan
Copy link
Contributor

luqmaan commented Jun 10, 2017

Would you consider adding a function to parse style codes?

I have something that mostly works with some Shopify products: https://gist.github.com/luqmaan/f906f79e523e5b40c197c6faa99c6f91

The API is:

findStyleCodeInHaystacks(
  brand: "adidas" | "nike" | "nb" | "asics" | "puma" | "vans",
  haystacks: Array<string | Array<string>>
)

Haystacks is the places where the style code could be. For example:

findStyleCodeInHaystacks("nb", [
  "NEW BALANCE X STANCE 997 FIRST OF ALL PACK MEN'S - TAN/PINK",
  '<p><font color="#000000" face="Arial">Stance Socks and New Balance have combined forces to present a two-shoe collaboration this summer, featuring the classic 997. Inspired by their opposite-coast roots, the 997 takes inspiration from Boston’s traditional brick buildings and brownstone architecture. They are built with premium Made in USA quality. They feature pigskin suede uppers and come complete with matching Stance socks with stripes and multicolored speckles.Dubbed the “First of All” pack, this will actually be the first in an ongoing series of collabs from Stance and New Balance throughout the year.</font></p>\r\n<p> </p>\r\n<p><font color="#000000" face="Arial">Style # M997ST</font></p>',
  [
    "M997ST-7.5",
    "M997ST-8",
    "M997ST-8.5",
    "M997ST-9",
    "M997ST-9.5",
    "M997ST-10",
    "M997ST-10.5",
    "M997ST-11",
    "M997ST-11.5",
    "M997ST-12",
    "M997ST-12.5",
    "M997ST-13"
  ],
  [
    "7.5",
    "8",
    "8.5",
    "9",
    "9.5",
    "10",
    "10.5",
    "11",
    "11.5",
    "12",
    "12.5",
    "13"
  ],
  "new-balance-x-stance-997-first-of-all-pack-mens-tan-pink"
]);

Would output

M997ST
@worm-emoji
Copy link
Member

worm-emoji commented Jun 10, 2017

That gist looks really solid. We haven't updated this project in a bit but I'd totally accept (and use!) a PR that adds these features

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants