pattern-rules.js 744 Bytes
/**
 * Rule pattern to be used by message extractor
 */
module.exports = {
    sn: [
        {
            pattern: /(?:^|,|\.|;|\s)SN\s*[=: ]\s*(.+?)(?:;|$)/,
            idx: 1,
            disable: false,
        },
    ],
    price: [
        {
            pattern: /(?:,|\.|;|\s)(?:HRG|HARGA)\s*[=: ]\s*(?:(?:RP|Rp)\.*)*\s*(([0-9]|\.||,)+)/,
            idx: 1,
            disable: false,
            postprocessing: (val) => (val || '').replace(/[,.]/g, ''),
        },
    ],
    balance: [
        {
            pattern: /(?:,|\.|;|\s)SAL(?:DO)*\s*[=: ]\s*(?:(?:RP|Rp)\.*)*\s*(([0-9]|\.||,)+)/,
            idx: 1,
            disable: false,
            postprocessing: (val) => (val || '').replace(/[,.]/g, ''),
        },
    ],
};