UNPKG

ikea-availability-checker

Version:

ikea product in-store availability checker and product search

23 lines (22 loc) 1.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.store = exports.pretty = exports.plain = exports.minStock = exports.json = exports.country = void 0; const commander_1 = require("commander"); exports.country = new commander_1.Option("-c, --country [countryCode]", "optional single country code or multiple country codes separated by comma"); exports.json = new commander_1.Option("--json", "output as JSON"); exports.minStock = new commander_1.Option("--min-stock [amount=0]", "filter out all stores which don’t meet the minimum amount").default(0); exports.plain = new commander_1.Option("--plain", "output as tsv"); exports.pretty = new commander_1.Option("--pretty", "pretty table output (default)"); exports.store = new commander_1.Option("-s, --store <storeIds ...|regexp>", "optional single or multiple comma seperated ikea store ids (bu-codes) " + "where of which the product stock availability should get checked").argParser((value) => { const seperator = ","; if (value.indexOf(seperator) === -1) { return value; } return (value .split(seperator) // trim all valueues .map((value) => value.trim()) // make unique .filter((cur, i, arr) => arr.indexOf(cur, i + 1) === -1)); });