Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shouzhouServer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjinjing
shouzhouServer
Commits
e2330995
Commit
e2330995
authored
Jul 16, 2024
by
Leo Zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debug和名称修改
parent
c5320fbf
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
63 additions
and
42 deletions
+63
-42
serverConfig.xml
serverConfig.xml
+2
-1
getData.ts
src/biz/getData.ts
+1
-0
gateStatusStrategy.ts
src/biz/strategies/left/gateStatusStrategy.ts
+4
-4
guchengLoadStrategy.ts
src/biz/strategies/left/guchengLoadStrategy.ts
+1
-2
sightVisitorFlowByDayStrategy.ts
src/biz/strategies/left/sightVisitorFlowByDayStrategy.ts
+11
-11
totalVisitorFlowByHourStrategy.ts
src/biz/strategies/left/totalVisitorFlowByHourStrategy.ts
+6
-1
currentEventStrategy.ts
src/biz/strategies/middle/currentEventStrategy.ts
+1
-1
eventDataStrategy.ts
src/biz/strategies/middle/eventDataStrategy.ts
+9
-3
totalEventCountStrategy.ts
src/biz/strategies/middle/totalEventCountStrategy.ts
+1
-1
eventCategoryCountStrategy.ts
src/biz/strategies/right/eventCategoryCountStrategy.ts
+2
-1
eventMonthDistributionStrategy.ts
src/biz/strategies/right/eventMonthDistributionStrategy.ts
+1
-1
eventProcessingTimeStrategy.ts
src/biz/strategies/right/eventProcessingTimeStrategy.ts
+1
-1
eventSrcStrategy.ts
src/biz/strategies/right/eventSrcStrategy.ts
+2
-1
eventSubCategoryCountStrategy.ts
src/biz/strategies/right/eventSubCategoryCountStrategy.ts
+2
-1
eventTimeDistributionStrategy.ts
src/biz/strategies/right/eventTimeDistributionStrategy.ts
+1
-1
getEventCountByYearStrategy.ts
src/biz/strategies/right/getEventCountByYearStrategy.ts
+1
-1
gridEventCountStrategy.ts
src/biz/strategies/right/gridEventCountStrategy.ts
+2
-1
strategyFactory.ts
src/biz/strategies/strategyFactory.ts
+1
-1
mapToObj.ts
src/util/mapToObj.ts
+14
-9
No files found.
serverConfig.xml
View file @
e2330995
<config>
<config>
<port>
3001
6
</port>
<port>
3001
7
</port>
<host>
192.168.0.132
</host>
<host>
192.168.0.132
</host>
</config>
</config>
\ No newline at end of file
src/biz/getData.ts
View file @
e2330995
...
@@ -15,6 +15,7 @@ import { strategyFactory } from "./strategies/strategyFactory";
...
@@ -15,6 +15,7 @@ import { strategyFactory } from "./strategies/strategyFactory";
export
function
getData
(
req
,
res
,
strategyType
:
string
)
{
export
function
getData
(
req
,
res
,
strategyType
:
string
)
{
const
strategy
=
strategyFactory
.
createStrategy
(
strategyType
);
const
strategy
=
strategyFactory
.
createStrategy
(
strategyType
);
let
ret
=
strategy
.
execute
(
req
);
let
ret
=
strategy
.
execute
(
req
);
res
.
setHeader
(
'Content-Type'
,
'application/json; charset=utf-8'
);
res
.
send
(
ret
);
res
.
send
(
ret
);
}
}
...
...
src/biz/strategies/left/gateStatusStrategy.ts
View file @
e2330995
...
@@ -16,10 +16,10 @@ export class gateStatusStrategy extends abstractDataStrategyLeft {
...
@@ -16,10 +16,10 @@ export class gateStatusStrategy extends abstractDataStrategyLeft {
constructor
()
{
constructor
()
{
super
();
super
();
// 初始化门状态映射
// 初始化门状态映射
this
.
gateStatusMap
.
set
(
'
south
'
,
''
);
this
.
gateStatusMap
.
set
(
'
通淝门(南门)
'
,
''
);
this
.
gateStatusMap
.
set
(
'
east
'
,
''
);
this
.
gateStatusMap
.
set
(
'
宾阳门(东门)
'
,
''
);
this
.
gateStatusMap
.
set
(
'
west
'
,
''
);
this
.
gateStatusMap
.
set
(
'
定湖门(西门)
'
,
''
);
this
.
gateStatusMap
.
set
(
'
north
'
,
''
);
this
.
gateStatusMap
.
set
(
'
靖淮门(北门)
'
,
''
);
}
}
/**
/**
...
...
src/biz/strategies/left/guchengLoadStrategy.ts
View file @
e2330995
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
* 该文件定义了古城负载状态策略的具体实现。
* 该文件定义了古城负载状态策略的具体实现。
*/
*/
import
{
randomStatusGenerator
}
from
"../../../util/randomStatusGenerator"
;
import
{
abstractDataStrategyLeft
}
from
"./abstractDataStrategyLeft"
;
import
{
abstractDataStrategyLeft
}
from
"./abstractDataStrategyLeft"
;
/**
/**
...
@@ -18,6 +17,6 @@ export class guchengLoadStrategy extends abstractDataStrategyLeft {
...
@@ -18,6 +17,6 @@ export class guchengLoadStrategy extends abstractDataStrategyLeft {
if
(
!
params
||
!
params
.
query
||
!
params
.
query
.
date
)
{
if
(
!
params
||
!
params
.
query
||
!
params
.
query
.
date
)
{
throw
new
Error
(
"Date parameter is required."
)
throw
new
Error
(
"Date parameter is required."
)
}
}
return
randomStatusGenerator
.
getRandomStatus
()
;
return
"正常"
;
}
}
}
}
src/biz/strategies/left/sightVisitorFlowByDayStrategy.ts
View file @
e2330995
...
@@ -5,7 +5,8 @@
...
@@ -5,7 +5,8 @@
import
{
randomStatusGenerator
}
from
"../../../util/randomStatusGenerator"
;
import
{
randomStatusGenerator
}
from
"../../../util/randomStatusGenerator"
;
import
excelSerialToJSDate
from
"../../../util/excelDateToJSDate"
;
import
excelSerialToJSDate
from
"../../../util/excelDateToJSDate"
;
import
{
abstractDataStrategyLeft
}
from
"./abstractDataStrategyLeft"
;
import
{
abstractDataStrategyLeft
}
from
"./abstractDataStrategyLeft"
;
import
mapToObj
from
"../../../util/mapToObj"
;
/**
/**
* 按天计算的游客流量策略类,继承自 abstractDataStrategyLeft。
* 按天计算的游客流量策略类,继承自 abstractDataStrategyLeft。
...
@@ -30,8 +31,8 @@ export class sightVisitorFlowByDayStrategy extends abstractDataStrategyLeft {
...
@@ -30,8 +31,8 @@ export class sightVisitorFlowByDayStrategy extends abstractDataStrategyLeft {
* @param date - 指定日期。
* @param date - 指定日期。
* @returns 每小时的游客流量映射。
* @returns 每小时的游客流量映射。
*/
*/
private
getVisitorFlowByDay
(
data
:
any
,
date
:
string
)
{
private
getVisitorFlowByDay
(
data
:
any
,
date
:
string
)
:
any
{
const
visitorCount
:
{
[
sight
:
string
]:
{
count
:
number
,
status
:
string
}
}
=
{}
;
const
visitorCount
:
Map
<
string
,
{
count
:
number
,
status
:
string
}
>
=
new
Map
()
;
data
.
forEach
(
row
=>
{
data
.
forEach
(
row
=>
{
const
rowDate
=
excelSerialToJSDate
(
row
[
'游玩时间'
]);
const
rowDate
=
excelSerialToJSDate
(
row
[
'游玩时间'
]);
let
rowDateString
;
let
rowDateString
;
...
@@ -39,20 +40,19 @@ export class sightVisitorFlowByDayStrategy extends abstractDataStrategyLeft {
...
@@ -39,20 +40,19 @@ export class sightVisitorFlowByDayStrategy extends abstractDataStrategyLeft {
rowDateString
=
rowDate
.
toISOString
().
split
(
'T'
)[
0
];
rowDateString
=
rowDate
.
toISOString
().
split
(
'T'
)[
0
];
}
}
catch
(
e
)
{
catch
(
e
)
{
rowDateString
=
'invalid time'
rowDateString
=
'invalid time'
;
}
}
const
sight
=
row
[
'景点名称'
];
const
sight
=
row
[
'景点名称'
];
if
(
rowDateString
==
date
)
{
if
(
rowDateString
==
date
)
{
if
(
!
visitorCount
[
sight
]
)
{
if
(
!
visitorCount
.
has
(
sight
)
)
{
visitorCount
[
sight
]
=
{
count
:
0
,
status
:
randomStatusGenerator
.
getRandomStatus
()}
;
visitorCount
.
set
(
sight
,
{
count
:
0
,
status
:
randomStatusGenerator
.
getRandomStatus
()
})
;
}
}
visitorCount
[
sight
].
count
++
;
const
sightData
=
visitorCount
.
get
(
sight
)
!
;
sightData
.
count
++
;
visitorCount
.
set
(
sight
,
sightData
);
}
}
});
});
return
visitorCount
;
return
mapToObj
(
visitorCount
);
}
}
}
}
src/biz/strategies/left/totalVisitorFlowByHourStrategy.ts
View file @
e2330995
...
@@ -61,7 +61,11 @@ export class totalVisitorFlowByHourStrategy extends abstractDataStrategyLeft {
...
@@ -61,7 +61,11 @@ export class totalVisitorFlowByHourStrategy extends abstractDataStrategyLeft {
visitorCount
.
set
(
row
[
'订单游客类型'
],
visitorCount
.
get
(
row
[
'订单游客类型'
]).
set
(
rowHour
,
(
visitorCount
.
get
(
row
[
'订单游客类型'
]).
get
(
rowHour
)
||
0
)
+
1
));
visitorCount
.
set
(
row
[
'订单游客类型'
],
visitorCount
.
get
(
row
[
'订单游客类型'
]).
set
(
rowHour
,
(
visitorCount
.
get
(
row
[
'订单游客类型'
]).
get
(
rowHour
)
||
0
)
+
1
));
}
}
});
});
return
visitorCount
;
const
ret
:
Map
<
string
,
object
>
=
new
Map
();
visitorCount
.
forEach
((
value
,
key
)
=>
{
ret
.
set
(
key
,
mapToObj
(
value
,
"hour"
,
"count"
));
})
return
ret
;
}
}
}
}
\ No newline at end of file
src/biz/strategies/middle/currentEventStrategy.ts
View file @
e2330995
...
@@ -22,7 +22,7 @@ export class currentEventStrategy extends abstractDataStrategyMid {
...
@@ -22,7 +22,7 @@ export class currentEventStrategy extends abstractDataStrategyMid {
throw
new
Error
(
"Date parameter is required."
)
throw
new
Error
(
"Date parameter is required."
)
}
}
let
dayData
=
this
.
extractor
.
getData
(
currentEventStrategy
.
fileName
,
currentEventStrategy
.
sheetName
);
let
dayData
=
this
.
extractor
.
getData
(
currentEventStrategy
.
fileName
,
currentEventStrategy
.
sheetName
);
return
mapToObj
(
this
.
getCurrentDayEventDate
(
dayData
,
params
.
query
.
date
));
return
mapToObj
(
this
.
getCurrentDayEventDate
(
dayData
,
params
.
query
.
date
)
,
"event type"
,
"count"
);
}
}
/**
/**
...
...
src/biz/strategies/middle/eventDataStrategy.ts
View file @
e2330995
...
@@ -10,8 +10,7 @@ import excelSerialToJSDate from "../../../util/excelDateToJSDate";
...
@@ -10,8 +10,7 @@ import excelSerialToJSDate from "../../../util/excelDateToJSDate";
* 事件数据策略类,继承自 abstractDataStrategyMid。
* 事件数据策略类,继承自 abstractDataStrategyMid。
*/
*/
export
class
allEventDataStrategy
extends
abstractDataStrategyMid
{
export
class
allEventDataStrategy
extends
abstractDataStrategyMid
{
static
readonly
RELEVANTINFO
=
[
'事件标题'
,
'处置状态'
,
'数据更新时间'
,
'事件类型'
,
'事件子类型'
,
'事件来源'
];
static
readonly
RELEVANTINFO
=
[
'事件标题'
,
'处置状态'
,
'事件类型'
,
'事件子类型'
,
'事件来源'
,
'创建时间'
,
'处置时间'
,
'处置完成时间'
,
'办结时间'
];
/**
/**
* 执行所有事件数据策略。
* 执行所有事件数据策略。
* @returns 事件的数据。
* @returns 事件的数据。
...
@@ -28,11 +27,18 @@ export class allEventDataStrategy extends abstractDataStrategyMid {
...
@@ -28,11 +27,18 @@ export class allEventDataStrategy extends abstractDataStrategyMid {
*/
*/
private
removeUnusedColumns
(
data
:
any
)
{
private
removeUnusedColumns
(
data
:
any
)
{
data
.
forEach
(
row
=>
{
data
.
forEach
(
row
=>
{
// Initialize missing relevant columns with a default value
allEventDataStrategy
.
RELEVANTINFO
.
forEach
(
key
=>
{
if
(
!
(
key
in
row
))
{
row
[
key
]
=
null
;
// You can set this to any default value you prefer
}
});
Object
.
keys
(
row
).
forEach
(
key
=>
{
Object
.
keys
(
row
).
forEach
(
key
=>
{
if
(
!
allEventDataStrategy
.
RELEVANTINFO
.
includes
(
key
))
{
if
(
!
allEventDataStrategy
.
RELEVANTINFO
.
includes
(
key
))
{
delete
row
[
key
];
delete
row
[
key
];
}
}
if
(
key
===
'数据更新时间
'
)
{
if
(
typeof
row
[
key
]
===
'number
'
)
{
row
[
key
]
=
excelSerialToJSDate
(
row
[
key
]);
row
[
key
]
=
excelSerialToJSDate
(
row
[
key
]);
}
}
});
});
...
...
src/biz/strategies/middle/totalEventCountStrategy.ts
View file @
e2330995
...
@@ -17,7 +17,7 @@ export class totalEventCountStrategy extends abstractDataStrategyMid {
...
@@ -17,7 +17,7 @@ export class totalEventCountStrategy extends abstractDataStrategyMid {
*/
*/
execute
():
any
{
execute
():
any
{
let
eventData
=
this
.
extractor
.
getData
(
totalEventCountStrategy
.
fileName
,
totalEventCountStrategy
.
sheetName
);
let
eventData
=
this
.
extractor
.
getData
(
totalEventCountStrategy
.
fileName
,
totalEventCountStrategy
.
sheetName
);
return
mapToObj
(
this
.
getEventCount
(
eventData
));
return
mapToObj
(
this
.
getEventCount
(
eventData
)
,
"status"
,
"count"
);
}
}
/**
/**
...
...
src/biz/strategies/right/eventCategoryCountStrategy.ts
View file @
e2330995
...
@@ -26,6 +26,6 @@ export class eventCategoryCountStrategy extends abstractDataStrategyRight {
...
@@ -26,6 +26,6 @@ export class eventCategoryCountStrategy extends abstractDataStrategyRight {
const
target
=
'事件类型'
;
const
target
=
'事件类型'
;
// 获取指定年份的网格事件数量统计,并转换为对象
// 获取指定年份的网格事件数量统计,并转换为对象
return
mapToObj
(
this
.
getListCount
(
eventList
,
target
,
this
.
eventData
,
params
.
query
.
year
));
return
mapToObj
(
this
.
getListCount
(
eventList
,
target
,
this
.
eventData
,
params
.
query
.
year
)
,
"category"
,
"count"
);
}
}
}
}
\ No newline at end of file
src/biz/strategies/right/eventMonthDistributionStrategy.ts
View file @
e2330995
...
@@ -21,7 +21,7 @@ export class eventMonthDistributionStrategy extends abstractDataStrategyRight {
...
@@ -21,7 +21,7 @@ export class eventMonthDistributionStrategy extends abstractDataStrategyRight {
this
.
paramsCheck
(
params
);
this
.
paramsCheck
(
params
);
// 获取指定年份的事件按月分布计数,并转换为对象
// 获取指定年份的事件按月分布计数,并转换为对象
return
mapToObj
(
this
.
getEventMonthDistribution
(
this
.
eventData
,
params
.
query
.
year
));
return
mapToObj
(
this
.
getEventMonthDistribution
(
this
.
eventData
,
params
.
query
.
year
)
,
"month"
,
"count"
);
}
}
/**
/**
...
...
src/biz/strategies/right/eventProcessingTimeStrategy.ts
View file @
e2330995
...
@@ -22,7 +22,7 @@ export class eventProcessingTimeStrategy extends abstractDataStrategyRight {
...
@@ -22,7 +22,7 @@ export class eventProcessingTimeStrategy extends abstractDataStrategyRight {
this
.
paramsCheck
(
params
);
this
.
paramsCheck
(
params
);
// 获取指定年份的事件处理时间,并转换为对象
// 获取指定年份的事件处理时间,并转换为对象
return
mapToObj
(
this
.
getEventProcessingTime
(
this
.
eventData
,
params
.
query
.
year
));
return
mapToObj
(
this
.
getEventProcessingTime
(
this
.
eventData
,
params
.
query
.
year
)
,
"type"
,
"duration"
);
}
}
/**
/**
...
...
src/biz/strategies/right/eventSrcStrategy.ts
View file @
e2330995
...
@@ -27,6 +27,6 @@ export class eventSrcStrategy extends abstractDataStrategyRight {
...
@@ -27,6 +27,6 @@ export class eventSrcStrategy extends abstractDataStrategyRight {
const
target
=
'事件来源'
;
const
target
=
'事件来源'
;
// 获取指定年份的事件来源统计,并转换为对象
// 获取指定年份的事件来源统计,并转换为对象
return
mapToObj
(
this
.
getListCount
(
sourceList
,
target
,
this
.
eventData
,
params
.
query
.
year
));
return
mapToObj
(
this
.
getListCount
(
sourceList
,
target
,
this
.
eventData
,
params
.
query
.
year
)
,
"source"
,
"count"
);
}
}
}
}
\ No newline at end of file
src/biz/strategies/right/eventSubCategoryCountStrategy.ts
View file @
e2330995
...
@@ -27,6 +27,6 @@ export class eventSubCategoryCountStrategy extends abstractDataStrategyRight {
...
@@ -27,6 +27,6 @@ export class eventSubCategoryCountStrategy extends abstractDataStrategyRight {
const
target
=
'事件子类型'
;
const
target
=
'事件子类型'
;
// 获取指定年份的事件子类别计数,并转换为对象
// 获取指定年份的事件子类别计数,并转换为对象
return
mapToObj
(
this
.
getListCount
(
eventList
,
target
,
this
.
eventData
,
params
.
query
.
year
));
return
mapToObj
(
this
.
getListCount
(
eventList
,
target
,
this
.
eventData
,
params
.
query
.
year
)
,
"category"
,
"count"
);
}
}
}
}
\ No newline at end of file
src/biz/strategies/right/eventTimeDistributionStrategy.ts
View file @
e2330995
...
@@ -22,7 +22,7 @@ export class eventTimeDistributionStrategy extends abstractDataStrategyRight {
...
@@ -22,7 +22,7 @@ export class eventTimeDistributionStrategy extends abstractDataStrategyRight {
this
.
paramsCheck
(
params
);
this
.
paramsCheck
(
params
);
// 获取指定年份的事件时间分布,并转换为对象
// 获取指定年份的事件时间分布,并转换为对象
return
mapToObj
(
this
.
getEventTimeDistribution
(
this
.
eventData
,
params
.
query
.
year
));
return
mapToObj
(
this
.
getEventTimeDistribution
(
this
.
eventData
,
params
.
query
.
year
)
,
"hour"
,
"count"
);
}
}
/**
/**
...
...
src/biz/strategies/right/getEventCountByYearStrategy.ts
View file @
e2330995
...
@@ -44,8 +44,8 @@ export class getEventCountByYearStrategy extends abstractDataStrategyRight {
...
@@ -44,8 +44,8 @@ export class getEventCountByYearStrategy extends abstractDataStrategyRight {
rowYear
=
rowDate
.
getFullYear
();
rowYear
=
rowDate
.
getFullYear
();
}
catch
(
e
)
{
}
catch
(
e
)
{
rowYear
=
0
;
rowYear
=
0
;
console
.
log
(
e
);
}
}
console
.
log
(
"rowy"
,
rowYear
);
if
(
rowYear
==
year
)
{
if
(
rowYear
==
year
)
{
eventCount
.
set
(
'事件总数'
,
eventCount
.
get
(
'事件总数'
)
+
1
);
eventCount
.
set
(
'事件总数'
,
eventCount
.
get
(
'事件总数'
)
+
1
);
if
(
row
[
'处置状态'
]
==
'已办结'
)
{
if
(
row
[
'处置状态'
]
==
'已办结'
)
{
...
...
src/biz/strategies/right/gridEventCountStrategy.ts
View file @
e2330995
...
@@ -27,6 +27,6 @@ export class gridEventCountStrategy extends abstractDataStrategyRight {
...
@@ -27,6 +27,6 @@ export class gridEventCountStrategy extends abstractDataStrategyRight {
const
target
=
'网格名称'
;
const
target
=
'网格名称'
;
// 获取指定年份的网格事件数量统计,并转换为对象
// 获取指定年份的网格事件数量统计,并转换为对象
return
mapToObj
(
this
.
getListCount
(
gridList
,
target
,
this
.
eventData
,
params
.
query
.
year
));
return
mapToObj
(
this
.
getListCount
(
gridList
,
target
,
this
.
eventData
,
params
.
query
.
year
)
,
"grid name"
,
"count"
);
}
}
}
}
\ No newline at end of file
src/biz/strategies/strategyFactory.ts
View file @
e2330995
...
@@ -40,7 +40,7 @@ export class strategyFactory {
...
@@ -40,7 +40,7 @@ export class strategyFactory {
'sightVisitorFlowPerHour'
:
sightVisitorFlowByHourStrategy
,
'sightVisitorFlowPerHour'
:
sightVisitorFlowByHourStrategy
,
'guchengLoad'
:
guchengLoadStrategy
,
'guchengLoad'
:
guchengLoadStrategy
,
'totalVisitorFlow'
:
totalVisitorFlowStrategy
,
'totalVisitorFlow'
:
totalVisitorFlowStrategy
,
'totalVisitorFlowBy
Day
'
:
totalVisitorFlowByHourStrategy
,
'totalVisitorFlowBy
Hour
'
:
totalVisitorFlowByHourStrategy
,
'getCurrentEventCount'
:
currentEventStrategy
,
'getCurrentEventCount'
:
currentEventStrategy
,
'totalEventCount'
:
totalEventCountStrategy
,
'totalEventCount'
:
totalEventCountStrategy
,
'getEventCountByYear'
:
getEventCountByYearStrategy
,
'getEventCountByYear'
:
getEventCountByYearStrategy
,
...
...
src/util/mapToObj.ts
View file @
e2330995
/**
/**
* mapToObj.ts
* mapToObj.ts
* 该文件定义了一个函数,用于将 Map 对象转换为
普通的 JavaScript 对象
。
* 该文件定义了一个函数,用于将 Map 对象转换为
包含 key 和 value 的对象数组
。
*/
*/
/**
/**
* 将 Map 对象转换为
普通的 JavaScript 对象
。
* 将 Map 对象转换为
包含 key 和 value 的对象数组
。
* @param map - 要转换的 Map 对象。
* @param map - 要转换的 Map 对象。
* @returns 转换后的 JavaScript 对象。
* @param keyName - key 属性的名称 (默认为 'key')。
* @param valueName - value 属性的名称 (默认为 'value')。
* @returns 转换后的包含自定义 key 和 value 名称的对象数组。
*/
*/
export
default
function
mapToObj
(
map
)
{
export
default
function
mapToObj
(
let
Obj
:
{
[
key
:
string
]:
string
}
=
{};
map
:
Map
<
any
,
any
>
,
keyName
:
string
=
'key'
,
valueName
:
string
=
'value'
):
Array
<
{
[
key
:
string
]:
any
}
>
{
let
result
:
Array
<
{
[
key
:
string
]:
any
}
>
=
[];
map
.
forEach
((
value
,
key
)
=>
{
map
.
forEach
((
value
,
key
)
=>
{
Obj
[
key
]
=
value
;
result
.
push
({
[
keyName
]:
key
,
[
valueName
]:
value
})
;
});
});
return
Obj
;
return
result
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment