How to use change-case.g:
GitHub: Pacharoth/node-smis
41 42 43 44 45 46 47 48 49 50 51
console.error(message); process.exit(1); } /** * JSON does not support regexes, so, e.g., JSON.parse() will not create * a RegExp from the JSON value `[ "/matchString/" ]`, which is * technically just an array containing a string that begins and end with * a forward slash. To get a RegExp from a JSON string, it must be * constructed explicitly in JavaScript.
How to use change-case.pascal:
6 7 8 9 10 11 12 13 14 15
const { param, pascal } = require('change-case'); const { toString } = require('@carbon/icon-helpers'); const classCase = str => { const pascalled = pascal(str); if (Number.isNaN(Number(pascalled[0]))) { return pascalled; } // append a _ if the string starts with a number
18
19
5
See more examples
How to use change-case.kebab:
GitHub: uropek8/vite-blog
17 18 19 20 21 22 23 24 25 26
name: 'componentName', message: 'Type component name (without prefix). Example: remote-select or RemoteSelect', validate(value, { componentType }) { const nameLength = value.length; const minLength = 3; const fileName = kebab(value); const forbiddenPrefixes = Object.values(PREFIX_TYPES); if (!nameLength) { return 'Components should have a name!!!'; }
How to use change-case.lowerCaseFirst:
33 34 35 36 37 38 39 40 41 42 43
} class ChangeCase extends TransformString { static command = false getNewText (text) { const functionName = this.functionName || changeCase.lowerCaseFirst(this.name) // HACK: Pure Vim's `~` is too aggressive(e.g. remove punctuation, remove white spaces...). // Here intentionally making changeCase less aggressive by narrowing target charset. const charset = '[\u00C0-\u02AF\u0386-\u0587\\w]' const regex = new RegExp(`${charset}+(:?[-./]?${charset}+)*`, 'g')
How to use change-case.capitalCase:
GitHub: formewp/forme-theme
34 35 36 37 38 39 40 41 42 43 44
function swapNameStrings() { let pascalName = pascalCase(argv.name); let kebabName = paramCase(argv.name); let snakeName = snakeCase(argv.name); let titleName = capitalCase(argv.name); return src(paths, { base: "./" }) .pipe(replace('ReplaceMe', pascalName)) .pipe(replace('replace-me', kebabName)) .pipe(replace('replace_me', snakeName))
How to use change-case.default:
16 17 18 19 20 21 22 23 24 25
snakeCase: _changeCase.default.snake, dotCase: _changeCase.default.dot, pathCase: _changeCase.default.path, lowerCase: _changeCase.default.lower, upperCase: _changeCase.default.upper, sentenceCase: _changeCase.default.sentence, constantCase: _changeCase.default.constant, titleCase: _changeCase.default.title, dashCase: _changeCase.default.param, kabobCase: _changeCase.default.param,
How to use change-case.constantCase:
57 58 59 60 61 62 63 64 65 66
.then((answers) => { const tokens = { 'WP Emerge Starter Theme': answers.name, 'WP Emerge Starter Plugin': answers.name, 'MyApp': pascalCase(answers.namespace), 'MY_APP': constantCase(answers.namespace), 'my_app': snakeCase(answers.namespace), }; log('');
30
283
17
See more examples
How to use change-case.camelCase:
19 20 21 22 23 24 25 26 27 28 29 30
const nameSingle = changeCase.pascalCase(pluralize.singular(name)) return `${lowercaseFirstLetter(nameSingle)}.schema` } const getStubsName = (name) => { const camelCase = changeCase.camelCase(name) return `${camelCase}.stubs` } // https://github.com/jeremytenjo/super-code-generator/tree/master#component-type-properties
How to use change-case.snakeCase:
58 59 60 61 62 63 64 65 66 67
const tokens = { 'WP Emerge Starter Theme': answers.name, 'WP Emerge Starter Plugin': answers.name, 'MyApp': pascalCase(answers.namespace), 'MY_APP': constantCase(answers.namespace), 'my_app': snakeCase(answers.namespace), }; log(''); log('The following changes will be applied:');
30
283
17
See more examples
How to use change-case.paramCase:
75 76 77 78 79 80 81
})); // Aliases module.exports.push({ name: 'dashCase', process: changeCase.paramCase });
104
143
21
See more examples
How to use change-case.pascalCase:
5 6 7 8 9 10 11 12 13 14
const replace = require('@rollup/plugin-replace'); const pkg = require('./package.json'); pkg.name = pkg.name.replace('js', ''); const name = changeCase.pascalCase(pkg.name); const banner = createBanner({ data: { name: `${name}.js`, year: '2018-present',
411
0
38
See more examples