UNPKG
node-uci
Version:
latest (1.3.4)
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.1
1.2.0
1.1.0
1.0.0
0.0.1
Universal Chess Interface protocol implementation for node.js
ebemunk/node-uci
node-uci
/
src
/
parseUtil
/
parseBestmove.js
14 lines
(12 loc)
•
290 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import
{
REGEX
}
from
'../const'
export
default
function
parseBestmove
(
line
) {
const
bestmove =
REGEX
.
bestmove
.
exec
(line)
if
(!bestmove || !bestmove[
1
])
return
const
parsed = {
bestmove
: bestmove[
1
], }
if
(bestmove[
2
]) { parsed.
ponder
= bestmove[
2
] }
return
parsed }