MCPcopy Create free account
hub / github.com/xerrors/Yuxi / getExtension

Function getExtension

web/src/utils/file_icon.js:124–133  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

122}
123
124const getExtension = (name) => {
125 const cleanName = String(name || '')
126 .trim()
127 .toLowerCase()
128 .split(/[?#]/)[0]
129 const fileName = cleanName.split('/').pop() || ''
130 const dotIndex = fileName.lastIndexOf('.')
131 if (dotIndex <= 0) return ''
132 return fileName.slice(dotIndex + 1)
133}
134
135/**
136 * 解析文件 / 文件夹对应的彩色图标 URL。

Callers 1

resolveFileIconUrlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected