@ecan-bi/tools 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- export const MODEL_KEY_LIST = ['table', 'bar', 'combograph', 'line', 'pie', 'radar', 'scatter', 'list', 'circulate']
@@ -1,26 +0,0 @@
1
- import dayjs from 'dayjs'
2
- const runCode = (code: string, data?: { [key:string]: any }) => {
3
- const useFn = {
4
- dayjs,
5
- ...data
6
- }
7
- let paramsStr = ''
8
- const params: any = []
9
- for (const key in useFn) {
10
- paramsStr += `${key},`
11
- params.push(useFn[key])
12
- }
13
- paramsStr = paramsStr.replace(/,$/, '')
14
- const runFn = `function (${paramsStr}){return ${code}}`
15
- let result
16
- try {
17
- // eslint-disable-next-line no-new-func
18
- result = Function(`"use strict";return (${runFn})`)()(...params)
19
- } catch (e) {
20
- // console.error()
21
- return code
22
- }
23
- return result
24
- }
25
-
26
- export default runCode