- Now support CQWW series,CQWPX series,NAQP and Standard template log
- works in a browser, on a server
Cabrillo.js is a JavaScript library that converts cabrillo contest files and json to each other.
Currently only npm installation is supported
npm install cabrillo --save
Convert JSON objects into cabrillo's standard format string
objectToCabrillo(json,option)
Example:
var cabrillo = require('cabrillo')
var fs = require('fs') // if in Node.js
var data = fs.readFileSync('contest.json')
var option = {
contest:'NAQP'
}
fs.writeFile("contest.txt", cabrilloCore.objectToCabrillo(data,option), err =>{
if(err) throw err;
console.log("Success!");
} )
Convert a cabrillo string to a json object
cabrilloToObject(String,option)
Example:
var cabrillo = require('cabrillo')
var fs = require('fs') // if in Node.js
var data = fs.readFileSync('contest.txt')
var option = {
contest:'NAQP'
}
fs.writeFile('contest.json', JSON.stringify(cabrilloCore.cabrilloToObject(data,option), null, 4), err => {
if(err) throw err;
console.log("Success!");
});
The sample file example.js is stored in the example folder.
git clone https://github.com/YuYanDev/cabrillo.js
cd cabrillo.js
npm run example
Created by YuYan ( DE BG6TTI - K6TTI )