import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'shippingDocumentNumberFormatter',
})
export class ShippingDocumentNumberFormatterPipe implements PipeTransform {
  transform(shippingDocumentNumber: string): string {
    if (!shippingDocumentNumber) {
      return '';
    }
    if (shippingDocumentNumber.length <= 18) {
      return shippingDocumentNumber;
    }

    return shippingDocumentNumber.slice(0, 18);
  }
}
