|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
738 bytes
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | exports.__esModule = true;
|
|---|
| 4 | exports.expandState = expandState;
|
|---|
| 5 |
|
|---|
| 6 | var _path = _interopRequireDefault(require("path"));
|
|---|
| 7 |
|
|---|
| 8 | var _camelcase = _interopRequireDefault(require("camelcase"));
|
|---|
| 9 |
|
|---|
| 10 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|---|
| 11 |
|
|---|
| 12 | const validCharacters = /[^a-zA-Z0-9_-]/g;
|
|---|
| 13 |
|
|---|
| 14 | function getComponentName(state) {
|
|---|
| 15 | if (!state.filePath) return 'SvgComponent';
|
|---|
| 16 | const pascalCaseFileName = (0, _camelcase.default)(_path.default.parse(state.filePath).name.replace(validCharacters, ''), {
|
|---|
| 17 | pascalCase: true
|
|---|
| 18 | });
|
|---|
| 19 | return `Svg${pascalCaseFileName}`;
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | function expandState(state) {
|
|---|
| 23 | return {
|
|---|
| 24 | componentName: state.componentName || getComponentName(state),
|
|---|
| 25 | ...state
|
|---|
| 26 | };
|
|---|
| 27 | } |
|---|
Note:
See
TracBrowser
for help on using the repository browser.