carrefour
v0.0.1
Published
A library to generate the cartesian product of product variants.
Downloads
3
Readme
carrefour
Use the carrefour
library to generate the Product Variant options for the Material platform based on the values of the different variant groups.
Installation and Usage
Using npm:
$ {sudo -H} npm i -g npm
$ npm i --save @material-dev/carrefour
In Node.js:
const carrefour = require('carrefour');
const variantOptions = carrefour.buildVariants(['Red', 'Blue'], ['S', 'M', 'L']);
/*
[
{ variants: ['Red', 'S'], isShopperVisible: true },
{ variants: ['Red', 'M'], isShopperVisible: true },
{ variants: ['Red', 'L'], isShopperVisible: true },
{ variants: ['Blue', 'S'], isShopperVisible: true },
{ variants: ['Blue', 'S'], isShopperVisible: true },
{ variants: ['Blue', 'S'], isShopperVisible: true },
]
*/
To run the code locally:
Confirm that node v6 and git are installed
Clone the repo
git clone [email protected]:MaterialDev/carrefour.git
- Install dependencies
npm install
- Run the tests
npm test