@automattic/calypso-products
Version:
This module contains information about the various products sold within calypso, such as product slugs, plan intervals, etc.
19 lines • 726 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.findProductKeys = findProductKeys;
const product_matches_1 = require("./product-matches");
const products_list_1 = require("./products-list");
/**
* Finds all keys of products matching a query
*
* For example:
*
* > findProductsKeys( { type: PRODUCT_JETPACK_BACKUP_DAILY } );
* [PRODUCT_JETPACK_BACKUP_DAILY, PRODUCT_JETPACK_BACKUP_DAILY_MONTHLY]
*/
function findProductKeys(query = {}) {
return Object.values(products_list_1.PRODUCTS_LIST)
.map(({ product_slug }) => product_slug)
.filter((productSlug) => (0, product_matches_1.productMatches)(productSlug, query));
}
//# sourceMappingURL=find-product-keys.js.map