legacy-appointment-transform.mjs 572 B

123456
  1. // Reuse the operations defaults instead of maintaining a second mobile price list.
  2. export function legacyAppointmentDefaults(operationsCode) {
  3. const start=operationsCode.indexOf('const TEACHING_STAGE_DEFAULTS='),end=operationsCode.indexOf('async function teachingCategoryRows(',start);
  4. if(start<0||end<start)throw Error('缺少旧预约核对所需的默认课时规则');
  5. return '\nfunction legacyAppointmentSeedRules(){function text(value){return String(value==null?\'\':value).trim();}\n'+operationsCode.slice(start,end)+'\nreturn defaultTeachingRules();}\n';
  6. }