https://github.com/mistereo/sgfjs
Simple SGF parser written in JavaScript.
https://github.com/mistereo/sgfjs
Last synced: about 2 months ago
JSON representation
Simple SGF parser written in JavaScript.
- Host: GitHub
- URL: https://github.com/mistereo/sgfjs
- Owner: Mistereo
- License: mit
- Created: 2015-10-27T14:15:24.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-30T20:26:51.000Z (over 9 years ago)
- Last Synced: 2025-03-15T04:37:15.796Z (2 months ago)
- Language: JavaScript
- Size: 85 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SGF parser
Simple [SGF](https://en.wikipedia.org/wiki/Smart_Game_Format) parser for node and browser.
## Usage
```javascript
var SGF = require('sgfjs');var parsed = SGF.parse('your sgf here');
```For the following sgf:
```
(;FF[4]GM[1]SZ[19];B[aa];W[bb]
(;B[cc]N[Var A];W[dd])
(;B[gg]N[Var C];W[gh];B[hh]))
```Resulting object will be:
```javascript
{
props: {
FF: "4",
GM: "1",
SZ: "19"
},
childs: [{
props: {
B: "aa"
},
childs: [{
props: {
W: "bb"
},
childs: [{
props: {
B: "cc",
N: "Var A"
},
childs: [{
props: {
W: "dd"
},
childs: []
}]
}, {
props: {
B: "gg",
N: "Var C"
},
childs: [{
props: {
W: "gh"
},
childs: [{
props: {
B: "hh"
},
childs: []
}]
}]
}]
}]
}]
}
```## License
The MIT License (MIT)