MCPcopy Create free account
hub / github.com/github/docs / filenameToKey

Function filenameToKey

lib/filename-to-key.js:17–28  ·  view source on GitHub ↗
(filename)

Source from the content-addressed store, hash-verified

15
16// derive `foo.bar.baz` object key from `foo/bar/baz.yml` filename
17export default function filenameToKey(filename) {
18 const extension = new RegExp(`${path.extname(filename)}$`)
19 const key = filename
20 .replace(extension, '')
21 .replace(leadingPathSeparator, '')
22 .replace(windowsLeadingPathSeparator, '')
23 .replace(pathSeparator, '.')
24 .replace(windowsPathSeparator, '.')
25 .replace(windowsDoubleSlashSeparator, '.')
26
27 return key
28}

Callers 2

dataDirectoryFunction · 0.85
filename-to-key.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected