• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ckeditor / ckeditor5-package-generator / f4c99530-ae63-40a1-afbe-652cf7f886a6

19 Sep 2024 07:44AM UTC coverage: 100.0%. Remained the same
f4c99530-ae63-40a1-afbe-652cf7f886a6

Pull #189

circleci

web-flow
Bump express from 4.19.2 to 4.21.0

Bumps [express](https://github.com/expressjs/express) from 4.19.2 to 4.21.0.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.0/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.19.2...4.21.0)

---
updated-dependencies:
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #189: Bump express from 4.19.2 to 4.21.0

120 of 120 branches covered (100.0%)

Branch coverage included in aggregate %.

393 of 393 relevant lines covered (100.0%)

9.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/packages/ckeditor5-package-generator/lib/utils/get-package-name-formats.js
1
/**
2
 * @license Copyright (c) 2020-2024, CKSource Holding sp. z o.o. All rights reserved.
3
 * For licensing, see LICENSE.md.
4
 */
5

6
'use strict';
7

8
const PARTS_REGEXP = /[0-9]+|[A-Za-z][a-z]*/g;
1✔
9

10
/**
11
 * This function returns an object with two properties: "package" and "plugin". Values of those properties
12
 * are object that contain the names formatted in different formats. If "pluginName" was not provided,
13
 * values for "plugin" will be the same as the "package" ones.
14
 *
15
 * @param {String} packageName
16
 * @param {String|undefined} pluginName
17
 * @returns {FormattedNames}
18
 */
19
module.exports = function getPackageNameFormats( packageName, pluginName ) {
1✔
20
        return {
10✔
21
                package: format( packageName ),
22
                plugin: format( pluginName || packageName )
16✔
23
        };
24
};
25

26
/**
27
 * @param {String} name
28
 * @returns {FormattedName}
29
 */
30
function format( name ) {
31
        // Removing the scope and prefix in case of the package name.
32
        const raw = name.split( 'ckeditor5-' ).pop();
20✔
33

34
        // Separating the name into its components.
35
        const parts = raw.match( PARTS_REGEXP )
20✔
36
                // Unifying letter size in case of the plugin name.
37
                .map( part => part.toLowerCase() );
47✔
38

39
        return {
20✔
40
                raw,
41
                fullName: name,
42
                spacedOut: toSpacedOut( parts ),
43
                camelCase: toCamelCase( parts ),
44
                pascalCase: toPascalCase( parts ),
45
                lowerCaseMerged: parts.join( '' )
46
        };
47
}
48

49
/**
50
 * @param {Array<String>} parts
51
 * @returns {String}
52
 */
53
function toPascalCase( parts ) {
54
        return parts.map( uppercaseFirstChar ).join( '' );
40✔
55
}
56

57
/**
58
 * @param {Array<String>} parts
59
 * @returns {String}
60
 */
61
function toCamelCase( parts ) {
62
        const pascalCase = toPascalCase( parts );
20✔
63

64
        return pascalCase.charAt( 0 ).toLowerCase() + pascalCase.slice( 1 );
20✔
65
}
66

67
/**
68
 * @param {Array<String>} parts
69
 * @returns {String}
70
 */
71
function toSpacedOut( parts ) {
72
        return uppercaseFirstChar( parts.join( ' ' ) );
20✔
73
}
74

75
/**
76
 * @param {String} string
77
 * @returns {String}
78
 */
79
function uppercaseFirstChar( string ) {
80
        return string.charAt( 0 ).toUpperCase() + string.slice( 1 );
114✔
81
}
82

83
/**
84
 * @typedef {Object} FormattedNames
85
 *
86
 * @property {FormattedName} package
87
 *
88
 * @property {FormattedName} plugin
89
 */
90

91
/**
92
 * @typedef {Object} FormattedName
93
 *
94
 * @property {String} raw super-feature-name
95
 *
96
 * @property {String} full @scope/ckeditor5-super-feature-name
97
 *
98
 * @property {String} spacedOut Super feature name
99
 *
100
 * @property {String} camelCase superFeatureName
101
 *
102
 * @property {String} pascalCase SuperFeatureName
103
 *
104
 * @property {String} lowerCaseMerged superfeaturename
105
 */
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc