MCPcopy Create free account
hub / github.com/decaporg/decap-cms / toGlobalName

Function toGlobalName

scripts/externals.js:9–19  ·  view source on GitHub ↗

* Takes a dash [-] separated name and makes it camel-cased * decap-cms-something to DecapCmsSomething * @param {} string

(name)

Source from the content-addressed store, hash-verified

7 * @param {} string
8 */
9function toGlobalName(name) {
10 return `${name}`
11 .replace(new RegExp(/[-_/]+/, 'g'), ' ')
12 .replace(new RegExp(/[^\w\s]/, 'g'), '')
13 .replace(
14 new RegExp(/\s+(.)(\w+)/, 'g'),
15 ($1, $2, $3) => `${$2.toUpperCase() + $3.toLowerCase()}`,
16 )
17 .replace(new RegExp(/\s/, 'g'), '')
18 .replace(new RegExp(/\w/), s => s.toUpperCase());
19}
20
21const packages = fs.readdirSync(path.resolve(__dirname, '../packages'));
22

Callers 2

targetOutputsFunction · 0.85
externals.jsFile · 0.85

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected