Skip to content

Commit

Permalink
Fixed pascal case
Browse files Browse the repository at this point in the history
  • Loading branch information
victorgarciaesgi committed Mar 8, 2022
1 parent 12ff00d commit dfe3448
Show file tree
Hide file tree
Showing 9 changed files with 9,090 additions and 16 deletions.
2 changes: 1 addition & 1 deletion debug/vue-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"chart.js": "^3.7.1",
"core-js": "^3.19.1",
"vue": "^3.2.25",
"vue-chart-3": "^3.1.0-rc.6"
"vue-chart-3": "^3.1.1"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.10.2",
Expand Down
9,071 changes: 9,071 additions & 0 deletions debug/vue-cli/yarn.lock

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-chart-3",
"version": "3.1.1",
"version": "3.1.2",
"description": "📊 A simple wrapper around Chart.js 3 for Vue 2 & 3",
"license": "MIT",
"scripts": {
Expand Down Expand Up @@ -37,8 +37,7 @@
"@vue/runtime-core": "latest",
"@vue/runtime-dom": "latest",
"csstype": "latest",
"lodash-es": "latest",
"pascalcase": "^2.0.0"
"lodash-es": "latest"
},
"devDependencies": {
"@types/chart.js": "^2.9.35",
Expand Down
13 changes: 6 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/core/component.builder.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Chart, ChartData, ChartDataset, ChartOptions, ChartType, Plugin } from 'chart.js';
import * as Chartjs from 'chart.js';
import { cloneDeep, isEqual } from 'lodash-es';
import { pascalCase } from '../utils';
import {
ComponentOptionsMixin,
ComputedOptions,
Expand All @@ -17,7 +18,6 @@ import {
} from 'vue';
import { ChartComponentEmits } from '.';
import type { StyleValue } from '../misc';
import pascalCase from 'pascalcase';
import type { ChartPropsOptions, ComponentData } from './component.types';

/** Builder method to create a component based on Chart.js chart type
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/hooks.builder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Chart, ChartData, ChartType, Plugin } from 'chart.js';
import pascalcase from 'pascalcase';
import { pascalCase } from '../utils';
import { computed, ref, unref } from 'vue';
import { VueChartComponent } from '.';
import type { StyleValue } from '../misc';
Expand Down Expand Up @@ -45,7 +45,7 @@ export const defineChartHook = <TType extends ChartType = ChartType, TJSX = fals
if (chartComponentRef) {
chartComponentRef?.chartInstance.value?.update();
} else {
console.warn(`No chartInstance to update (use${pascalcase(chartType)}Chart)`);
console.warn(`No chartInstance to update (use${pascalCase(chartType)}Chart)`);
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/utils/format.utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export function pascalCase(str: string): string {
return (str.match(/[a-zA-Z0-9]+/g) || [])
.map((w) => `${w.charAt(0).toUpperCase()}${w.slice(1)}`)
.join('');
}
1 change: 1 addition & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './types.utils';
export * from './format.utils';
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"downlevelIteration": true,
"noEmit": true,
"skipLibCheck": true,
"types": ["vitest/globals"],
"baseUrl": "."
"types": ["vitest/globals"]
},
"include": ["./src/**/*.ts", "./tests/**/*.ts"],
"exclude": ["node_modules"]
Expand Down

0 comments on commit dfe3448

Please sign in to comment.