@sixbell-telco/sdk
Version:
A collection of reusable components designed for use in Sixbell Telco Angular projects
38 lines (34 loc) • 1.47 kB
JavaScript
import * as i0 from '@angular/core';
import { Pipe } from '@angular/core';
class ExtractExtensionPipe {
transform(filename) {
return this.extractExtension(filename);
}
extractExtension(filename) {
const lastDotIndex = filename.lastIndexOf('.');
if (lastDotIndex === -1) {
// No dot found, return the entire filename
return filename;
}
if (lastDotIndex === filename.length - 1) {
// Dot is the last character, return an empty string
return '';
}
// Return the substring after the last dot
return filename.substring(lastDotIndex + 1);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: ExtractExtensionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.0", ngImport: i0, type: ExtractExtensionPipe, isStandalone: true, name: "extractExtension" });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: ExtractExtensionPipe, decorators: [{
type: Pipe,
args: [{
name: 'extractExtension',
standalone: true,
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { ExtractExtensionPipe };
//# sourceMappingURL=sixbell-telco-sdk-utils-pipes-extract-extension.mjs.map