Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
hexjelly committed Jan 3, 2017
1 parent 0748ee0 commit d14fdd2
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/lev.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ const nullpadString = require('./util').nullpadString
* let level = new Level()
*/
class Level {
/**
* Represents a level.
* @constructor
*/
constructor () {
this.version = 'Elma'
this.link = 0
Expand All @@ -29,8 +33,9 @@ class Level {

/**
* Loads a level from file.
* @static
* @param {string} filePath Path to file
* @returns {Promise} Promise
* @returns {Promise}
*/
static load (filePath) {
return new Promise((resolve, reject) => {
Expand All @@ -47,7 +52,8 @@ class Level {

/**
* Parses file buffer data into a Level.
* @returns {Promise} Promise
* @private
* @returns {Promise}
*/
_parseFile (buffer) {
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -229,8 +235,9 @@ class Level {

/**
* Encrypts and decrypts top10 list data.
* @static
* @param {Buffer} buffer Data to encrypt or decrypt
* @returns {Buffer} buffer
* @returns {Buffer} Buffer with binary data
*/
static cryptTop10 (buffer) {
let output = Buffer.from(buffer) // copy buffer to not modify reference?
Expand All @@ -250,6 +257,7 @@ class Level {

/**
* Parses top10 list data and returns array with times.
* @private
* @param {Buffer} buffer
* @returns {Array} times
*/
Expand All @@ -274,7 +282,8 @@ class Level {

/**
* Internal convinience method.
* @returns {Promise} Promise
* @private
* @returns {Promise}
*/
_update () {
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -441,6 +450,7 @@ class Level {

/**
* Parse top10 lists from Level class and return buffer with data.
* @private
* @returns {Buffer} buffer
*/
_top10ToBuffer () {
Expand Down Expand Up @@ -473,9 +483,9 @@ class Level {

/**
* Topology check.
* @returns {Promise} Promise
* @returns {Promise}
*/
_checkTopology () {
checkTopology () {
return new Promise((resolve, reject) => {
resolve()
reject()
Expand All @@ -484,7 +494,7 @@ class Level {

/**
* Returns level as buffer data.
* @returns {Promise} Promise
* @returns {Promise}
*/
toBuffer () {
return this._update()
Expand All @@ -501,7 +511,7 @@ class Level {
/**
* Saves a level to file.
* @param {string} filePath Path to file
* @returns {Promise} Promise
* @returns {Promise}
*/
save (filePath) {
return new Promise((resolve, reject) => {
Expand Down

0 comments on commit d14fdd2

Please sign in to comment.