MessageValidater.js 962 Bytes
export default function (mty,swift_message_tree)
{
    let vali_func = FUNC_SET[mty]
    if(!vali_func)
        return 
    return vali_func(swift_message_tree)
}

function mt700({Tags}){
    let count = 0

    new Array(27,28,29,30,31).forEach(i=>{
        let {tagValue:itemValue} =  Tags[i-1]
        if(!itemValue || itemValue.length < 2 || !itemValue[1])
            return 
        count+=itemValue[1].replace(/[\r\n]{1,2}/g,'').length
    });
    if(count > 63400)
        return `45A,46A,47A,49G,49H总长度不得超过63400个字符`
}

function mt707({Tags}){
    let count = 0
    
    new Array(34,35,36,37,38).forEach(i=>{
        let {tagValue:itemValue} =  Tags[i-1]
        if(!itemValue || itemValue.length < 2 || !itemValue[1])
            return 
        count+=itemValue[1].replace(/[\r\n]{1,2}/g,'').length
    });
    if(count > 63400)
        return `45B,46B,47B,49M,49N总长度不得超过63400个字符`
}

const FUNC_SET={mt700,mt707}