UNPKG

healthone

Version:

Health One format library for JavaScript

3 lines 586 B
export default function validateLineLength(a,b,c,d){"number"==typeof c&&(c=[c]);let e=!1===d?[]:c.map(a=>a+1);c=!0===d?[]:c,c=new Set(c),e=new Set(e);const f=c.has(a.length),g=e.has(a.length);if(!f&&!g){const d=Array.from(new Set([...c,...e]));d.sort();const f=`any of ${JSON.stringify(d)}`;throw new Error(`parse${b}: wrong number of parts, got ${a.length}, expected ${f}.`)}if(!0===d||g&&!f){// Last part MUST be empty const c=a.length-1;if(""!==a[c].trimStart())throw new Error(`parse${b}: wrong last part, got ${a[c]}, expected ''.`)}} //# sourceMappingURL=validateLineLength.js.map