Full implementation of the procol
This commit is contained in:
17
lib/types.js
17
lib/types.js
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @function color
|
||||
* Convert a color to message string
|
||||
* @function color
|
||||
* @param {string|number} value Color to convert
|
||||
* @return {string} Converted color
|
||||
*/
|
||||
@@ -11,8 +11,8 @@ function color (value) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @function bool
|
||||
* Convert a boolean value to message string
|
||||
* @function bool
|
||||
* @param {bool} value Boolean to convert
|
||||
* @return {string} Converted boolean
|
||||
*/
|
||||
@@ -23,21 +23,26 @@ function bool (value) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @function position
|
||||
* Convert a position to message string
|
||||
* @function position
|
||||
* @param {number} line Line of position starting with 1
|
||||
* @param {number} col Column of position starting with 0
|
||||
* @return {string} Converted position
|
||||
*/
|
||||
function position (line, col) {
|
||||
function position (pos) {
|
||||
"use strict";
|
||||
|
||||
return line+"/"+col;
|
||||
if (Array.isArray(pos)) {
|
||||
return pos[0]+"/"+pos[1];
|
||||
}
|
||||
else {
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @function string
|
||||
* Convert a string to message string
|
||||
* @function string
|
||||
* @param {string} value String to convert
|
||||
* @return {string} Converted string
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user