UNPKG
theorem.js
Version:
latest (1.2.0)
1.2.0
1.1.0
1.0.1
1.0.0
0.1.0
0.0.2
0.0.1
A Math library for computation in JavaScript
github.com/arguiot/TheoremJS
arguiot/TheoremJS
theorem.js
/
src
/
includes
/
functions
/
math
/
algebra
/
f.js
19 lines
(18 loc)
•
277 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
f
(
v, func
) {
if
(
typeof
v ==
'function'
) {
return
{
type
:
"function"
,
core
: v } }
return
{
type
:
"function"
,
v
: v,
f
: func,
core
:
x
=>
{
let
regex =
new
RegExp
(v)
let
newStr = func.
replace
(regex,
`(
${x}
)`
)
return
eval
(newStr).
toFixed
(
14
) } } }