UNPKG

553 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.kebabCase = exports.camelCase = void 0;
4/**
5 * camelCase('foo-bar');
6 * // => 'fooBar'
7 * @param s
8 */
9function camelCase(s) {
10 return s.replace(/-(\w)/g, function (_, letter) {
11 return letter.toUpperCase();
12 });
13}
14exports.camelCase = camelCase;
15/**
16 * kebabCase('fooBar');
17 * // => 'foo-bar'
18 * @param s
19 */
20function kebabCase(s) {
21 return s.replace(/([A-Z])/g, '-$1').toLowerCase();
22}
23exports.kebabCase = kebabCase;
24//# sourceMappingURL=string.js.map
\No newline at end of file