source: trip-planner-front/node_modules/pascalcase/index.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 586 bytes
Line 
1/*!
2 * pascalcase <https://github.com/jonschlinkert/pascalcase>
3 *
4 * Copyright (c) 2015, Jon Schlinkert.
5 * Licensed under the MIT License.
6 */
7
8function pascalcase(str) {
9 if (typeof str !== 'string') {
10 throw new TypeError('expected a string.');
11 }
12 str = str.replace(/([A-Z])/g, ' $1');
13 if (str.length === 1) { return str.toUpperCase(); }
14 str = str.replace(/^[\W_]+|[\W_]+$/g, '').toLowerCase();
15 str = str.charAt(0).toUpperCase() + str.slice(1);
16 return str.replace(/[\W_]+(\w|$)/g, function (_, ch) {
17 return ch.toUpperCase();
18 });
19}
20
21module.exports = pascalcase;
Note: See TracBrowser for help on using the repository browser.