mirror of
https://github.com/rjNemo/melon_frontend
synced 2026-06-06 10:26:45 +00:00
refactor: extract enum method to lib
This commit is contained in:
parent
251a2b1ad0
commit
4b800872a6
3 changed files with 14 additions and 12 deletions
|
|
@ -1,9 +1,9 @@
|
|||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import { BrowserRouter } from "react-router-dom";
|
||||
import App from "./App";
|
||||
import "./index.css";
|
||||
import reportWebVitals from "./reportWebVitals";
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
import App from './App';
|
||||
import './index.css';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
|
|
@ -11,7 +11,8 @@ ReactDOM.render(
|
|||
<App />
|
||||
</BrowserRouter>
|
||||
</React.StrictMode>,
|
||||
document.getElementById("root")
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
||||
reportWebVitals();
|
||||
export { enumToList } from './lib/enums';
|
||||
|
|
|
|||
4
src/lib/enums.ts
Normal file
4
src/lib/enums.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export const enumToList = (enumerable: any) =>
|
||||
Object.keys(enumerable)
|
||||
.filter((v) => !parseInt(v))
|
||||
.slice(1);
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
import { enumToList } from '../../lib/enums';
|
||||
|
||||
export type ReportFormType = {
|
||||
type: ReportType;
|
||||
month?: Month;
|
||||
|
|
@ -24,8 +26,3 @@ enum Month {
|
|||
}
|
||||
|
||||
export const monthToList = () => enumToList(Month);
|
||||
|
||||
export const enumToList = (enumerable: any) =>
|
||||
Object.keys(enumerable)
|
||||
.filter((v) => !parseInt(v))
|
||||
.slice(1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue