0.1.0 • Published 6 years ago

cabrillo v0.1.0

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
6 years ago

Cabrillo.js


npm npm downloads

  • Now support CQWW series,CQWPX series,NAQP and Standard template log
  • works in a browser, on a server

Introduction


Cabrillo.js is a JavaScript library that converts cabrillo contest files and json to each other.

Installation


Currently only npm installation is supported

npm install cabrillo --save

Usage


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!");
});

Example


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

License


Apache 2.0

Created by YuYan ( DE BG6TTI - K6TTI )

0.1.0

6 years ago