MCPcopy Index your code
hub / github.com/BuilderIO/SSDiff / getFileName

Method getFileName

packages/ssdiff/src/index.ts:120–128  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

118 }
119 }
120 getFileName(url: string) {
121 try {
122 const parsedURL = new URL(url);
123 const fileName = parsedURL.pathname.substring(1).replaceAll("/", "-");
124 return fileName.at(-1) === "-" ? fileName.substring(0, fileName.length - 1) : fileName;
125 } catch (e: any) {
126 throw new Error("Error while getting file name: " + e.message);
127 }
128 }
129 /**
130 * @remarks
131 * This method is internally used to resize the image to the same size, incase the images are of different sizes.

Callers 2

resultMethod · 0.95
ssdiff.test.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected