emvco-qr-sdk
Version:
A robust TypeScript SDK for decoding, validating, and processing EMVCo-compliant QR codes used in digital payment systems.
27 lines (26 loc) • 1.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerGenericStrategyForTags = registerGenericStrategyForTags;
const default_strategy_1 = require("../defaults/default.strategy");
/**
* Utility function to register a mapping strategy for a list of tags under the Colombian region.
*
* This helper automatically assigns the provided strategy to all specified tag codes,
* while defaulting to a fallback strategy (`defaultStrategy`) for GLOBAL and DEFAULT regions.
*
* Used to reduce boilerplate and maintain consistent behavior across tags
* that follow a shared generic structure (e.g., GUI-based subtags).
*
* @param registry - The tag strategy registry to update.
* @param tags - An array of tag codes to associate with the strategy.
* @param strategy - The mapping strategy to apply under the CO (Colombia) region.
*/
function registerGenericStrategyForTags(registry, tags, strategy) {
for (const tag of tags) {
registry[tag] = {
CO: strategy,
GLOBAL: default_strategy_1.defaultStrategy,
DEFAULT: default_strategy_1.defaultStrategy,
};
}
}